Query-ify global limit attribute handling

This commit is contained in:
Aaron Hill 2021-06-25 18:48:26 -05:00
parent 90442458ac
commit ff15b5e2c7
No known key found for this signature in database
GPG key ID: B4087E510E98B164
30 changed files with 153 additions and 91 deletions

View file

@ -211,10 +211,6 @@ pub fn register_plugins<'a>(
});
}
sess.time("recursion_limit", || {
middle::limits::update_limits(sess, &krate);
});
let mut lint_store = rustc_lint::new_lint_store(
sess.opts.debugging_opts.no_interleave_lints,
sess.unstable_options(),
@ -311,9 +307,11 @@ pub fn configure_and_expand(
// Create the config for macro expansion
let features = sess.features_untracked();
let recursion_limit =
rustc_middle::middle::limits::get_recursion_limit(&krate.attrs, &sess);
let cfg = rustc_expand::expand::ExpansionConfig {
features: Some(&features),
recursion_limit: sess.recursion_limit(),
recursion_limit,
trace_mac: sess.opts.debugging_opts.trace_macros,
should_test: sess.opts.test,
span_debug: sess.opts.debugging_opts.span_debug,
@ -872,6 +870,15 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
tcx.ensure().check_mod_unstable_api_usage(module);
tcx.ensure().check_mod_const_bodies(module);
});
},
{
// Mark the attributes as used, and ensure that
// they're not ill-formed. We force these queries
// to run, since they might not otherwise get called.
tcx.ensure().recursion_limit(());
tcx.ensure().move_size_limit(());
tcx.ensure().type_length_limit(());
tcx.ensure().const_eval_limit(());
}
);
});