about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2019-11-29 16:09:00 -0500
committerMark Rousskov <mark.simulacrum@gmail.com>2019-12-03 12:19:17 -0500
commit42c4ae0d4bada3ae2096a197e59474485459f2a9 (patch)
tree6665b4c062a43da4293a8dbe53915b700a7685ad
parentcc2c33a1567f3a29a446ae2985080e55c4dc2b8b (diff)
downloadrust-42c4ae0d4bada3ae2096a197e59474485459f2a9.tar.gz
rust-42c4ae0d4bada3ae2096a197e59474485459f2a9.zip
Deduplicate CrateConfig
-rw-r--r--src/librustc_session/config.rs4
-rw-r--r--src/librustc_session/parse.rs5
-rw-r--r--src/libsyntax/ast.rs5
3 files changed, 5 insertions, 9 deletions
diff --git a/src/librustc_session/config.rs b/src/librustc_session/config.rs
index c05704dbab5..58113bb8cd6 100644
--- a/src/librustc_session/config.rs
+++ b/src/librustc_session/config.rs
@@ -12,13 +12,11 @@ use rustc_data_structures::impl_stable_hash_via_hash;
 use rustc_target::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, RelroLevel};
 use rustc_target::spec::{Target, TargetTriple};
 
-// Duplicated from syntax::ast for now
-type CrateConfig = FxHashSet<(Symbol, Option<Symbol>)>;
-
 use syntax_pos::source_map::{FileName, FilePathMapping};
 use syntax_pos::edition::{Edition, EDITION_NAME_LIST, DEFAULT_EDITION};
 use syntax_pos::symbol::{sym, Symbol};
 use rustc_feature::UnstableFeatures;
+use crate::parse::CrateConfig;
 
 use rustc_errors::emitter::HumanReadableErrorType;
 use rustc_errors::{ColorConfig, FatalError, Handler};
diff --git a/src/librustc_session/parse.rs b/src/librustc_session/parse.rs
index a9fdd4a1242..09442f29b7a 100644
--- a/src/librustc_session/parse.rs
+++ b/src/librustc_session/parse.rs
@@ -16,8 +16,9 @@ use syntax_pos::source_map::{SourceMap, FilePathMapping};
 use std::path::PathBuf;
 use std::str;
 
-// Duplicated from syntax::ast for now
-type CrateConfig = FxHashSet<(Symbol, Option<Symbol>)>;
+/// The set of keys (and, optionally, values) that define the compilation
+/// environment of the crate, used to drive conditional compilation.
+pub type CrateConfig = FxHashSet<(Symbol, Option<Symbol>)>;
 
 /// Collected spans during parsing for places where a certain feature was
 /// used and should be feature gated accordingly in `check_crate`.
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index ab91d99cff8..75ddf10514d 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -32,7 +32,6 @@ use crate::tokenstream::{TokenStream, TokenTree, DelimSpan};
 use syntax_pos::symbol::{kw, sym, Symbol};
 use syntax_pos::{Span, DUMMY_SP};
 
-use rustc_data_structures::fx::FxHashSet;
 use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
 use rustc_data_structures::sync::Lrc;
 use rustc_data_structures::thin_vec::ThinVec;
@@ -431,9 +430,7 @@ pub struct WhereEqPredicate {
     pub rhs_ty: P<Ty>,
 }
 
-/// The set of `MetaItem`s that define the compilation environment of the crate,
-/// used to drive conditional compilation.
-pub type CrateConfig = FxHashSet<(Name, Option<Symbol>)>;
+pub use rustc_session::parse::CrateConfig;
 
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct Crate {