about summary refs log tree commit diff
path: root/compiler/rustc_driver_impl/src/lib.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-06-05 11:32:18 +0000
committerbors <bors@rust-lang.org>2024-06-05 11:32:18 +0000
commitdb8aca48129d86b2623e3ac8cbcf2902d4d313ad (patch)
tree637294c8b1a43817f408a70a5da24d9b64d672a4 /compiler/rustc_driver_impl/src/lib.rs
parent5ee2dfd2bcbb66a69a46aaa342204e0dfdb70516 (diff)
parentf12fe3a33e5e94f1f49cd6d4a785d1cf7a0a02b9 (diff)
downloadrust-db8aca48129d86b2623e3ac8cbcf2902d4d313ad.tar.gz
rust-db8aca48129d86b2623e3ac8cbcf2902d4d313ad.zip
Auto merge of #126016 - workingjubilee:rollup-nh6ehbz, r=workingjubilee
Rollup of 12 pull requests

Successful merges:

 - #123168 (Add `size_of` and `size_of_val` and `align_of` and `align_of_val` to the prelude)
 - #125273 (bootstrap: implement new feature `bootstrap-self-test`)
 - #125683 (Rewrite `suspicious-library`, `resolve-rename` and `incr-prev-body-beyond-eof` `run-make` tests in `rmake.rs` format)
 - #125815 (`rustc_parse` top-level cleanups)
 - #125903 (rustc_span: Inline some hot functions)
 - #125906 (Remove a bunch of redundant args from `report_method_error`)
 - #125920 (Allow static mut definitions with #[linkage])
 - #125982 (Make deleting on LinkedList aware of the allocator)
 - #125995 (Use inline const blocks to create arrays of `MaybeUninit`.)
 - #125996 (Closures are recursively reachable)
 - #126003 (Add a co-maintainer for the two ARMv4T targets)
 - #126004 (Add another test for hidden types capturing lifetimes that outlive but arent mentioned in substs)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_driver_impl/src/lib.rs')
-rw-r--r--compiler/rustc_driver_impl/src/lib.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs
index 627fd74c8d7..93a65290602 100644
--- a/compiler/rustc_driver_impl/src/lib.rs
+++ b/compiler/rustc_driver_impl/src/lib.rs
@@ -32,6 +32,7 @@ use rustc_interface::{interface, Queries};
 use rustc_lint::unerased_lint_store;
 use rustc_metadata::creader::MetadataLoader;
 use rustc_metadata::locator;
+use rustc_parse::{new_parser_from_file, new_parser_from_source_str, unwrap_or_emit_fatal};
 use rustc_session::config::{nightly_options, CG_OPTIONS, Z_OPTIONS};
 use rustc_session::config::{ErrorOutputType, Input, OutFileName, OutputType};
 use rustc_session::getopts::{self, Matches};
@@ -1264,12 +1265,13 @@ pub fn handle_options(early_dcx: &EarlyDiagCtxt, args: &[String]) -> Option<geto
 }
 
 fn parse_crate_attrs<'a>(sess: &'a Session) -> PResult<'a, ast::AttrVec> {
-    match &sess.io.input {
-        Input::File(ifile) => rustc_parse::parse_crate_attrs_from_file(ifile, &sess.psess),
+    let mut parser = unwrap_or_emit_fatal(match &sess.io.input {
+        Input::File(file) => new_parser_from_file(&sess.psess, file, None),
         Input::Str { name, input } => {
-            rustc_parse::parse_crate_attrs_from_source_str(name.clone(), input.clone(), &sess.psess)
+            new_parser_from_source_str(&sess.psess, name.clone(), input.clone())
         }
-    }
+    });
+    parser.parse_inner_attributes()
 }
 
 /// Runs a closure and catches unwinds triggered by fatal errors.