Skip to content

Commit f3d71c9

Browse files
committedJan 30, 2024
Auto merge of #120496 - GuillaumeGomez:rollup-fmu9jre, r=GuillaumeGomez
Rollup of 11 pull requests Successful merges: - #117906 (Improve display of crate name when hovered) - #118533 (Suppress unhelpful diagnostics for unresolved top level attributes) - #120293 (Deduplicate more sized errors on call exprs) - #120295 (Remove `raw_os_nonzero` feature.) - #120310 (adapt test for v0 symbol mangling) - #120342 (Remove various `has_errors` or `err_count` uses) - #120434 (Revert outdated version of "Add the wasm32-wasi-preview2 target") - #120445 (Fix some `Arc` allocator leaks) - #120475 (Improve error message when `cargo build` is used to build the compiler) - #120476 (Remove some unnecessary check logic for lang items in HIR typeck) - #120485 (add missing potential_query_instability for keys and values in hashmap) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5ad7454 + 27bc496 commit f3d71c9

File tree

190 files changed

+885
-1603
lines changed

Some content is hidden

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

190 files changed

+885
-1603
lines changed
 

‎compiler/rustc_builtin_macros/src/format.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,15 @@ fn parse_args<'a>(ecx: &mut ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<
139139
_ => {
140140
let expr = p.parse_expr()?;
141141
if !args.named_args().is_empty() {
142-
ecx.dcx().emit_err(errors::PositionalAfterNamed {
142+
return Err(ecx.dcx().create_err(errors::PositionalAfterNamed {
143143
span: expr.span,
144144
args: args
145145
.named_args()
146146
.iter()
147147
.filter_map(|a| a.kind.ident().map(|ident| (a, ident)))
148148
.map(|(arg, n)| n.span.to(arg.expr.span))
149149
.collect(),
150-
});
150+
}));
151151
}
152152
args.add(FormatArgument { kind: FormatArgumentKind::Normal, expr });
153153
}
@@ -313,6 +313,8 @@ fn make_format_args(
313313
}
314314
use ArgRef::*;
315315

316+
let mut unnamed_arg_after_named_arg = false;
317+
316318
let mut lookup_arg = |arg: ArgRef<'_>,
317319
span: Option<Span>,
318320
used_as: PositionUsedAs,
@@ -352,6 +354,7 @@ fn make_format_args(
352354
// For the moment capturing variables from format strings expanded from macros is
353355
// disabled (see RFC #2795)
354356
ecx.dcx().emit_err(errors::FormatNoArgNamed { span, name });
357+
unnamed_arg_after_named_arg = true;
355358
DummyResult::raw_expr(span, true)
356359
};
357360
Ok(args.add(FormatArgument { kind: FormatArgumentKind::Captured(ident), expr }))
@@ -510,7 +513,8 @@ fn make_format_args(
510513
})
511514
.collect::<Vec<_>>();
512515

513-
if !unused.is_empty() {
516+
let has_unused = !unused.is_empty();
517+
if has_unused {
514518
// If there's a lot of unused arguments,
515519
// let's check if this format arguments looks like another syntax (printf / shell).
516520
let detect_foreign_fmt = unused.len() > args.explicit_args().len() / 2;
@@ -529,7 +533,7 @@ fn make_format_args(
529533

530534
// Only check for unused named argument names if there are no other errors to avoid causing
531535
// too much noise in output errors, such as when a named argument is entirely unused.
532-
if invalid_refs.is_empty() && ecx.dcx().has_errors().is_none() {
536+
if invalid_refs.is_empty() && !has_unused && !unnamed_arg_after_named_arg {
533537
for &(index, span, used_as) in &numeric_refences_to_named_arg {
534538
let (position_sp_to_replace, position_sp_for_msg) = match used_as {
535539
Placeholder(pspan) => (span, pspan),

‎compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ fn codegenned_and_inlined_items(tcx: TyCtxt<'_>) -> DefIdSet {
403403
let mut result = items.clone();
404404

405405
for cgu in cgus {
406+
#[allow(rustc::potential_query_instability)]
406407
for item in cgu.items().keys() {
407408
if let mir::mono::MonoItem::Fn(ref instance) = item {
408409
let did = instance.def_id();

0 commit comments

Comments
 (0)
Please sign in to comment.