about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2021-06-25 18:48:26 -0500
committerAaron Hill <aa1ronham@gmail.com>2021-07-04 12:33:14 -0500
commitff15b5e2c76bb5c0fdd64e49ee76fbd2023415bd (patch)
tree8ffd85d54373d3a3f22cd528d948ec7fde919b2f /compiler/rustc_interface/src
parent90442458ac46b1d5eed752c316da25450f67285b (diff)
downloadrust-ff15b5e2c76bb5c0fdd64e49ee76fbd2023415bd.tar.gz
rust-ff15b5e2c76bb5c0fdd64e49ee76fbd2023415bd.zip
Query-ify global limit attribute handling
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/passes.rs17
1 files changed, 12 insertions, 5 deletions
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(());
             }
         );
     });