Skip to content

Commit 188e30b

Browse files
committed
Auto merge of #144450 - GuillaumeGomez:rollup-zffdbtc, r=GuillaumeGomez
Rollup of 13 pull requests Successful merges: - #144356 (Add `ignore-backends` annotations in failing GCC backend ui tests) - #144359 (add codegen test for variadics) - #144376 (Suggest unwrapping when private method name is available in inner type) - #144379 (test using multiple c-variadic ABIs in the same program) - #144383 (disable cfg.has_reliable_f128 on amdgcn) - #144409 (Stop compilation early if macro expansion failed) - #144412 (Small cleanup: Use LocalKey<Cell> methods more) - #144421 (Call `is_parsed_attribute` rather than keeping track of a list of parsed attributes manually) - #144422 (library/windows_targets: Fix macro expansion error in 'link' macro) - #144424 (Allow setting `release-blog-post` label with rustbot) - #144430 (tests: aarch64-outline-atomics: Remove hardcoded target) - #144435 (rustc-dev-guide subtree update) - #144445 (Fix `./x check bootstrap` (again)) r? `@ghost` `@rustbot` modify labels: rollup
2 parents a955f1c + a3ab44f commit 188e30b

File tree

149 files changed

+769
-455
lines changed

Some content is hidden

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

149 files changed

+769
-455
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4255,6 +4255,7 @@ dependencies = [
42554255
"rustc-literal-escaper",
42564256
"rustc_ast",
42574257
"rustc_ast_pretty",
4258+
"rustc_attr_parsing",
42584259
"rustc_data_structures",
42594260
"rustc_errors",
42604261
"rustc_feature",

compiler/rustc_codegen_llvm/src/llvm_util.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,8 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
405405
("mips64" | "mips64r6", _) => false,
406406
// Selection bug <https://github.com/llvm/llvm-project/issues/95471>
407407
("nvptx64", _) => false,
408+
// Unsupported https://github.com/llvm/llvm-project/issues/121122
409+
("amdgpu", _) => false,
408410
// ABI bugs <https://github.com/rust-lang/rust/issues/125109> et al. (full
409411
// list at <https://github.com/rust-lang/rust/issues/116909>)
410412
("powerpc" | "powerpc64", _) => false,

compiler/rustc_errors/src/markdown/term.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ thread_local! {
1818
pub(crate) fn entrypoint(stream: &MdStream<'_>, buf: &mut Buffer) -> io::Result<()> {
1919
#[cfg(not(test))]
2020
if let Some((w, _)) = termize::dimensions() {
21-
WIDTH.with(|c| c.set(std::cmp::min(w, DEFAULT_COLUMN_WIDTH)));
21+
WIDTH.set(std::cmp::min(w, DEFAULT_COLUMN_WIDTH));
2222
}
2323
write_stream(stream, buf, None, 0)?;
2424
buf.write_all(b"\n")
@@ -84,7 +84,7 @@ fn write_tt(tt: &MdTree<'_>, buf: &mut Buffer, indent: usize) -> io::Result<()>
8484
reset_cursor();
8585
}
8686
MdTree::HorizontalRule => {
87-
(0..WIDTH.with(Cell::get)).for_each(|_| buf.write_all(b"-").unwrap());
87+
(0..WIDTH.get()).for_each(|_| buf.write_all(b"-").unwrap());
8888
reset_cursor();
8989
}
9090
MdTree::Heading(n, stream) => {
@@ -121,7 +121,7 @@ fn write_tt(tt: &MdTree<'_>, buf: &mut Buffer, indent: usize) -> io::Result<()>
121121

122122
/// End of that block, just wrap the line
123123
fn reset_cursor() {
124-
CURSOR.with(|cur| cur.set(0));
124+
CURSOR.set(0);
125125
}
126126

127127
/// Change to be generic on Write for testing. If we have a link URL, we don't
@@ -144,7 +144,7 @@ fn write_wrapping<B: io::Write>(
144144
buf.write_all(ind_ws)?;
145145
cur.set(indent);
146146
}
147-
let ch_count = WIDTH.with(Cell::get) - cur.get();
147+
let ch_count = WIDTH.get() - cur.get();
148148
let mut iter = to_write.char_indices();
149149
let Some((end_idx, _ch)) = iter.nth(ch_count) else {
150150
// Write entire line

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_hir_typeck/src/method/suggest.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
264264
err.span_label(within_macro_span, "due to this macro variable");
265265
}
266266
self.suggest_valid_traits(&mut err, item_name, out_of_scope_traits, true);
267+
self.suggest_unwrapping_inner_self(&mut err, source, rcvr_ty, item_name);
267268
err.emit()
268269
}
269270

compiler/rustc_interface/src/passes.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,15 @@ fn configure_and_expand(
206206
let mut ecx = ExtCtxt::new(sess, cfg, resolver, Some(&lint_store));
207207
ecx.num_standard_library_imports = num_standard_library_imports;
208208
// Expand macros now!
209-
let krate = sess.time("expand_crate", || ecx.monotonic_expander().expand_crate(krate));
209+
let (krate, nb_macro_errors) = sess.time("expand_crate", || {
210+
let mut expander = ecx.monotonic_expander();
211+
let krate = expander.expand_crate(krate);
212+
(krate, ecx.nb_macro_errors)
213+
});
214+
215+
if nb_macro_errors > 0 {
216+
sess.dcx().abort_if_errors();
217+
}
210218

211219
// The rest is error reporting and stats
212220

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ macro_rules! define_helper {
8686

8787
impl $helper {
8888
pub fn new() -> $helper {
89-
$helper($tl.with(|c| c.replace(true)))
89+
$helper($tl.replace(true))
9090
}
9191
}
9292

@@ -100,12 +100,12 @@ macro_rules! define_helper {
100100

101101
impl Drop for $helper {
102102
fn drop(&mut self) {
103-
$tl.with(|c| c.set(self.0))
103+
$tl.set(self.0)
104104
}
105105
}
106106

107107
pub fn $name() -> bool {
108-
$tl.with(|c| c.get())
108+
$tl.get()
109109
}
110110
)+
111111
}

0 commit comments

Comments
 (0)