Skip to content

Commit 611b111

Browse files
committed
Move unused-extern-crate to late pass
1 parent bc5bd51 commit 611b111

Some content is hidden

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

43 files changed

+76
-39
lines changed

src/Cargo.lock

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/liballoc/tests/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#![deny(warnings)]
1212

13-
#![feature(alloc)]
1413
#![feature(attr_literals)]
1514
#![feature(box_syntax)]
1615
#![feature(inclusive_range_syntax)]
@@ -27,14 +26,10 @@
2726
#![feature(splice)]
2827
#![feature(str_escape)]
2928
#![feature(string_retain)]
30-
#![feature(test)]
3129
#![feature(unboxed_closures)]
3230
#![feature(unicode)]
3331

34-
extern crate alloc;
35-
extern crate test;
3632
extern crate std_unicode;
37-
extern crate core;
3833

3934
use std::hash::{Hash, Hasher};
4035
use std::collections::hash_map::DefaultHasher;

src/libcore/tests/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#![feature(inclusive_range)]
2727
#![feature(inclusive_range_syntax)]
2828
#![feature(iter_rfind)]
29-
#![feature(libc)]
3029
#![feature(nonzero)]
3130
#![feature(ord_max_min)]
3231
#![feature(rand)]
@@ -41,13 +40,10 @@
4140
#![feature(test)]
4241
#![feature(trusted_len)]
4342
#![feature(try_from)]
44-
#![feature(unicode)]
4543
#![feature(unique)]
4644

4745
extern crate core;
4846
extern crate test;
49-
extern crate libc;
50-
extern crate std_unicode;
5147
extern crate rand;
5248

5349
mod any;

src/librustc/dep_graph/dep_node.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,8 @@ define_dep_nodes!( <'tcx>
522522
[] DylibDepFormats(DefId),
523523
[] IsAllocator(DefId),
524524
[] IsPanicRuntime(DefId),
525+
[] IsCompilerBuiltins(DefId),
526+
[] HasGlobalAllocator(DefId),
525527
[] ExternCrate(DefId),
526528
[] LintLevels,
527529
);

src/librustc/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#![feature(core_intrinsics)]
2727
#![feature(discriminant_value)]
2828
#![feature(i128_type)]
29-
#![feature(libc)]
3029
#![feature(never_type)]
3130
#![feature(nonzero)]
3231
#![feature(quote)]
@@ -45,7 +44,6 @@ extern crate core;
4544
extern crate fmt_macros;
4645
extern crate getopts;
4746
extern crate graphviz;
48-
extern crate libc;
4947
extern crate owning_ref;
5048
extern crate rustc_back;
5149
extern crate rustc_data_structures;
@@ -62,7 +60,9 @@ extern crate serialize as rustc_serialize; // used by deriving
6260

6361
// Note that librustc doesn't actually depend on these crates, see the note in
6462
// `Cargo.toml` for this crate about why these are here.
63+
#[allow(unused_extern_crates)]
6564
extern crate flate2;
65+
#[allow(unused_extern_crates)]
6666
extern crate test;
6767

6868
#[macro_use]

src/librustc/ty/context.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,8 @@ pub struct GlobalCtxt<'tcx> {
797797

798798
pub maybe_unused_trait_imports: NodeSet,
799799

800+
pub maybe_unused_extern_crates: Vec<(NodeId, Span, CrateNum)>,
801+
800802
// Internal cache for metadata decoding. No need to track deps on this.
801803
pub rcache: RefCell<FxHashMap<ty::CReaderCacheKey, Ty<'tcx>>>,
802804

@@ -1038,6 +1040,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
10381040
mir_passes,
10391041
freevars: RefCell::new(resolutions.freevars),
10401042
maybe_unused_trait_imports: resolutions.maybe_unused_trait_imports,
1043+
maybe_unused_extern_crates: resolutions.maybe_unused_extern_crates,
10411044
rcache: RefCell::new(FxHashMap()),
10421045
normalized_cache: RefCell::new(FxHashMap()),
10431046
inhabitedness_cache: RefCell::new(FxHashMap()),

src/librustc/ty/maps.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,18 @@ impl<'tcx> QueryDescription for queries::is_panic_runtime<'tcx> {
516516
}
517517
}
518518

519+
impl<'tcx> QueryDescription for queries::is_compiler_builtins<'tcx> {
520+
fn describe(_: TyCtxt, _: DefId) -> String {
521+
"checking if the crate is_compiler_builtins".to_string()
522+
}
523+
}
524+
525+
impl<'tcx> QueryDescription for queries::has_global_allocator<'tcx> {
526+
fn describe(_: TyCtxt, _: DefId) -> String {
527+
"checking if the crate has_global_allocator".to_string()
528+
}
529+
}
530+
519531
impl<'tcx> QueryDescription for queries::extern_crate<'tcx> {
520532
fn describe(_: TyCtxt, _: DefId) -> String {
521533
"getting crate's ExternCrateData".to_string()
@@ -1079,6 +1091,8 @@ define_maps! { <'tcx>
10791091

10801092
[] is_allocator: IsAllocator(DefId) -> bool,
10811093
[] is_panic_runtime: IsPanicRuntime(DefId) -> bool,
1094+
[] is_compiler_builtins: IsCompilerBuiltins(DefId) -> bool,
1095+
[] has_global_allocator: HasGlobalAllocator(DefId) -> bool,
10821096

10831097
[] extern_crate: ExternCrate(DefId) -> Rc<Option<ExternCrate>>,
10841098

src/librustc/ty/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ pub struct Resolutions {
131131
pub freevars: FreevarMap,
132132
pub trait_map: TraitMap,
133133
pub maybe_unused_trait_imports: NodeSet,
134+
pub maybe_unused_extern_crates: Vec<(NodeId, Span, CrateNum)>,
134135
pub export_map: ExportMap,
135136
}
136137

src/librustc_borrowck/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@ syntax = { path = "../libsyntax" }
1515
syntax_pos = { path = "../libsyntax_pos" }
1616
graphviz = { path = "../libgraphviz" }
1717
rustc = { path = "../librustc" }
18-
rustc_data_structures = { path = "../librustc_data_structures" }
1918
rustc_mir = { path = "../librustc_mir" }
2019
rustc_errors = { path = "../librustc_errors" }

src/librustc_borrowck/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ extern crate rustc_errors as errors;
2828
extern crate graphviz as dot;
2929
#[macro_use]
3030
extern crate rustc;
31-
extern crate rustc_data_structures;
3231
extern crate rustc_mir;
33-
extern crate core; // for NonZero
3432

3533
pub use borrowck::check_crate;
3634
pub use borrowck::build_borrowck_dataflow_data_for_fn;

0 commit comments

Comments
 (0)