Skip to content

Commit f5b62eb

Browse files
committed
Auto merge of #144508 - matthiaskrgr:rollup-osxaqi3, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #144359 (add codegen test for variadics) - #144409 (Stop compilation early if macro expansion failed) - #144422 (library/windows_targets: Fix macro expansion error in 'link' macro) - #144430 (tests: aarch64-outline-atomics: Remove hardcoded target) - #144445 (Fix `./x check bootstrap` (again)) - #144453 (canonicalize build root in `tests/run-make/linker-warning`) - #144454 (move uefi test to run-make) - #144464 (Only run bootstrap tests in `x test` on CI) - #144495 (bump cargo_metadata) - #144500 (thread name in stack overflow message) r? `@ghost` `@rustbot` modify labels: rollup
2 parents ce5fdd7 + da89cf5 commit f5b62eb

File tree

68 files changed

+655
-544
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+655
-544
lines changed

Cargo.lock

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -441,20 +441,6 @@ dependencies = [
441441
"thiserror 1.0.69",
442442
]
443443

444-
[[package]]
445-
name = "cargo_metadata"
446-
version = "0.19.2"
447-
source = "registry+https://github.com/rust-lang/crates.io-index"
448-
checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba"
449-
dependencies = [
450-
"camino",
451-
"cargo-platform 0.1.9",
452-
"semver",
453-
"serde",
454-
"serde_json",
455-
"thiserror 2.0.12",
456-
]
457-
458444
[[package]]
459445
name = "cargo_metadata"
460446
version = "0.21.0"
@@ -1364,7 +1350,7 @@ version = "0.1.0"
13641350
dependencies = [
13651351
"anyhow",
13661352
"askama",
1367-
"cargo_metadata 0.18.1",
1353+
"cargo_metadata 0.21.0",
13681354
"serde",
13691355
"serde_json",
13701356
"thiserror 1.0.69",
@@ -5370,7 +5356,7 @@ name = "tidy"
53705356
version = "0.1.0"
53715357
dependencies = [
53725358
"build_helper",
5373-
"cargo_metadata 0.19.2",
5359+
"cargo_metadata 0.21.0",
53745360
"fluent-syntax",
53755361
"ignore",
53765362
"miropt-test-tools",

compiler/rustc_expand/src/base.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,7 @@ pub struct ExtCtxt<'a> {
12241224
pub(super) expanded_inert_attrs: MarkedAttrs,
12251225
/// `-Zmacro-stats` data.
12261226
pub macro_stats: FxHashMap<(Symbol, MacroKind), MacroStat>,
1227+
pub nb_macro_errors: usize,
12271228
}
12281229

12291230
impl<'a> ExtCtxt<'a> {
@@ -1254,6 +1255,7 @@ impl<'a> ExtCtxt<'a> {
12541255
expanded_inert_attrs: MarkedAttrs::new(),
12551256
buffered_early_lint: vec![],
12561257
macro_stats: Default::default(),
1258+
nb_macro_errors: 0,
12571259
}
12581260
}
12591261

@@ -1315,6 +1317,12 @@ impl<'a> ExtCtxt<'a> {
13151317
self.current_expansion.id.expansion_cause()
13161318
}
13171319

1320+
/// This method increases the internal macro errors count and then call `trace_macros_diag`.
1321+
pub fn macro_error_and_trace_macros_diag(&mut self) {
1322+
self.nb_macro_errors += 1;
1323+
self.trace_macros_diag();
1324+
}
1325+
13181326
pub fn trace_macros_diag(&mut self) {
13191327
for (span, notes) in self.expansions.iter() {
13201328
let mut db = self.dcx().create_note(errors::TraceMacro { span: *span });

compiler/rustc_expand/src/expand.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
693693
crate_name: self.cx.ecfg.crate_name,
694694
});
695695

696-
self.cx.trace_macros_diag();
696+
self.cx.macro_error_and_trace_macros_diag();
697697
guar
698698
}
699699

@@ -707,7 +707,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
707707
) -> ErrorGuaranteed {
708708
let guar =
709709
self.cx.dcx().emit_err(WrongFragmentKind { span, kind: kind.name(), name: &mac.path });
710-
self.cx.trace_macros_diag();
710+
self.cx.macro_error_and_trace_macros_diag();
711711
guar
712712
}
713713

@@ -1048,7 +1048,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
10481048
}
10491049
annotate_err_with_kind(&mut err, kind, span);
10501050
let guar = err.emit();
1051-
self.cx.trace_macros_diag();
1051+
self.cx.macro_error_and_trace_macros_diag();
10521052
kind.dummy(span, guar)
10531053
}
10541054
}

compiler/rustc_expand/src/mbe/macro_parser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ enum EofMatcherPositions {
299299
}
300300

301301
/// Represents the possible results of an attempted parse.
302+
#[derive(Debug)]
302303
pub(crate) enum ParseResult<T, F> {
303304
/// Parsed successfully.
304305
Success(T),

compiler/rustc_expand/src/mbe/macro_rules.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ fn expand_macro<'cx>(
280280
// Retry and emit a better error.
281281
let (span, guar) =
282282
diagnostics::failed_to_match_macro(cx.psess(), sp, def_span, name, arg, rules);
283-
cx.trace_macros_diag();
283+
cx.macro_error_and_trace_macros_diag();
284284
DummyResult::any(span, guar)
285285
}
286286
}

compiler/rustc_interface/src/passes.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ fn configure_and_expand(
208208
// Expand macros now!
209209
let krate = sess.time("expand_crate", || ecx.monotonic_expander().expand_crate(krate));
210210

211+
if ecx.nb_macro_errors > 0 {
212+
sess.dcx().abort_if_errors();
213+
}
214+
211215
// The rest is error reporting and stats
212216

213217
sess.psess.buffered_lints.with_lock(|buffered_lints: &mut Vec<BufferedEarlyLint>| {

library/std/src/sys/pal/hermit/thread.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ impl Thread {
5858
}
5959
}
6060

61-
pub unsafe fn new(stack: usize, p: Box<dyn FnOnce()>) -> io::Result<Thread> {
61+
pub unsafe fn new(
62+
stack: usize,
63+
_name: Option<&str>,
64+
p: Box<dyn FnOnce()>,
65+
) -> io::Result<Thread> {
6266
unsafe {
6367
Thread::new_with_coreid(stack, p, -1 /* = no specific core */)
6468
}

library/std/src/sys/pal/itron/thread.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ impl Thread {
8686
/// # Safety
8787
///
8888
/// See `thread::Builder::spawn_unchecked` for safety requirements.
89-
pub unsafe fn new(stack: usize, p: Box<dyn FnOnce()>) -> io::Result<Thread> {
89+
pub unsafe fn new(
90+
stack: usize,
91+
_name: Option<&str>,
92+
p: Box<dyn FnOnce()>,
93+
) -> io::Result<Thread> {
9094
let inner = Box::new(ThreadInner {
9195
start: UnsafeCell::new(ManuallyDrop::new(p)),
9296
lifecycle: AtomicUsize::new(LIFECYCLE_INIT),

library/std/src/sys/pal/sgx/thread.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ pub mod wait_notify {
9696

9797
impl Thread {
9898
// unsafe: see thread::Builder::spawn_unchecked for safety requirements
99-
pub unsafe fn new(_stack: usize, p: Box<dyn FnOnce() + Send>) -> io::Result<Thread> {
99+
pub unsafe fn new(
100+
_stack: usize,
101+
_name: Option<&str>,
102+
p: Box<dyn FnOnce() + Send>,
103+
) -> io::Result<Thread> {
100104
let mut queue_lock = task_queue::lock();
101105
unsafe { usercalls::launch_thread()? };
102106
let (task, handle) = task_queue::Task::new(p);

library/std/src/sys/pal/teeos/thread.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ unsafe extern "C" {
2222

2323
impl Thread {
2424
// unsafe: see thread::Builder::spawn_unchecked for safety requirements
25-
pub unsafe fn new(stack: usize, p: Box<dyn FnOnce()>) -> io::Result<Thread> {
25+
pub unsafe fn new(
26+
stack: usize,
27+
_name: Option<&str>,
28+
p: Box<dyn FnOnce()>,
29+
) -> io::Result<Thread> {
2630
let p = Box::into_raw(Box::new(p));
2731
let mut native: libc::pthread_t = unsafe { mem::zeroed() };
2832
let mut attr: libc::pthread_attr_t = unsafe { mem::zeroed() };

0 commit comments

Comments
 (0)