Skip to content

Commit 42c4ae0

Browse files
Deduplicate CrateConfig
1 parent cc2c33a commit 42c4ae0

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

src/librustc_session/config.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ use rustc_data_structures::impl_stable_hash_via_hash;
1212
use rustc_target::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, RelroLevel};
1313
use rustc_target::spec::{Target, TargetTriple};
1414

15-
// Duplicated from syntax::ast for now
16-
type CrateConfig = FxHashSet<(Symbol, Option<Symbol>)>;
17-
1815
use syntax_pos::source_map::{FileName, FilePathMapping};
1916
use syntax_pos::edition::{Edition, EDITION_NAME_LIST, DEFAULT_EDITION};
2017
use syntax_pos::symbol::{sym, Symbol};
2118
use rustc_feature::UnstableFeatures;
19+
use crate::parse::CrateConfig;
2220

2321
use rustc_errors::emitter::HumanReadableErrorType;
2422
use rustc_errors::{ColorConfig, FatalError, Handler};

src/librustc_session/parse.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ use syntax_pos::source_map::{SourceMap, FilePathMapping};
1616
use std::path::PathBuf;
1717
use std::str;
1818

19-
// Duplicated from syntax::ast for now
20-
type CrateConfig = FxHashSet<(Symbol, Option<Symbol>)>;
19+
/// The set of keys (and, optionally, values) that define the compilation
20+
/// environment of the crate, used to drive conditional compilation.
21+
pub type CrateConfig = FxHashSet<(Symbol, Option<Symbol>)>;
2122

2223
/// Collected spans during parsing for places where a certain feature was
2324
/// used and should be feature gated accordingly in `check_crate`.

src/libsyntax/ast.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use crate::tokenstream::{TokenStream, TokenTree, DelimSpan};
3232
use syntax_pos::symbol::{kw, sym, Symbol};
3333
use syntax_pos::{Span, DUMMY_SP};
3434

35-
use rustc_data_structures::fx::FxHashSet;
3635
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
3736
use rustc_data_structures::sync::Lrc;
3837
use rustc_data_structures::thin_vec::ThinVec;
@@ -431,9 +430,7 @@ pub struct WhereEqPredicate {
431430
pub rhs_ty: P<Ty>,
432431
}
433432

434-
/// The set of `MetaItem`s that define the compilation environment of the crate,
435-
/// used to drive conditional compilation.
436-
pub type CrateConfig = FxHashSet<(Name, Option<Symbol>)>;
433+
pub use rustc_session::parse::CrateConfig;
437434

438435
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
439436
pub struct Crate {

0 commit comments

Comments
 (0)