Skip to content

Commit db1acaa

Browse files
committed
Auto merge of rust-lang#53073 - Mark-Simulacrum:data-structures, r=pnkfelix
Cleanup to librustc::session and related code No functional changes, just some cleanup. This also creates the `rustc_fs_util` crate, but I can remove that change if desired. It felt a little odd to force crates to depend on librustc for some fs utilities; and also seemed good to generally keep the size of librustc lower (for compile times); fs_util will compile in parallel with essentially the first crate since it has no dependencies beyond std.
2 parents fb65d75 + a8e19be commit db1acaa

File tree

42 files changed

+185
-169
lines changed

Some content is hidden

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

42 files changed

+185
-169
lines changed

src/Cargo.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,6 +1887,7 @@ dependencies = [
18871887
"rustc_apfloat 0.0.0",
18881888
"rustc_data_structures 0.0.0",
18891889
"rustc_errors 0.0.0",
1890+
"rustc_fs_util 0.0.0",
18901891
"rustc_target 0.0.0",
18911892
"scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
18921893
"serialize 0.0.0",
@@ -2185,6 +2186,10 @@ dependencies = [
21852186
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
21862187
]
21872188

2189+
[[package]]
2190+
name = "rustc_fs_util"
2191+
version = "0.0.0"
2192+
21882193
[[package]]
21892194
name = "rustc_incremental"
21902195
version = "0.0.0"
@@ -2194,6 +2199,7 @@ dependencies = [
21942199
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
21952200
"rustc 0.0.0",
21962201
"rustc_data_structures 0.0.0",
2202+
"rustc_fs_util 0.0.0",
21972203
"serialize 0.0.0",
21982204
"syntax 0.0.0",
21992205
"syntax_pos 0.0.0",

src/librustc/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ backtrace = "0.3.3"
3232
parking_lot = "0.5.5"
3333
byteorder = { version = "1.1", features = ["i128"]}
3434
chalk-engine = { version = "0.6.0", default-features=false }
35+
rustc_fs_util = { path = "../librustc_fs_util" }
3536

3637
# Note that these dependencies are a lie, they're just here to get linkage to
3738
# work.

src/librustc/hir/map/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use super::*;
1212
use dep_graph::{DepGraph, DepKind, DepNodeIndex};
1313
use hir::def_id::{LOCAL_CRATE, CrateNum};
1414
use hir::intravisit::{Visitor, NestedVisitorMap};
15-
use hir::svh::Svh;
15+
use rustc_data_structures::svh::Svh;
1616
use ich::Fingerprint;
1717
use middle::cstore::CrateStore;
1818
use session::CrateDisambiguator;

src/librustc/hir/map/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ use hir::def_id::{CRATE_DEF_INDEX, DefId, LocalDefId, DefIndexAddressSpace};
2222
use middle::cstore::CrateStore;
2323

2424
use rustc_target::spec::abi::Abi;
25+
use rustc_data_structures::svh::Svh;
2526
use syntax::ast::{self, Name, NodeId, CRATE_NODE_ID};
2627
use syntax::codemap::Spanned;
2728
use syntax::ext::base::MacroKind;
2829
use syntax_pos::{Span, DUMMY_SP};
2930

3031
use hir::*;
3132
use hir::print::Nested;
32-
use hir::svh::Svh;
3333
use util::nodemap::FxHashMap;
3434

3535
use std::io;

src/librustc/hir/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ pub mod lowering;
7070
pub mod map;
7171
pub mod pat_util;
7272
pub mod print;
73-
pub mod svh;
7473

7574
/// A HirId uniquely identifies a node in the HIR of the current crate. It is
7675
/// composed of the `owner`, which is the DefIndex of the directly enclosing

src/librustc/ich/hcx.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use rustc_data_structures::stable_hasher::{HashStable,
3737
use rustc_data_structures::accumulate_vec::AccumulateVec;
3838
use rustc_data_structures::fx::{FxHashSet, FxHashMap};
3939

40-
pub fn compute_ignored_attr_names() -> FxHashSet<Symbol> {
40+
fn compute_ignored_attr_names() -> FxHashSet<Symbol> {
4141
debug_assert!(ich::IGNORED_ATTRIBUTES.len() > 0);
4242
ich::IGNORED_ATTRIBUTES.iter().map(|&s| Symbol::intern(s)).collect()
4343
}
@@ -183,7 +183,10 @@ impl<'a> StableHashingContext<'a> {
183183

184184
#[inline]
185185
pub fn is_ignored_attr(&self, name: Symbol) -> bool {
186-
self.sess.ignored_attr_names.contains(&name)
186+
thread_local! {
187+
static IGNORED_ATTRIBUTES: FxHashSet<Symbol> = compute_ignored_attr_names();
188+
}
189+
IGNORED_ATTRIBUTES.with(|attrs| attrs.contains(&name))
187190
}
188191

189192
pub fn hash_hir_item_like<F: FnOnce(&mut Self)>(&mut self, f: F) {

src/librustc/ich/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@
1010

1111
//! ICH - Incremental Compilation Hash
1212
13-
pub use self::fingerprint::Fingerprint;
13+
crate use rustc_data_structures::fingerprint::Fingerprint;
1414
pub use self::caching_codemap_view::CachingCodemapView;
1515
pub use self::hcx::{StableHashingContextProvider, StableHashingContext, NodeIdHashingMode,
16-
hash_stable_trait_impls, compute_ignored_attr_names};
17-
mod fingerprint;
16+
hash_stable_trait_impls};
1817
mod caching_codemap_view;
1918
mod hcx;
2019

src/librustc/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
#![feature(in_band_lifetimes)]
7373
#![feature(macro_at_most_once_rep)]
7474
#![feature(crate_in_paths)]
75+
#![feature(crate_visibility_modifier)]
7576

7677
#![recursion_limit="512"]
7778

@@ -99,6 +100,7 @@ extern crate syntax_pos;
99100
extern crate jobserver;
100101
extern crate proc_macro;
101102
extern crate chalk_engine;
103+
extern crate rustc_fs_util;
102104

103105
extern crate serialize as rustc_serialize; // used by deriving
104106

@@ -162,9 +164,9 @@ pub mod util {
162164
pub mod common;
163165
pub mod ppaux;
164166
pub mod nodemap;
165-
pub mod fs;
166167
pub mod time_graph;
167168
pub mod profiling;
169+
pub mod bug;
168170
}
169171

170172
// A private module so that macro-expanded idents like

src/librustc/macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ macro_rules! enum_from_u32 {
5151
macro_rules! bug {
5252
() => ( bug!("impossible case reached") );
5353
($($message:tt)*) => ({
54-
$crate::session::bug_fmt(file!(), line!(), format_args!($($message)*))
54+
$crate::util::bug::bug_fmt(file!(), line!(), format_args!($($message)*))
5555
})
5656
}
5757

5858
#[macro_export]
5959
macro_rules! span_bug {
6060
($span:expr, $($message:tt)*) => ({
61-
$crate::session::span_bug_fmt(file!(), line!(), $span, format_args!($($message)*))
61+
$crate::util::bug::span_bug_fmt(file!(), line!(), $span, format_args!($($message)*))
6262
})
6363
}
6464

src/librustc/middle/cstore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
use hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
2626
use hir::map as hir_map;
2727
use hir::map::definitions::{DefKey, DefPathTable};
28-
use hir::svh::Svh;
28+
use rustc_data_structures::svh::Svh;
2929
use ty::{self, TyCtxt};
3030
use session::{Session, CrateDisambiguator};
3131
use session::search_paths::PathKind;

0 commit comments

Comments
 (0)