Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9322d18

Browse files
committedOct 14, 2024
Auto merge of rust-lang#131690 - matthiaskrgr:rollup-mcau4ol, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang#129424 (Stabilize `Pin::as_deref_mut()`) - rust-lang#131332 (Fix clobber_abi and disallow SVE-related registers in Arm64EC inline assembly) - rust-lang#131384 (Update precondition tests (especially for zero-size access to null)) - rust-lang#131430 (Special treatment empty tuple when suggest adding a string literal in format macro.) - rust-lang#131550 (Make some tweaks to extern block diagnostics) - rust-lang#131667 (Fix AArch64InlineAsmReg::emit) - rust-lang#131679 (compiletest: Document various parts of compiletest's `lib.rs`) - rust-lang#131682 (Tag PRs affecting compiletest with `A-compiletest`) Failed merges: - rust-lang#131496 (Stabilise `const_make_ascii`.) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 17a19e6 + ac9b212 commit 9322d18

File tree

69 files changed

+977
-200
lines changed

Some content is hidden

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

69 files changed

+977
-200
lines changed
 

‎compiler/rustc_ast_passes/messages.ftl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ ast_passes_equality_in_where = equality constraints are not yet supported in `wh
6262
6363
ast_passes_extern_block_suggestion = if you meant to declare an externally defined function, use an `extern` block
6464
65-
ast_passes_extern_fn_qualifiers = functions in `extern` blocks cannot have qualifiers
65+
ast_passes_extern_fn_qualifiers = functions in `extern` blocks cannot have `{$kw}` qualifier
6666
.label = in this `extern` block
67-
.suggestion = remove this qualifier
67+
.suggestion = remove the `{$kw}` qualifier
6868
69-
ast_passes_extern_invalid_safety = items in unadorned `extern` blocks cannot have safety qualifiers
70-
.suggestion = add unsafe to this `extern` block
69+
ast_passes_extern_invalid_safety = items in `extern` blocks without an `unsafe` qualifier cannot have safety qualifiers
70+
.suggestion = add `unsafe` to this `extern` block
7171
7272
ast_passes_extern_item_ascii = items in `extern` blocks cannot use non-ascii identifiers
7373
.label = in this `extern` block

‎compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -524,21 +524,24 @@ impl<'a> AstValidator<'a> {
524524
// Deconstruct to ensure exhaustiveness
525525
FnHeader { safety: _, coroutine_kind, constness, ext }: FnHeader,
526526
) {
527-
let report_err = |span| {
528-
self.dcx()
529-
.emit_err(errors::FnQualifierInExtern { span, block: self.current_extern_span() });
527+
let report_err = |span, kw| {
528+
self.dcx().emit_err(errors::FnQualifierInExtern {
529+
span,
530+
kw,
531+
block: self.current_extern_span(),
532+
});
530533
};
531534
match coroutine_kind {
532-
Some(knd) => report_err(knd.span()),
535+
Some(kind) => report_err(kind.span(), kind.as_str()),
533536
None => (),
534537
}
535538
match constness {
536-
Const::Yes(span) => report_err(span),
539+
Const::Yes(span) => report_err(span, "const"),
537540
Const::No => (),
538541
}
539542
match ext {
540543
Extern::None => (),
541-
Extern::Implicit(span) | Extern::Explicit(_, span) => report_err(span),
544+
Extern::Implicit(span) | Extern::Explicit(_, span) => report_err(span, "extern"),
542545
}
543546
}
544547

0 commit comments

Comments
 (0)
Please sign in to comment.