Skip to content

Commit c3ef04b

Browse files
committed
auto merge of #15319 : alexcrichton/rust/no-crate-id, r=brson
This is an implementation of [RFC 35](https://github.com/rust-lang/rfcs/blob/master/active/0035-remove-crate-id.md). The summary for this PR is the same as that of the RFC, with one addendum: * Removes the `#[crate_id]` attribute and knowledge of versions from rustc. * Added a `#[crate_name]` attribute similar to the old `#[crate_id]` attribute * Output filenames no longer have versions or hashes * Symbols no longer have versions (they still have hashes) * A new flag, `--extern`, is used to override searching for external crates * A new flag, `-C metadata=foo`, used when hashing symbols * [added] An old flag, `--crate-name`, was re purposed to specify the crate name from the command line. I tried to maintain backwards compatibility wherever possible (with warnings being printed). If I missed anywhere, however, please let me know! [breaking-change] Closes #14468 Closes #14469 Closes #14470 Closes #14471
2 parents b8ef5cf + 56f7101 commit c3ef04b

File tree

113 files changed

+1009
-717
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+1009
-717
lines changed

mk/main.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
CFG_RELEASE_NUM=0.11.0
1717
CFG_RELEASE_LABEL=
1818

19+
CFG_FILENAME_EXTRA=4e7c5e5c
20+
1921
ifndef CFG_ENABLE_NIGHTLY
2022
# This is the normal version string
2123
CFG_RELEASE=$(CFG_RELEASE_NUM)$(CFG_RELEASE_LABEL)

mk/target.mk

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ $(foreach host,$(CFG_HOST), \
4444
$(foreach crate,$(CRATES), \
4545
$(eval $(call RUST_CRATE_FULLDEPS,$(stage),$(target),$(host),$(crate)))))))
4646

47+
# NOTE: after a stage0 snap this should be just EXTRA_FILENAME, not with a stage
48+
# bound
49+
EXTRA_FILENAME_0 =
50+
EXTRA_FILENAME_1 = -C extra-filename=-$(CFG_FILENAME_EXTRA)
51+
EXTRA_FILENAME_2 = -C extra-filename=-$(CFG_FILENAME_EXTRA)
52+
EXTRA_FILENAME_3 = -C extra-filename=-$(CFG_FILENAME_EXTRA)
53+
4754
# RUST_TARGET_STAGE_N template: This defines how target artifacts are built
4855
# for all stage/target architecture combinations. This is one giant rule which
4956
# works as follows:
@@ -85,7 +92,9 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
8592
-L "$$(LLVM_LIBDIR_$(2))" \
8693
-L "$$(dir $$(LLVM_STDCPP_LOCATION_$(2)))" \
8794
$$(RUSTFLAGS_$(4)) \
88-
--out-dir $$(@D) $$<
95+
--out-dir $$(@D) \
96+
$$(EXTRA_FILENAME_$(1)) \
97+
$$<
8998
@touch $$@
9099
$$(call LIST_ALL_OLD_GLOB_MATCHES,\
91100
$$(dir $$@)$$(call CFG_LIB_GLOB_$(2),$(4)))

src/liballoc/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
//! by libc malloc/free. The `libc_heap` module is defined to be wired up to
6161
//! the system malloc/free.
6262
63-
#![crate_id = "alloc#0.11.0"]
63+
#![crate_id = "alloc#0.11.0"] // NOTE: remove after a stage0 snap
64+
#![crate_name = "alloc"]
6465
#![experimental]
6566
#![license = "MIT/ASL2"]
6667
#![crate_type = "rlib"]
@@ -70,6 +71,7 @@
7071

7172
#![no_std]
7273
#![feature(lang_items, phase, unsafe_destructor)]
74+
#![allow(unused_attribute)] // NOTE: remove after stage0
7375

7476
#[phase(plugin, link)]
7577
extern crate core;

src/libarena/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
//! more complex, slower Arena which can hold objects of any type.
2121
2222
#![crate_id = "arena#0.11.0"]
23+
#![crate_name = "arena"]
2324
#![experimental]
2425
#![crate_type = "rlib"]
2526
#![crate_type = "dylib"]
@@ -30,6 +31,7 @@
3031

3132
#![feature(unsafe_destructor)]
3233
#![allow(missing_doc)]
34+
#![allow(unused_attribute)] // NOTE: remove after stage0
3335

3436
use std::cell::{Cell, RefCell};
3537
use std::cmp;

src/libcollections/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
* Collection types.
1313
*/
1414

15-
#![crate_id = "collections#0.11.0"]
15+
#![crate_id = "collections#0.11.0"] // NOTE: remove after stage0
16+
#![crate_name = "collections"]
1617
#![experimental]
1718
#![crate_type = "rlib"]
1819
#![license = "MIT/ASL2"]
@@ -24,6 +25,7 @@
2425
#![feature(macro_rules, managed_boxes, default_type_params, phase, globs)]
2526
#![feature(unsafe_destructor)]
2627
#![no_std]
28+
#![allow(unused_attribute)] // NOTE: remove after stage0
2729

2830
#[phase(plugin, link)] extern crate core;
2931
extern crate alloc;

src/libcore/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
// separate crate, libcoretest, to avoid bizarre issues.
4949

5050
#![crate_id = "core#0.11.0"]
51+
#![crate_name = "core"]
5152
#![experimental]
5253
#![license = "MIT/ASL2"]
5354
#![crate_type = "rlib"]
@@ -60,6 +61,7 @@
6061
#![feature(globs, intrinsics, lang_items, macro_rules, managed_boxes, phase)]
6162
#![feature(simd, unsafe_destructor)]
6263
#![deny(missing_doc)]
64+
#![allow(unused_attribute)] // NOTE: remove after stage0
6365

6466
mod macros;
6567

src/libdebug/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
//! Additionally, it is not guaranteed that functionality such as reflection
1717
//! will persist into the future.
1818
19-
#![crate_id = "debug#0.11.0"]
19+
#![crate_id = "debug#0.11.0"] // NOTE: remove after stage0
20+
#![crate_name = "debug"]
2021
#![experimental]
2122
#![license = "MIT/ASL2"]
2223
#![crate_type = "rlib"]
@@ -27,6 +28,7 @@
2728
#![experimental]
2829
#![feature(managed_boxes, macro_rules)]
2930
#![allow(experimental)]
31+
#![allow(unused_attribute)] // NOTE: remove after stage0
3032

3133
pub mod fmt;
3234
pub mod reflect;

src/libflate/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ Simple [DEFLATE][def]-based compression. This is a wrapper around the
1818
1919
*/
2020

21-
#![crate_id = "flate#0.11.0"]
21+
#![crate_id = "flate#0.11.0"] // NOTE: remove after stage0
22+
#![crate_name = "flate"]
2223
#![experimental]
2324
#![crate_type = "rlib"]
2425
#![crate_type = "dylib"]
@@ -27,6 +28,7 @@ Simple [DEFLATE][def]-based compression. This is a wrapper around the
2728
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
2829
html_root_url = "http://doc.rust-lang.org/0.11.0/")]
2930
#![feature(phase)]
31+
#![allow(unused_attribute)] // NOTE: remove after stage0
3032

3133
#[cfg(test)] #[phase(plugin, link)] extern crate log;
3234

src/libfmt_macros/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
//! Parsing does not happen at runtime: structures of `std::fmt::rt` are
1515
//! generated instead.
1616
17-
#![crate_id = "fmt_macros#0.11.0"]
17+
#![crate_id = "fmt_macros#0.11.0"] // NOTE: remove after stage0c
18+
#![crate_name = "fmt_macros"]
1819
#![experimental]
1920
#![license = "MIT/ASL2"]
2021
#![crate_type = "rlib"]
2122
#![crate_type = "dylib"]
2223
#![feature(macro_rules, globs)]
24+
#![allow(unused_attribute)] // NOTE: remove after stage0
2325

2426
use std::char;
2527
use std::str;

src/libfourcc/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,16 @@ fn main() {
3939
4040
*/
4141

42-
#![crate_id = "fourcc#0.11.0"]
42+
#![crate_id = "fourcc#0.11.0"] // NOTE: remove after stage0
43+
#![crate_name = "fourcc"]
4344
#![experimental]
4445
#![crate_type = "rlib"]
4546
#![crate_type = "dylib"]
4647
#![license = "MIT/ASL2"]
4748
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
4849
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
4950
html_root_url = "http://doc.rust-lang.org/0.11.0/")]
51+
#![allow(unused_attribute)] // NOTE: remove after stage0
5052

5153
#![feature(plugin_registrar, managed_boxes)]
5254

0 commit comments

Comments
 (0)