From ff15b5e2c76bb5c0fdd64e49ee76fbd2023415bd Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Fri, 25 Jun 2021 18:48:26 -0500 Subject: Query-ify global limit attribute handling --- compiler/rustc_interface/src/passes.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'compiler/rustc_interface') diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index c0f7ea8df49..a5d97ef4111 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -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(()); } ); }); -- cgit 1.4.1-3-g733a5