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

+2
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

+10-1
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

+3-1
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

+2
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

+3-1
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

+2
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

+3-1
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

+3-1
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

+3-1
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

+3-1
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

src/libgetopts/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@
7676
//! }
7777
//! ~~~
7878
79-
#![crate_id = "getopts#0.11.0"]
79+
#![crate_id = "getopts#0.11.0"] // NOTE: remove after stage0
80+
#![crate_name = "getopts"]
8081
#![experimental]
8182
#![crate_type = "rlib"]
8283
#![crate_type = "dylib"]
@@ -87,6 +88,7 @@
8788
html_playground_url = "http://play.rust-lang.org/")]
8889
#![feature(globs, phase)]
8990
#![deny(missing_doc)]
91+
#![allow(unused_attribute)] // NOTE: remove after stage0
9092

9193
#[cfg(test)] extern crate debug;
9294
#[cfg(test)] #[phase(plugin, link)] extern crate log;

src/libglob/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
* `glob`/`fnmatch` functions.
2424
*/
2525

26-
#![crate_id = "glob#0.11.0"]
26+
#![crate_id = "glob#0.11.0"] // NOTE: remove after stage0
27+
#![crate_name = "glob"]
2728
#![experimental]
2829
#![crate_type = "rlib"]
2930
#![crate_type = "dylib"]
@@ -32,6 +33,7 @@
3233
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
3334
html_root_url = "http://doc.rust-lang.org/0.11.0/",
3435
html_playground_url = "http://play.rust-lang.org/")]
36+
#![allow(unused_attribute)] // NOTE: remove after stage0
3537

3638
use std::cell::Cell;
3739
use std::{cmp, os, path};

src/libgraphviz/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -266,16 +266,16 @@ pub fn main() {
266266
267267
*/
268268

269-
#![crate_id = "graphviz#0.11.0"]
269+
#![crate_id = "graphviz#0.11.0"] // NOTE: remove after stage0
270+
#![crate_name = "graphviz"]
270271
#![experimental]
271272
#![crate_type = "rlib"]
272273
#![crate_type = "dylib"]
273274
#![license = "MIT/ASL2"]
274275
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
275276
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
276277
html_root_url = "http://doc.rust-lang.org/0.11.0/")]
277-
278-
#![experimental]
278+
#![allow(unused_attribute)] // NOTE: remove after stage0
279279

280280
use std::io;
281281
use std::str;

src/libgreen/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@
197197
//! pool.shutdown();
198198
//! ```
199199
200-
#![crate_id = "green#0.11.0"]
200+
#![crate_id = "green#0.11.0"] // NOTE: remove after stage0
201+
#![crate_name = "green"]
201202
#![experimental]
202203
#![license = "MIT/ASL2"]
203204
#![crate_type = "rlib"]
@@ -208,10 +209,9 @@
208209
html_playground_url = "http://play.rust-lang.org/")]
209210

210211
// NB this does *not* include globs, please keep it that way.
211-
#![feature(macro_rules, phase)]
212-
#![allow(visible_private_types)]
213-
#![allow(deprecated)]
214-
#![feature(default_type_params)]
212+
#![feature(macro_rules, phase, default_type_params)]
213+
#![allow(visible_private_types, deprecated)]
214+
#![allow(unused_attribute)] // NOTE: remove after stage0
215215

216216
#[cfg(test)] #[phase(plugin, link)] extern crate log;
217217
#[cfg(test)] extern crate rustuv;

src/libhexfloat/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ fn main() {
3636
3737
*/
3838

39-
#![crate_id = "hexfloat#0.11.0"]
39+
#![crate_id = "hexfloat#0.11.0"] // NOTE: remove after stage0
40+
#![crate_name = "hexfloat"]
4041
#![experimental]
4142
#![crate_type = "rlib"]
4243
#![crate_type = "dylib"]
@@ -45,6 +46,7 @@ fn main() {
4546
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
4647
html_root_url = "http://doc.rust-lang.org/0.11.0/")]
4748
#![feature(plugin_registrar, managed_boxes)]
49+
#![allow(unused_attribute)] // NOTE: remove after stage0
4850

4951
extern crate syntax;
5052
extern crate rustc;

src/liblibc/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
// except according to those terms.
1010

1111
#![feature(globs)]
12-
#![crate_id = "libc#0.11.0"]
12+
#![crate_id = "libc#0.11.0"] // NOTE: remove after a stage0 snap
13+
#![crate_name = "libc"]
1314
#![experimental]
1415
#![no_std] // we don't need std, and we can't have std, since it doesn't exist
1516
// yet. std depends on us.
@@ -18,6 +19,7 @@
1819
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
1920
html_root_url = "http://doc.rust-lang.org/0.11.0/",
2021
html_playground_url = "http://play.rust-lang.org/")]
22+
#![allow(unused_attribute)] // NOTE: remove after stage0
2123

2224
/*!
2325
* Bindings for the C standard library and other platform libraries

src/liblog/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ if logging is disabled, none of the components of the log will be executed.
105105
106106
*/
107107

108-
#![crate_id = "log#0.11.0"]
108+
#![crate_id = "log#0.11.0"] // NOTE: Remove after stage0
109+
#![crate_name = "log"]
109110
#![experimental]
110111
#![license = "MIT/ASL2"]
111112
#![crate_type = "rlib"]
@@ -114,7 +115,7 @@ if logging is disabled, none of the components of the log will be executed.
114115
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
115116
html_root_url = "http://doc.rust-lang.org/0.11.0/",
116117
html_playground_url = "http://play.rust-lang.org/")]
117-
118+
#![allow(unused_attribute)] // NOTE: remove after stage0
118119
#![feature(macro_rules)]
119120
#![deny(missing_doc)]
120121

src/libnative/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
//! }
4747
//! ```
4848
49-
#![crate_id = "native#0.11.0"]
49+
#![crate_id = "native#0.11.0"] // NOTE: remove after stage0
50+
#![crate_name = "native"]
5051
#![experimental]
5152
#![license = "MIT/ASL2"]
5253
#![crate_type = "rlib"]
@@ -57,6 +58,7 @@
5758

5859
#![deny(unused_result, unused_must_use)]
5960
#![allow(non_camel_case_types, deprecated)]
61+
#![allow(unused_attribute)] // NOTE: remove after stage0
6062
#![feature(default_type_params, lang_items)]
6163

6264
// NB this crate explicitly does *not* allow glob imports, please seriously

src/libnum/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
4545
#![feature(macro_rules)]
4646

47-
#![crate_id = "num#0.11.0"]
47+
#![crate_id = "num#0.11.0"] // NOTE: remove after stage0
48+
#![crate_name = "num"]
4849
#![experimental]
4950
#![crate_type = "rlib"]
5051
#![crate_type = "dylib"]
@@ -53,7 +54,7 @@
5354
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
5455
html_root_url = "http://doc.rust-lang.org/0.11.0/",
5556
html_playground_url = "http://play.rust-lang.org/")]
56-
57+
#![allow(unused_attribute)] // NOTE: remove after stage0
5758
#![allow(deprecated)] // from_str_radix
5859

5960
extern crate rand;

src/librand/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
//! is not recommended to use this library directly, but rather the official
1717
//! interface through `std::rand`.
1818
19-
#![crate_id = "rand#0.11.0"]
19+
#![crate_id = "rand#0.11.0"] // NOTE: remove after a stage0 snap
20+
#![crate_name = "rand"]
2021
#![license = "MIT/ASL2"]
2122
#![crate_type = "rlib"]
2223
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
@@ -25,6 +26,7 @@
2526
html_playground_url = "http://play.rust-lang.org/")]
2627

2728
#![feature(macro_rules, phase, globs)]
29+
#![allow(unused_attribute)] // NOTE: remove after stage0
2830
#![no_std]
2931
#![experimental]
3032

src/libregex/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@
353353
//! characters in the search text and `m` is the number of instructions in a
354354
//! compiled expression.
355355
356-
#![crate_id = "regex#0.11.0"]
356+
#![crate_id = "regex#0.11.0"] // NOTE: remove after stage0
357+
#![crate_name = "regex"]
357358
#![crate_type = "rlib"]
358359
#![crate_type = "dylib"]
359360
#![experimental]
@@ -364,6 +365,7 @@
364365
html_playground_url = "http://play.rust-lang.org/")]
365366

366367
#![feature(macro_rules, phase)]
368+
#![allow(unused_attribute)] // NOTE: remove after stage0
367369
#![deny(missing_doc)]
368370

369371
#[cfg(test)]

src/libregex_macros/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
//! This crate provides the `regex!` macro. Its use is documented in the
1212
//! `regex` crate.
1313
14-
#![crate_id = "regex_macros#0.11.0"]
14+
#![crate_id = "regex_macros#0.11.0"] // NOTE: remove after stage0
15+
#![crate_name = "regex_macros"]
1516
#![crate_type = "dylib"]
1617
#![experimental]
1718
#![license = "MIT/ASL2"]
1819
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1920
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
2021
html_root_url = "http://doc.rust-lang.org/0.11.0/")]
22+
#![allow(unused_attribute)] // NOTE: remove after stage0
2123

2224
#![feature(plugin_registrar, managed_boxes, quote)]
2325

0 commit comments

Comments
 (0)