Turn features() into a query.

This commit is contained in:
Michael Woerister 2018-02-14 16:11:02 +01:00
parent e2746d8700
commit 542bc75dea
49 changed files with 207 additions and 140 deletions

View file

@ -650,7 +650,7 @@ pub fn phase_2_configure_and_expand_inner<'a, F>(sess: &'a Session,
let (mut krate, features) = syntax::config::features(krate, &sess.parse_sess, sess.opts.test);
// these need to be set "early" so that expansion sees `quote` if enabled.
*sess.features.borrow_mut() = features;
sess.init_features(features);
*sess.crate_types.borrow_mut() = collect_crate_types(sess, &krate.attrs);
@ -699,7 +699,7 @@ pub fn phase_2_configure_and_expand_inner<'a, F>(sess: &'a Session,
let mut registry = registry.unwrap_or(Registry::new(sess, krate.span));
time(time_passes, "plugin registration", || {
if sess.features.borrow().rustc_diagnostic_macros {
if sess.features_untracked().rustc_diagnostic_macros {
registry.register_macro("__diagnostic_used",
diagnostics::plugin::expand_diagnostic_used);
registry.register_macro("__register_diagnostic",
@ -749,7 +749,7 @@ pub fn phase_2_configure_and_expand_inner<'a, F>(sess: &'a Session,
crate_loader,
&resolver_arenas);
resolver.whitelisted_legacy_custom_derives = whitelisted_legacy_custom_derives;
syntax_ext::register_builtins(&mut resolver, syntax_exts, sess.features.borrow().quote);
syntax_ext::register_builtins(&mut resolver, syntax_exts, sess.features_untracked().quote);
krate = time(time_passes, "expansion", || {
// Windows dlls do not have rpaths, so they don't know how to find their
@ -780,7 +780,7 @@ pub fn phase_2_configure_and_expand_inner<'a, F>(sess: &'a Session,
.filter(|p| env::join_paths(iter::once(p)).is_ok()))
.unwrap());
}
let features = sess.features.borrow();
let features = sess.features_untracked();
let cfg = syntax::ext::expand::ExpansionConfig {
features: Some(&features),
recursion_limit: sess.recursion_limit.get(),
@ -819,7 +819,7 @@ pub fn phase_2_configure_and_expand_inner<'a, F>(sess: &'a Session,
sess.opts.test,
krate,
sess.diagnostic(),
&sess.features.borrow())
&sess.features_untracked())
});
// If we're actually rustdoc then there's no need to actually compile
@ -886,7 +886,7 @@ pub fn phase_2_configure_and_expand_inner<'a, F>(sess: &'a Session,
sess.track_errors(|| {
syntax::feature_gate::check_crate(&krate,
&sess.parse_sess,
&sess.features.borrow(),
&sess.features_untracked(),
&attributes,
sess.opts.unstable_features);
})