about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-05-21 23:02:09 +0000
committerbors <bors@rust-lang.org>2025-05-21 23:02:09 +0000
commit5df0f729f5355cb3cd91f6bcff13566ae96dc220 (patch)
tree1b67841838303e09ae730dc53bf567559e098f83 /compiler/rustc_interface/src
parentbf64d66bd58719fac2585eae5e546e5e1d9947f5 (diff)
parentde4055f3f1383b05a756f76419dd77cda30903bc (diff)
downloadrust-5df0f729f5355cb3cd91f6bcff13566ae96dc220.tar.gz
rust-5df0f729f5355cb3cd91f6bcff13566ae96dc220.zip
Auto merge of #141366 - matthiaskrgr:rollup-utvtyy3, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #140526 (docs: Specify that common sort functions sort in an ascending direction)
 - #141230 (std: fix doctest and explain for `as_slices` and `as_mut_slices` in `VecDeque`)
 - #141341 (limit impls of `VaArgSafe` to just types that are actually safe)
 - #141347 (incorrectly prefer builtin `dyn` impls :3)
 - #141351 (Move -Zcrate-attr injection to just after crate root parsing)
 - #141356 (lower bodies' params to thir before the body's value)
 - #141357 (`unpretty=thir-tree`: don't require the final expr to be the body's value)
 - #141363 (Document why we allow escaping bound vars in LTA norm)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/passes.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index 8f6c5b47ee2..75d92ae7a2e 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -45,7 +45,7 @@ use crate::interface::Compiler;
 use crate::{errors, limits, proc_macro_decls, util};
 
 pub fn parse<'a>(sess: &'a Session) -> ast::Crate {
-    let krate = sess
+    let mut krate = sess
         .time("parse_crate", || {
             let mut parser = unwrap_or_emit_fatal(match &sess.io.input {
                 Input::File(file) => new_parser_from_file(&sess.psess, file, None),
@@ -64,6 +64,12 @@ pub fn parse<'a>(sess: &'a Session) -> ast::Crate {
         input_stats::print_ast_stats(&krate, "PRE EXPANSION AST STATS", "ast-stats-1");
     }
 
+    rustc_builtin_macros::cmdline_attrs::inject(
+        &mut krate,
+        &sess.psess,
+        &sess.opts.unstable_opts.crate_attr,
+    );
+
     krate
 }
 
@@ -805,17 +811,11 @@ pub static DEFAULT_QUERY_PROVIDERS: LazyLock<Providers> = LazyLock::new(|| {
 
 pub fn create_and_enter_global_ctxt<T, F: for<'tcx> FnOnce(TyCtxt<'tcx>) -> T>(
     compiler: &Compiler,
-    mut krate: rustc_ast::Crate,
+    krate: rustc_ast::Crate,
     f: F,
 ) -> T {
     let sess = &compiler.sess;
 
-    rustc_builtin_macros::cmdline_attrs::inject(
-        &mut krate,
-        &sess.psess,
-        &sess.opts.unstable_opts.crate_attr,
-    );
-
     let pre_configured_attrs = rustc_expand::config::pre_configure_attrs(sess, &krate.attrs);
 
     let crate_name = get_crate_name(sess, &pre_configured_attrs);