From 13bf958b7fceddbb0d4357fa106f58afd2625a85 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 18 Jul 2022 10:33:26 +1000 Subject: [PATCH 1/9] Fix debuginfo tests. This is needed for my Ubuntu 22.04 box due to a slight change in gdb output. The fix is similar to the fix in #95063. --- src/test/debuginfo/basic-types-globals-lto.rs | 2 +- src/test/debuginfo/basic-types-globals.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/debuginfo/basic-types-globals-lto.rs b/src/test/debuginfo/basic-types-globals-lto.rs index 555d51ced7118..1adf278ad32de 100644 --- a/src/test/debuginfo/basic-types-globals-lto.rs +++ b/src/test/debuginfo/basic-types-globals-lto.rs @@ -14,7 +14,7 @@ // gdbr-command:print I // gdb-check:$2 = -1 // gdbg-command:print 'basic_types_globals::C' -// gdbr-command:print C +// gdbr-command:print/d C // gdbg-check:$3 = 97 // gdbr-check:$3 = 97 // gdbg-command:print/d 'basic_types_globals::I8' diff --git a/src/test/debuginfo/basic-types-globals.rs b/src/test/debuginfo/basic-types-globals.rs index a6d8c15bcdcf0..3602db39a4ec1 100644 --- a/src/test/debuginfo/basic-types-globals.rs +++ b/src/test/debuginfo/basic-types-globals.rs @@ -13,7 +13,7 @@ // gdbr-command:print I // gdb-check:$2 = -1 // gdbg-command:print 'basic_types_globals::C' -// gdbr-command:print C +// gdbr-command:print/d C // gdbg-check:$3 = 97 // gdbr-check:$3 = 97 // gdbg-command:print/d 'basic_types_globals::I8' From c1c1abc08ab5ae90da2e51ad02246631207113e1 Mon Sep 17 00:00:00 2001 From: David Herberth Date: Sat, 16 Jul 2022 17:40:43 +0200 Subject: [PATCH 2/9] Use split_once in FromStr docs --- library/core/src/str/traits.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/library/core/src/str/traits.rs b/library/core/src/str/traits.rs index 32c31803a5115..e9649fc91fa09 100644 --- a/library/core/src/str/traits.rs +++ b/library/core/src/str/traits.rs @@ -519,12 +519,14 @@ unsafe impl const SliceIndex for ops::RangeToInclusive { /// type Err = ParseIntError; /// /// fn from_str(s: &str) -> Result { -/// let coords: Vec<&str> = s.trim_matches(|p| p == '(' || p == ')' ) -/// .split(',') -/// .collect(); -/// -/// let x_fromstr = coords[0].parse::()?; -/// let y_fromstr = coords[1].parse::()?; +/// let (x, y) = s +/// .strip_prefix('(') +/// .and_then(|s| s.strip_suffix(')')) +/// .and_then(|s| s.split_once(',')) +/// .unwrap(); +/// +/// let x_fromstr = x.parse::()?; +/// let y_fromstr = y.parse::()?; /// /// Ok(Point { x: x_fromstr, y: y_fromstr }) /// } From 38f090b5e9bdf765eaeab80d5feaa1cd28021a3c Mon Sep 17 00:00:00 2001 From: Jordan McQueen Date: Mon, 18 Jul 2022 16:24:08 +0900 Subject: [PATCH 3/9] Use span_bug for unexpected field projection type Improves the compiler error backtrace information, as shown in #99363, by using `span_bug` instead of `bug`. New output: ``` build/aarch64-apple-darwin/stage1/bin/rustc /tmp/test.rs --edition=2021 error: internal compiler error: compiler/rustc_middle/src/ty/closure.rs:185:25: Unexpected type Opaque(DefId(0:5 ~ test[db0f]::main::T::{opaque#0}), []) for `Field` projection --> /tmp/test.rs:11:27 | 11 | let Foo((a, b)) = foo; | ^^^ thread 'rustc' panicked at 'Box', /Users/jmq/src/forked/rust/compiler/rustc_errors/src/lib.rs:1331:9 stack backtrace: ``` (Remainder of output truncated.) --- compiler/rustc_middle/src/ty/closure.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_middle/src/ty/closure.rs b/compiler/rustc_middle/src/ty/closure.rs index 8ead05122740e..27b9d27b8bb11 100644 --- a/compiler/rustc_middle/src/ty/closure.rs +++ b/compiler/rustc_middle/src/ty/closure.rs @@ -182,7 +182,11 @@ impl<'tcx> CapturedPlace<'tcx> { .unwrap(); } ty => { - bug!("Unexpected type {:?} for `Field` projection", ty) + span_bug!( + self.get_capture_kind_span(tcx), + "Unexpected type {:?} for `Field` projection", + ty + ) } }, From 45afc214af3ad47be4252b82832a78e6280f3708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Mon, 18 Jul 2022 00:00:00 +0000 Subject: [PATCH 4/9] Update invalid atomic ordering lint The restriction that success ordering must be at least as strong as its failure ordering in compare-exchange operations was lifted in #98383. --- .../locales/en-US/lint.ftl | 5 -- compiler/rustc_lint/src/types.rs | 41 +--------- ...t-invalid-atomic-ordering-exchange-weak.rs | 28 ++----- ...valid-atomic-ordering-exchange-weak.stderr | 76 +++---------------- .../lint-invalid-atomic-ordering-exchange.rs | 28 ++----- ...nt-invalid-atomic-ordering-exchange.stderr | 76 +++---------------- ...nt-invalid-atomic-ordering-fetch-update.rs | 27 ++----- ...nvalid-atomic-ordering-fetch-update.stderr | 76 +++---------------- 8 files changed, 60 insertions(+), 297 deletions(-) diff --git a/compiler/rustc_error_messages/locales/en-US/lint.ftl b/compiler/rustc_error_messages/locales/en-US/lint.ftl index e7e07093c0324..55e96e58e4688 100644 --- a/compiler/rustc_error_messages/locales/en-US/lint.ftl +++ b/compiler/rustc_error_messages/locales/en-US/lint.ftl @@ -247,11 +247,6 @@ lint-atomic-ordering-invalid = `{$method}`'s failure ordering may not be `Releas .label = invalid failure ordering .help = consider using `Acquire` or `Relaxed` failure ordering instead -lint-atomic-ordering-invalid-fail-success = `{$method}`'s success ordering must be at least as strong as its failure ordering - .fail-label = `{$fail_ordering}` failure ordering - .success-label = `{$success_ordering}` success ordering - .suggestion = consider using `{$success_suggestion}` success ordering instead - lint-unused-op = unused {$op} that must be used .label = the {$op} produces a value .suggestion = use `let _ = ...` to ignore the resulting value diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index aca481df2e113..5c07afeb7aa8f 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -1434,10 +1434,6 @@ declare_lint! { /// - Passing `Ordering::Release` or `Ordering::AcqRel` as the failure /// ordering for any of `AtomicType::compare_exchange`, /// `AtomicType::compare_exchange_weak`, or `AtomicType::fetch_update`. - /// - /// - Passing in a pair of orderings to `AtomicType::compare_exchange`, - /// `AtomicType::compare_exchange_weak`, or `AtomicType::fetch_update` - /// where the failure ordering is stronger than the success ordering. INVALID_ATOMIC_ORDERING, Deny, "usage of invalid atomic ordering in atomic operations and memory fences" @@ -1544,9 +1540,9 @@ impl InvalidAtomicOrdering { let Some((method, args)) = Self::inherent_atomic_method_call(cx, expr, &[sym::fetch_update, sym::compare_exchange, sym::compare_exchange_weak]) else {return }; - let (success_order_arg, fail_order_arg) = match method { - sym::fetch_update => (&args[1], &args[2]), - sym::compare_exchange | sym::compare_exchange_weak => (&args[3], &args[4]), + let fail_order_arg = match method { + sym::fetch_update => &args[2], + sym::compare_exchange | sym::compare_exchange_weak => &args[4], _ => return, }; @@ -1568,37 +1564,6 @@ impl InvalidAtomicOrdering { InvalidAtomicOrderingDiag { method, fail_order_arg_span: fail_order_arg.span }, ); } - - let Some(success_ordering) = Self::match_ordering(cx, success_order_arg) else { return }; - - if matches!( - (success_ordering, fail_ordering), - (sym::Relaxed | sym::Release, sym::Acquire) - | (sym::Relaxed | sym::Release | sym::Acquire | sym::AcqRel, sym::SeqCst) - ) { - let success_suggestion = - if success_ordering == sym::Release && fail_ordering == sym::Acquire { - sym::AcqRel - } else { - fail_ordering - }; - cx.struct_span_lint(INVALID_ATOMIC_ORDERING, success_order_arg.span, |diag| { - diag.build(fluent::lint::atomic_ordering_invalid_fail_success) - .set_arg("method", method) - .set_arg("fail_ordering", fail_ordering) - .set_arg("success_ordering", success_ordering) - .set_arg("success_suggestion", success_suggestion) - .span_label(fail_order_arg.span, fluent::lint::fail_label) - .span_label(success_order_arg.span, fluent::lint::success_label) - .span_suggestion_short( - success_order_arg.span, - fluent::lint::suggestion, - format!("std::sync::atomic::Ordering::{success_suggestion}"), - Applicability::MaybeIncorrect, - ) - .emit(); - }); - } } } diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs index 0e0d604ae046d..63204c725c3dc 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.rs @@ -9,11 +9,17 @@ fn main() { // Allowed ordering combos let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Relaxed); - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Acquire, Ordering::Acquire); + let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Acquire); + let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::SeqCst); let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Acquire, Ordering::Relaxed); + let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Acquire, Ordering::Acquire); + let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::SeqCst); let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Release, Ordering::Relaxed); - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::AcqRel, Ordering::Acquire); + let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::Acquire); + let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::SeqCst); let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::AcqRel, Ordering::Relaxed); + let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::AcqRel, Ordering::Acquire); + let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::SeqCst); let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::SeqCst, Ordering::Relaxed); let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::SeqCst, Ordering::Acquire); let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::SeqCst, Ordering::SeqCst); @@ -41,22 +47,4 @@ fn main() { //~^ ERROR `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::SeqCst, Ordering::Release); //~^ ERROR `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel` - - // Release success order forbids failure order of Acquire or SeqCst - let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::Acquire); - //~^ ERROR `compare_exchange_weak`'s success ordering must be at least as strong as - let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::SeqCst); - //~^ ERROR `compare_exchange_weak`'s success ordering must be at least as strong as - - // Relaxed success order also forbids failure order of Acquire or SeqCst - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::SeqCst); - //~^ ERROR `compare_exchange_weak`'s success ordering must be at least as strong as - let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Acquire); - //~^ ERROR `compare_exchange_weak`'s success ordering must be at least as strong as - - // Acquire/AcqRel forbids failure order of SeqCst - let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::SeqCst); - //~^ ERROR `compare_exchange_weak`'s success ordering must be at least as strong as - let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::SeqCst); - //~^ ERROR `compare_exchange_weak`'s success ordering must be at least as strong as } diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr index d5e53418b6fb8..021654cf35eed 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr @@ -1,5 +1,5 @@ error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:22:67 + --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:28:67 | LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Relaxed, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -8,7 +8,7 @@ LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Relaxed, Ordering: = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:24:67 + --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:30:67 | LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -16,7 +16,7 @@ LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering: = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:26:67 + --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:32:67 | LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -24,7 +24,7 @@ LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering: = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:28:66 + --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:34:66 | LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -32,7 +32,7 @@ LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering:: = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:30:66 + --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:36:66 | LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::SeqCst, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -40,7 +40,7 @@ LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::SeqCst, Ordering:: = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:34:67 + --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:40:67 | LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Release); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -48,7 +48,7 @@ LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering: = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:36:67 + --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:42:67 | LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Acquire, Ordering::Release); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -56,7 +56,7 @@ LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Acquire, Ordering: = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:38:67 + --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:44:67 | LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Release, Ordering::Release); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -64,7 +64,7 @@ LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Release, Ordering: = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:40:66 + --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:46:66 | LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::AcqRel, Ordering::Release); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -72,66 +72,12 @@ LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::AcqRel, Ordering:: = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:42:66 + --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:48:66 | LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::SeqCst, Ordering::Release); | ^^^^^^^^^^^^^^^^^ invalid failure ordering | = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: `compare_exchange_weak`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:46:48 - | -LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering - | | - | `Release` success ordering - | help: consider using `AcqRel` success ordering instead - -error: `compare_exchange_weak`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:48:48 - | -LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Release, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering - | | - | `Release` success ordering - | help: consider using `SeqCst` success ordering instead - -error: `compare_exchange_weak`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:52:48 - | -LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering - | | - | `Relaxed` success ordering - | help: consider using `SeqCst` success ordering instead - -error: `compare_exchange_weak`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:54:48 - | -LL | let _ = x.compare_exchange_weak(ptr, ptr2, Ordering::Relaxed, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering - | | - | `Relaxed` success ordering - | help: consider using `Acquire` success ordering instead - -error: `compare_exchange_weak`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:58:48 - | -LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Acquire, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering - | | - | `Acquire` success ordering - | help: consider using `SeqCst` success ordering instead - -error: `compare_exchange_weak`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:60:48 - | -LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::AcqRel, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering - | | - | `AcqRel` success ordering - | help: consider using `SeqCst` success ordering instead - -error: aborting due to 16 previous errors +error: aborting due to 10 previous errors diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs index da98d854262a5..488d268eee810 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.rs @@ -7,11 +7,17 @@ fn main() { // Allowed ordering combos let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Relaxed); - let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::Acquire); + let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Acquire); + let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::SeqCst); let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::Relaxed); + let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::Acquire); + let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::SeqCst); let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Relaxed); - let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::Acquire); + let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Acquire); + let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::SeqCst); let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::Relaxed); + let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::Acquire); + let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::SeqCst); let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::Relaxed); let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::Acquire); let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::SeqCst); @@ -39,22 +45,4 @@ fn main() { //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::Release); //~^ ERROR `compare_exchange`'s failure ordering may not be `Release` or `AcqRel` - - // Release success order forbids failure order of Acquire or SeqCst - let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Acquire); - //~^ ERROR `compare_exchange`'s success ordering must be at least as strong as - let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::SeqCst); - //~^ ERROR `compare_exchange`'s success ordering must be at least as strong as - - // Relaxed success order also forbids failure order of Acquire or SeqCst - let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::SeqCst); - //~^ ERROR `compare_exchange`'s success ordering must be at least as strong as - let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Acquire); - //~^ ERROR `compare_exchange`'s success ordering must be at least as strong as - - // Acquire/AcqRel forbids failure order of SeqCst - let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::SeqCst); - //~^ ERROR `compare_exchange`'s success ordering must be at least as strong as - let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::SeqCst); - //~^ ERROR `compare_exchange`'s success ordering must be at least as strong as } diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr index 41121a20dee99..f6f8f88e88457 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr @@ -1,5 +1,5 @@ error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:20:57 + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:26:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -8,7 +8,7 @@ LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::AcqRel); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:22:57 + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:28:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -16,7 +16,7 @@ LL | let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::AcqRel); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:24:57 + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:30:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -24,7 +24,7 @@ LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::AcqRel); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:26:56 + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:32:56 | LL | let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -32,7 +32,7 @@ LL | let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::AcqRel); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:28:56 + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:34:56 | LL | let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -40,7 +40,7 @@ LL | let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::AcqRel); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:32:57 + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:38:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Release); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -48,7 +48,7 @@ LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Release); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:34:57 + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:40:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::Release); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -56,7 +56,7 @@ LL | let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::Release); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:36:57 + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:42:57 | LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Release); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -64,7 +64,7 @@ LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Release); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:38:56 + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:44:56 | LL | let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::Release); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -72,66 +72,12 @@ LL | let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::Release); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:40:56 + --> $DIR/lint-invalid-atomic-ordering-exchange.rs:46:56 | LL | let _ = x.compare_exchange(0, 0, Ordering::SeqCst, Ordering::Release); | ^^^^^^^^^^^^^^^^^ invalid failure ordering | = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:44:38 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering - | | - | `Release` success ordering - | help: consider using `AcqRel` success ordering instead - -error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:46:38 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::Release, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering - | | - | `Release` success ordering - | help: consider using `SeqCst` success ordering instead - -error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:50:38 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering - | | - | `Relaxed` success ordering - | help: consider using `SeqCst` success ordering instead - -error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:52:38 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::Acquire); - | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering - | | - | `Relaxed` success ordering - | help: consider using `Acquire` success ordering instead - -error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:56:38 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::Acquire, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering - | | - | `Acquire` success ordering - | help: consider using `SeqCst` success ordering instead - -error: `compare_exchange`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-exchange.rs:58:38 - | -LL | let _ = x.compare_exchange(0, 0, Ordering::AcqRel, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering - | | - | `AcqRel` success ordering - | help: consider using `SeqCst` success ordering instead - -error: aborting due to 16 previous errors +error: aborting due to 10 previous errors diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.rs b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.rs index 73eda182aa879..734b63324af25 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.rs +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.rs @@ -7,11 +7,17 @@ fn main() { // Allowed ordering combos let _ = x.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::Acquire, Ordering::Acquire, |old| Some(old + 1)); + let _ = x.fetch_update(Ordering::Relaxed, Ordering::Acquire, |old| Some(old + 1)); + let _ = x.fetch_update(Ordering::Relaxed, Ordering::SeqCst, |old| Some(old + 1)); let _ = x.fetch_update(Ordering::Acquire, Ordering::Relaxed, |old| Some(old + 1)); + let _ = x.fetch_update(Ordering::Acquire, Ordering::Acquire, |old| Some(old + 1)); + let _ = x.fetch_update(Ordering::Acquire, Ordering::SeqCst, |old| Some(old + 1)); let _ = x.fetch_update(Ordering::Release, Ordering::Relaxed, |old| Some(old + 1)); - let _ = x.fetch_update(Ordering::AcqRel, Ordering::Acquire, |old| Some(old + 1)); + let _ = x.fetch_update(Ordering::Release, Ordering::Acquire, |old| Some(old + 1)); + let _ = x.fetch_update(Ordering::Release, Ordering::SeqCst, |old| Some(old + 1)); let _ = x.fetch_update(Ordering::AcqRel, Ordering::Relaxed, |old| Some(old + 1)); + let _ = x.fetch_update(Ordering::AcqRel, Ordering::Acquire, |old| Some(old + 1)); + let _ = x.fetch_update(Ordering::AcqRel, Ordering::SeqCst, |old| Some(old + 1)); let _ = x.fetch_update(Ordering::SeqCst, Ordering::Relaxed, |old| Some(old + 1)); let _ = x.fetch_update(Ordering::SeqCst, Ordering::Acquire, |old| Some(old + 1)); let _ = x.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |old| Some(old + 1)); @@ -40,21 +46,4 @@ fn main() { let _ = x.fetch_update(Ordering::SeqCst, Ordering::Release, |old| Some(old + 1)); //~^ ERROR `fetch_update`'s failure ordering may not be `Release` or `AcqRel` - // Release success order forbids failure order of Acquire or SeqCst - let _ = x.fetch_update(Ordering::Release, Ordering::Acquire, |old| Some(old + 1)); - //~^ ERROR `fetch_update`'s success ordering must be at least as strong as - let _ = x.fetch_update(Ordering::Release, Ordering::SeqCst, |old| Some(old + 1)); - //~^ ERROR `fetch_update`'s success ordering must be at least as strong as - - // Relaxed success order also forbids failure order of Acquire or SeqCst - let _ = x.fetch_update(Ordering::Relaxed, Ordering::SeqCst, |old| Some(old + 1)); - //~^ ERROR `fetch_update`'s success ordering must be at least as strong as - let _ = x.fetch_update(Ordering::Relaxed, Ordering::Acquire, |old| Some(old + 1)); - //~^ ERROR `fetch_update`'s success ordering must be at least as strong as - - // Acquire/AcqRel forbids failure order of SeqCst - let _ = x.fetch_update(Ordering::Acquire, Ordering::SeqCst, |old| Some(old + 1)); - //~^ ERROR `fetch_update`'s success ordering must be at least as strong as - let _ = x.fetch_update(Ordering::AcqRel, Ordering::SeqCst, |old| Some(old + 1)); - //~^ ERROR `fetch_update`'s success ordering must be at least as strong as } diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr index 7bea56d57fbab..267b1c706ef17 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr @@ -1,5 +1,5 @@ error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:20:47 + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:26:47 | LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -8,7 +8,7 @@ LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::AcqRel, |old| Some( = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:22:47 + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:28:47 | LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -16,7 +16,7 @@ LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::AcqRel, |old| Some( = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:24:47 + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:30:47 | LL | let _ = x.fetch_update(Ordering::Release, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -24,7 +24,7 @@ LL | let _ = x.fetch_update(Ordering::Release, Ordering::AcqRel, |old| Some( = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:26:46 + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:32:46 | LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -32,7 +32,7 @@ LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::AcqRel, |old| Some(o = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:28:46 + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:34:46 | LL | let _ = x.fetch_update(Ordering::SeqCst, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -40,7 +40,7 @@ LL | let _ = x.fetch_update(Ordering::SeqCst, Ordering::AcqRel, |old| Some(o = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:32:47 + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:38:47 | LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -48,7 +48,7 @@ LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::Release, |old| Some = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:34:47 + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:40:47 | LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -56,7 +56,7 @@ LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::Release, |old| Some = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:36:47 + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:42:47 | LL | let _ = x.fetch_update(Ordering::Release, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -64,7 +64,7 @@ LL | let _ = x.fetch_update(Ordering::Release, Ordering::Release, |old| Some = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:38:46 + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:44:46 | LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -72,66 +72,12 @@ LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::Release, |old| Some( = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:40:46 + --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:46:46 | LL | let _ = x.fetch_update(Ordering::SeqCst, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering | = help: consider using `Acquire` or `Relaxed` failure ordering instead -error: `fetch_update`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:44:28 - | -LL | let _ = x.fetch_update(Ordering::Release, Ordering::Acquire, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering - | | - | `Release` success ordering - | help: consider using `AcqRel` success ordering instead - -error: `fetch_update`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:46:28 - | -LL | let _ = x.fetch_update(Ordering::Release, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering - | | - | `Release` success ordering - | help: consider using `SeqCst` success ordering instead - -error: `fetch_update`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:50:28 - | -LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering - | | - | `Relaxed` success ordering - | help: consider using `SeqCst` success ordering instead - -error: `fetch_update`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:52:28 - | -LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::Acquire, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ ----------------- `Acquire` failure ordering - | | - | `Relaxed` success ordering - | help: consider using `Acquire` success ordering instead - -error: `fetch_update`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:56:28 - | -LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering - | | - | `Acquire` success ordering - | help: consider using `SeqCst` success ordering instead - -error: `fetch_update`'s success ordering must be at least as strong as its failure ordering - --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:58:28 - | -LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::SeqCst, |old| Some(old + 1)); - | ^^^^^^^^^^^^^^^^ ---------------- `SeqCst` failure ordering - | | - | `AcqRel` success ordering - | help: consider using `SeqCst` success ordering instead - -error: aborting due to 16 previous errors +error: aborting due to 10 previous errors From f40326027accd96214b65d44cf9c357d23de426c Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Fri, 27 May 2022 20:09:06 +0000 Subject: [PATCH 5/9] Check generators for well formedness --- .../src/traits/fulfill.rs | 5 ++-- .../rustc_trait_selection/src/traits/wf.rs | 14 +++++----- .../generic-associated-types/issue-88287.rs | 2 +- .../issue-88287.stderr | 27 +++++++++++++++++++ .../ui/lifetimes/issue-76168-hr-outlives-2.rs | 22 +++++++++++++++ src/test/ui/type-alias-impl-trait/future.rs | 22 +++++++++++++++ .../ui/type-alias-impl-trait/future.stderr | 19 +++++++++++++ 7 files changed, 101 insertions(+), 10 deletions(-) create mode 100644 src/test/ui/generic-associated-types/issue-88287.stderr create mode 100644 src/test/ui/lifetimes/issue-76168-hr-outlives-2.rs create mode 100644 src/test/ui/type-alias-impl-trait/future.rs create mode 100644 src/test/ui/type-alias-impl-trait/future.stderr diff --git a/compiler/rustc_trait_selection/src/traits/fulfill.rs b/compiler/rustc_trait_selection/src/traits/fulfill.rs index 81f5dcc45b93e..34b37c4e41028 100644 --- a/compiler/rustc_trait_selection/src/traits/fulfill.rs +++ b/compiler/rustc_trait_selection/src/traits/fulfill.rs @@ -295,6 +295,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> { /// This is called much less often than `needs_process_obligation`, so we /// never inline it. #[inline(never)] + #[instrument(level = "debug", skip(self, pending_obligation))] fn process_obligation( &mut self, pending_obligation: &mut PendingPredicateObligation<'tcx>, @@ -303,7 +304,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> { let obligation = &mut pending_obligation.obligation; - debug!(?obligation, "process_obligation pre-resolve"); + debug!(?obligation, "pre-resolve"); if obligation.predicate.has_infer_types_or_consts() { obligation.predicate = @@ -312,8 +313,6 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> { let obligation = &pending_obligation.obligation; - debug!(?obligation, ?obligation.cause, "process_obligation"); - let infcx = self.selcx.infcx(); if obligation.predicate.has_projections() { diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs index 6e23c84219145..6b758ba63cd0f 100644 --- a/compiler/rustc_trait_selection/src/traits/wf.rs +++ b/compiler/rustc_trait_selection/src/traits/wf.rs @@ -559,7 +559,7 @@ impl<'tcx> WfPredicates<'tcx> { } } - ty::Generator(..) => { + ty::Generator(did, substs, ..) => { // Walk ALL the types in the generator: this will // include the upvar types as well as the yield // type. Note that this is mildly distinct from @@ -567,6 +567,8 @@ impl<'tcx> WfPredicates<'tcx> { // about the signature of the closure. We don't // have the problem of implied bounds here since // generators don't take arguments. + let obligations = self.nominal_obligations(did, substs); + self.out.extend(obligations); } ty::Closure(did, substs) => { @@ -618,11 +620,9 @@ impl<'tcx> WfPredicates<'tcx> { } ty::Opaque(did, substs) => { - // all of the requirements on type parameters - // should've been checked by the instantiation - // of whatever returned this exact `impl Trait`. - - // for named opaque `impl Trait` types we still need to check them + // All of the requirements on type parameters + // have already been checked for `impl Trait` in + // return position. We do need to check type-alias-impl-trait though. if ty::is_impl_trait_defn(self.tcx, did).is_none() { let obligations = self.nominal_obligations(did, substs); self.out.extend(obligations); @@ -684,6 +684,7 @@ impl<'tcx> WfPredicates<'tcx> { } } + #[instrument(level = "debug", skip(self))] fn nominal_obligations( &mut self, def_id: DefId, @@ -698,6 +699,7 @@ impl<'tcx> WfPredicates<'tcx> { } let predicates = predicates.instantiate(self.tcx, substs); + trace!("{:#?}", predicates); debug_assert_eq!(predicates.predicates.len(), origins.len()); iter::zip(iter::zip(predicates.predicates, predicates.spans), origins.into_iter().rev()) diff --git a/src/test/ui/generic-associated-types/issue-88287.rs b/src/test/ui/generic-associated-types/issue-88287.rs index 6b10edf073ff6..4952a082586d0 100644 --- a/src/test/ui/generic-associated-types/issue-88287.rs +++ b/src/test/ui/generic-associated-types/issue-88287.rs @@ -1,4 +1,3 @@ -// check-pass // edition:2018 #![feature(generic_associated_types)] @@ -34,6 +33,7 @@ where fn search<'c>(&'c self, _client: &'c ()) -> Self::Future<'c, Self, Criteria> { async move { todo!() } + //~^ ERROR: the size for values of type `A` cannot be known at compilation time } } diff --git a/src/test/ui/generic-associated-types/issue-88287.stderr b/src/test/ui/generic-associated-types/issue-88287.stderr new file mode 100644 index 0000000000000..5241d85a5f964 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-88287.stderr @@ -0,0 +1,27 @@ +error[E0277]: the size for values of type `A` cannot be known at compilation time + --> $DIR/issue-88287.rs:35:9 + | +LL | type SearchFutureTy<'f, A, B: 'f> + | - this type parameter needs to be `std::marker::Sized` +... +LL | async move { todo!() } + | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +note: required by a bound in `>` + --> $DIR/issue-88287.rs:25:6 + | +LL | impl SearchableResourceExt for T + | ^ required by this bound in `>` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - A: SearchableResource + ?Sized + 'f, +LL + A: SearchableResource + 'f, + | +help: consider relaxing the implicit `Sized` restriction + | +LL | T: SearchableResource + ?Sized, + | ++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/lifetimes/issue-76168-hr-outlives-2.rs b/src/test/ui/lifetimes/issue-76168-hr-outlives-2.rs new file mode 100644 index 0000000000000..348586fa26bcc --- /dev/null +++ b/src/test/ui/lifetimes/issue-76168-hr-outlives-2.rs @@ -0,0 +1,22 @@ +// edition:2018 +// check-pass + +trait Trait { + type Output; +} + +async fn walk(filter: F) +where + for<'a> F: Trait<&'a u32> + 'a, + for<'a> >::Output: 'a, +{ +} + +async fn walk2(filter: F) +where + for<'a> F: Trait<&'a u32> + 'a, + for<'a> >::Output: 'a, +{ +} + +fn main() {} diff --git a/src/test/ui/type-alias-impl-trait/future.rs b/src/test/ui/type-alias-impl-trait/future.rs new file mode 100644 index 0000000000000..56323216effa4 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/future.rs @@ -0,0 +1,22 @@ +#![feature(type_alias_impl_trait)] + +// edition:2021 +// compile-flags: --crate-type=lib + +use std::future::Future; + +trait Bar { + fn bar(&self); +} + +type FooFuture = impl Future; + +fn foo(bar: B) -> FooFuture { + async move { bar.bar() } + //~^ ERROR: the trait bound `B: Bar` is not satisfied +} + +pub fn mainish(ctx: &mut std::task::Context) { + let boom: FooFuture = unsafe { core::mem::zeroed() }; + Box::pin(boom).as_mut().poll(ctx); +} diff --git a/src/test/ui/type-alias-impl-trait/future.stderr b/src/test/ui/type-alias-impl-trait/future.stderr new file mode 100644 index 0000000000000..7e76c120a2566 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/future.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `B: Bar` is not satisfied + --> $DIR/future.rs:15:5 + | +LL | async move { bar.bar() } + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `B` + | +note: required by a bound in `foo` + --> $DIR/future.rs:14:11 + | +LL | fn foo(bar: B) -> FooFuture { + | ^^^ required by this bound in `foo` +help: consider restricting type parameter `B` + | +LL | type FooFuture = impl Future; + | +++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. From 50c612faef43799497aa33fa6a92bb3a7f5a9401 Mon Sep 17 00:00:00 2001 From: Tim Vermeulen Date: Mon, 18 Jul 2022 21:10:47 +0200 Subject: [PATCH 6/9] Fix `Skip::next` for non-fused inner iterators --- library/core/src/iter/adapters/skip.rs | 2 +- library/core/tests/iter/adapters/skip.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/library/core/src/iter/adapters/skip.rs b/library/core/src/iter/adapters/skip.rs index ea1da8ba434ed..2c283100f071f 100644 --- a/library/core/src/iter/adapters/skip.rs +++ b/library/core/src/iter/adapters/skip.rs @@ -33,7 +33,7 @@ where #[inline] fn next(&mut self) -> Option { if unlikely(self.n > 0) { - self.iter.nth(crate::mem::take(&mut self.n) - 1); + self.iter.nth(crate::mem::take(&mut self.n) - 1)?; } self.iter.next() } diff --git a/library/core/tests/iter/adapters/skip.rs b/library/core/tests/iter/adapters/skip.rs index 0c464bdd03a22..a73d9861dfb64 100644 --- a/library/core/tests/iter/adapters/skip.rs +++ b/library/core/tests/iter/adapters/skip.rs @@ -1,5 +1,7 @@ use core::iter::*; +use super::Unfuse; + #[test] fn test_iterator_skip() { let xs = [0, 1, 2, 3, 5, 13, 15, 16, 17, 19, 20, 30]; @@ -190,3 +192,9 @@ fn test_skip_nth_back() { it.by_ref().skip(2).nth_back(10); assert_eq!(it.next_back(), Some(&1)); } + +#[test] +fn test_skip_non_fused() { + let non_fused = Unfuse::new(0..10); + let _ = non_fused.skip(20).next(); +} From e52837c362d00fb7672dacb30de58dd114d2811e Mon Sep 17 00:00:00 2001 From: Tim Vermeulen Date: Mon, 18 Jul 2022 21:53:35 +0200 Subject: [PATCH 7/9] Add note to test about `Unfuse` --- library/core/tests/iter/adapters/skip.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/core/tests/iter/adapters/skip.rs b/library/core/tests/iter/adapters/skip.rs index a73d9861dfb64..65f235e86aab9 100644 --- a/library/core/tests/iter/adapters/skip.rs +++ b/library/core/tests/iter/adapters/skip.rs @@ -196,5 +196,8 @@ fn test_skip_nth_back() { #[test] fn test_skip_non_fused() { let non_fused = Unfuse::new(0..10); + + // `Skip` would previously exhaust the iterator in this `next` call and then erroneously try to + // advance it further. `Unfuse` tests that this doesn't happen by panicking in that scenario. let _ = non_fused.skip(20).next(); } From 136f017258f9c08ef36c0ea705ddd9ffd75c5b28 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 16 Jul 2022 20:53:08 +0000 Subject: [PATCH 8/9] Use LocalDefId in OpaqueTypeKey --- compiler/rustc_borrowck/src/nll.rs | 6 ++--- .../src/region_infer/opaque_types.rs | 16 ++++++------ .../src/infer/canonical/query_response.rs | 2 +- compiler/rustc_infer/src/infer/mod.rs | 2 +- .../rustc_infer/src/infer/opaque_types.rs | 26 ++++++++++++------- .../src/infer/region_constraints/mod.rs | 4 +-- compiler/rustc_middle/src/infer/mod.rs | 4 +-- compiler/rustc_middle/src/mir/query.rs | 2 +- compiler/rustc_middle/src/ty/context.rs | 2 +- compiler/rustc_middle/src/ty/mod.rs | 3 +-- compiler/rustc_middle/src/ty/sty.rs | 7 ----- .../rustc_typeck/src/check/compare_method.rs | 2 +- .../rustc_typeck/src/check/fn_ctxt/_impl.rs | 11 ++++---- compiler/rustc_typeck/src/check/writeback.rs | 5 ++-- compiler/rustc_typeck/src/collect/type_of.rs | 12 ++++----- 15 files changed, 51 insertions(+), 53 deletions(-) diff --git a/compiler/rustc_borrowck/src/nll.rs b/compiler/rustc_borrowck/src/nll.rs index d2e8227479271..0961203d76d7d 100644 --- a/compiler/rustc_borrowck/src/nll.rs +++ b/compiler/rustc_borrowck/src/nll.rs @@ -1,7 +1,7 @@ //! The entry point of the NLL borrow checker. use rustc_data_structures::vec_map::VecMap; -use rustc_hir::def_id::DefId; +use rustc_hir::def_id::LocalDefId; use rustc_index::vec::IndexVec; use rustc_infer::infer::InferCtxt; use rustc_middle::mir::{create_dump_file, dump_enabled, dump_mir, PassWhere}; @@ -44,7 +44,7 @@ pub type PoloniusOutput = Output; /// closure requirements to propagate, and any generated errors. pub(crate) struct NllOutput<'tcx> { pub regioncx: RegionInferenceContext<'tcx>, - pub opaque_type_values: VecMap>, + pub opaque_type_values: VecMap>, pub polonius_input: Option>, pub polonius_output: Option>, pub opt_closure_req: Option>, @@ -373,7 +373,7 @@ pub(super) fn dump_annotation<'a, 'tcx>( body: &Body<'tcx>, regioncx: &RegionInferenceContext<'tcx>, closure_region_requirements: &Option>, - opaque_type_values: &VecMap>, + opaque_type_values: &VecMap>, errors: &mut crate::error::BorrowckErrors<'tcx>, ) { let tcx = infcx.tcx; diff --git a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs index 7c1fa28b8dfcc..de9da84572983 100644 --- a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs +++ b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs @@ -1,6 +1,6 @@ use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::vec_map::VecMap; -use rustc_hir::def_id::DefId; +use rustc_hir::def_id::LocalDefId; use rustc_hir::OpaqueTyOrigin; use rustc_infer::infer::error_reporting::unexpected_hidden_region_diagnostic; use rustc_infer::infer::InferCtxt; @@ -63,8 +63,8 @@ impl<'tcx> RegionInferenceContext<'tcx> { &self, infcx: &InferCtxt<'_, 'tcx>, opaque_ty_decls: VecMap, (OpaqueHiddenType<'tcx>, OpaqueTyOrigin)>, - ) -> VecMap> { - let mut result: VecMap> = VecMap::new(); + ) -> VecMap> { + let mut result: VecMap> = VecMap::new(); for (opaque_type_key, (concrete_type, origin)) in opaque_ty_decls { let substs = opaque_type_key.substs; debug!(?concrete_type, ?substs); @@ -235,7 +235,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { // lifetimes with 'static and remapping only those used in the // `impl Trait` return type, resulting in the parameters // shifting. - let id_substs = InternalSubsts::identity_for_item(self.tcx, def_id); + let id_substs = InternalSubsts::identity_for_item(self.tcx, def_id.to_def_id()); debug!(?id_substs); let map: FxHashMap, GenericArg<'tcx>> = substs.iter().enumerate().map(|(index, subst)| (subst, id_substs[index])).collect(); @@ -268,7 +268,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { // This logic duplicates most of `check_opaque_meets_bounds`. // FIXME(oli-obk): Also do region checks here and then consider removing `check_opaque_meets_bounds` entirely. let param_env = self.tcx.param_env(def_id); - let body_id = self.tcx.local_def_id_to_hir_id(def_id.as_local().unwrap()); + let body_id = self.tcx.local_def_id_to_hir_id(def_id); self.tcx.infer_ctxt().enter(move |infcx| { // Require the hidden type to be well-formed with only the generics of the opaque type. // Defining use functions may have more bounds than the opaque type, which is ok, as long as the @@ -296,7 +296,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { infcx .report_mismatched_types( &ObligationCause::misc(instantiated_ty.span, body_id), - self.tcx.mk_opaque(def_id, id_substs), + self.tcx.mk_opaque(def_id.to_def_id(), id_substs), definition_ty, err, ) @@ -423,7 +423,7 @@ fn check_opaque_type_parameter_valid( struct ReverseMapper<'tcx> { tcx: TyCtxt<'tcx>, - opaque_type_def_id: DefId, + opaque_type_def_id: LocalDefId, map: FxHashMap, GenericArg<'tcx>>, map_missing_regions_to_empty: bool, @@ -437,7 +437,7 @@ struct ReverseMapper<'tcx> { impl<'tcx> ReverseMapper<'tcx> { fn new( tcx: TyCtxt<'tcx>, - opaque_type_def_id: DefId, + opaque_type_def_id: LocalDefId, map: FxHashMap, GenericArg<'tcx>>, hidden_ty: Ty<'tcx>, span: Span, diff --git a/compiler/rustc_infer/src/infer/canonical/query_response.rs b/compiler/rustc_infer/src/infer/canonical/query_response.rs index 1e8b212276f2f..8dc20544f1b1a 100644 --- a/compiler/rustc_infer/src/infer/canonical/query_response.rs +++ b/compiler/rustc_infer/src/infer/canonical/query_response.rs @@ -153,7 +153,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> { .opaque_type_storage .take_opaque_types() .into_iter() - .map(|(k, v)| (self.tcx.mk_opaque(k.def_id, k.substs), v.hidden_type.ty)) + .map(|(k, v)| (self.tcx.mk_opaque(k.def_id.to_def_id(), k.substs), v.hidden_type.ty)) .collect() } diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index c5a342c1ba2ca..b3dc2e586d251 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -938,7 +938,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { #[instrument(skip(self), level = "debug")] pub fn member_constraint( &self, - opaque_type_def_id: DefId, + opaque_type_def_id: LocalDefId, definition_span: Span, hidden_ty: Ty<'tcx>, region: ty::Region<'tcx>, diff --git a/compiler/rustc_infer/src/infer/opaque_types.rs b/compiler/rustc_infer/src/infer/opaque_types.rs index f11701bba6f43..4ee9c4eeda40a 100644 --- a/compiler/rustc_infer/src/infer/opaque_types.rs +++ b/compiler/rustc_infer/src/infer/opaque_types.rs @@ -51,7 +51,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { return InferOk { value: ty, obligations: vec![] }; } let mut obligations = vec![]; - let replace_opaque_type = |def_id| self.opaque_type_origin(def_id, span).is_some(); + let replace_opaque_type = |def_id: DefId| { + def_id + .as_local() + .map_or(false, |def_id| self.opaque_type_origin(def_id, span).is_some()) + }; let value = ty.fold_with(&mut ty::fold::BottomUpFolder { tcx: self.tcx, lt_op: |lt| lt, @@ -96,6 +100,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { let (a, b) = if a_is_expected { (a, b) } else { (b, a) }; let process = |a: Ty<'tcx>, b: Ty<'tcx>| match *a.kind() { ty::Opaque(def_id, substs) if def_id.is_local() => { + let def_id = def_id.expect_local(); let origin = if self.defining_use_anchor.is_some() { // Check that this is `impl Trait` type is // declared by `parent_def_id` -- i.e., one whose @@ -141,7 +146,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { // no one encounters it in practice. // It does occur however in `fn fut() -> impl Future { async { 42 } }`, // where it is of no concern, so we only check for TAITs. - if let Some(OpaqueTyOrigin::TyAlias) = self.opaque_type_origin(did2, cause.span) + if let Some(OpaqueTyOrigin::TyAlias) = + did2.as_local().and_then(|did2| self.opaque_type_origin(did2, cause.span)) { self.tcx .sess @@ -399,8 +405,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { } #[instrument(skip(self), level = "trace")] - pub fn opaque_type_origin(&self, opaque_def_id: DefId, span: Span) -> Option { - let def_id = opaque_def_id.as_local()?; + pub fn opaque_type_origin(&self, def_id: LocalDefId, span: Span) -> Option { let opaque_hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id); let parent_def_id = self.defining_use_anchor?; let item_kind = &self.tcx.hir().expect_item(def_id).kind; @@ -409,7 +414,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { span_bug!( span, "weird opaque type: {:#?}, {:#?}", - opaque_def_id, + def_id, item_kind ) }; @@ -428,12 +433,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { } #[instrument(skip(self), level = "trace")] - fn opaque_ty_origin_unchecked(&self, opaque_def_id: DefId, span: Span) -> OpaqueTyOrigin { - let def_id = opaque_def_id.as_local().unwrap(); + fn opaque_ty_origin_unchecked(&self, def_id: LocalDefId, span: Span) -> OpaqueTyOrigin { let origin = match self.tcx.hir().expect_item(def_id).kind { hir::ItemKind::OpaqueTy(hir::OpaqueTy { origin, .. }) => origin, ref itemkind => { - span_bug!(span, "weird opaque type: {:?}, {:#?}", opaque_def_id, itemkind) + span_bug!(span, "weird opaque type: {:?}, {:#?}", def_id, itemkind) } }; trace!(?origin); @@ -557,7 +561,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { obligations = self.at(&cause, param_env).eq(prev, hidden_ty)?.obligations; } - let item_bounds = tcx.bound_explicit_item_bounds(def_id); + let item_bounds = tcx.bound_explicit_item_bounds(def_id.to_def_id()); for predicate in item_bounds.transpose_iter().map(|e| e.map_bound(|(p, _)| *p)) { debug!(?predicate); @@ -579,7 +583,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { } // Replace all other mentions of the same opaque type with the hidden type, // as the bounds must hold on the hidden type after all. - ty::Opaque(def_id2, substs2) if def_id == def_id2 && substs == substs2 => { + ty::Opaque(def_id2, substs2) + if def_id.to_def_id() == def_id2 && substs == substs2 => + { hidden_ty } _ => ty, diff --git a/compiler/rustc_infer/src/infer/region_constraints/mod.rs b/compiler/rustc_infer/src/infer/region_constraints/mod.rs index c5747ecf702a7..551f398e0c2c4 100644 --- a/compiler/rustc_infer/src/infer/region_constraints/mod.rs +++ b/compiler/rustc_infer/src/infer/region_constraints/mod.rs @@ -12,7 +12,7 @@ use rustc_data_structures::intern::Interned; use rustc_data_structures::sync::Lrc; use rustc_data_structures::undo_log::UndoLogs; use rustc_data_structures::unify as ut; -use rustc_hir::def_id::DefId; +use rustc_hir::def_id::LocalDefId; use rustc_index::vec::IndexVec; use rustc_middle::infer::unify_key::{RegionVidKey, UnifiedRegion}; use rustc_middle::ty::ReStatic; @@ -533,7 +533,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> { pub fn member_constraint( &mut self, - opaque_type_def_id: DefId, + opaque_type_def_id: LocalDefId, definition_span: Span, hidden_ty: Ty<'tcx>, member_region: ty::Region<'tcx>, diff --git a/compiler/rustc_middle/src/infer/mod.rs b/compiler/rustc_middle/src/infer/mod.rs index 55e00c4c0d8ef..8b2f9bdfd486b 100644 --- a/compiler/rustc_middle/src/infer/mod.rs +++ b/compiler/rustc_middle/src/infer/mod.rs @@ -4,7 +4,7 @@ pub mod unify_key; use crate::ty::Region; use crate::ty::Ty; use rustc_data_structures::sync::Lrc; -use rustc_hir::def_id::DefId; +use rustc_hir::def_id::LocalDefId; use rustc_span::Span; /// Requires that `region` must be equal to one of the regions in `choice_regions`. @@ -16,7 +16,7 @@ use rustc_span::Span; #[derive(Debug, Clone, HashStable, TypeFoldable, TypeVisitable, Lift)] pub struct MemberConstraint<'tcx> { /// The `DefId` of the opaque type causing this constraint: used for error reporting. - pub opaque_type_def_id: DefId, + pub opaque_type_def_id: LocalDefId, /// The span where the hidden type was instantiated. pub definition_span: Span, diff --git a/compiler/rustc_middle/src/mir/query.rs b/compiler/rustc_middle/src/mir/query.rs index 6a6ed3dc728d9..423e84d88cf73 100644 --- a/compiler/rustc_middle/src/mir/query.rs +++ b/compiler/rustc_middle/src/mir/query.rs @@ -235,7 +235,7 @@ pub struct BorrowCheckResult<'tcx> { /// All the opaque types that are restricted to concrete types /// by this function. Unlike the value in `TypeckResults`, this has /// unerased regions. - pub concrete_opaque_types: VecMap>, + pub concrete_opaque_types: VecMap>, pub closure_requirements: Option>, pub used_mut_upvars: SmallVec<[Field; 8]>, pub tainted_by_errors: Option, diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index a594dab2e20a3..0f98d19820e25 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -542,7 +542,7 @@ pub struct TypeckResults<'tcx> { /// even if they are only set in dead code (which doesn't show up in MIR). /// For type-alias-impl-trait, this map is only used to prevent query cycles, /// so the hidden types are all `None`. - pub concrete_opaque_types: VecMap>>, + pub concrete_opaque_types: VecMap>>, /// Tracks the minimum captures required for a closure; /// see `MinCaptureInformationMap` for more details. diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 3536d946db279..53919826bf617 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -1108,8 +1108,7 @@ impl<'tcx> InstantiatedPredicates<'tcx> { #[derive(Copy, Clone, Debug, PartialEq, Eq, HashStable, TyEncodable, TyDecodable, Lift)] #[derive(TypeFoldable, TypeVisitable)] pub struct OpaqueTypeKey<'tcx> { - // FIXME(oli-obk): make this a LocalDefId - pub def_id: DefId, + pub def_id: LocalDefId, pub substs: SubstsRef<'tcx>, } diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index d663f1a3ec6e7..9f622ad6cd2a1 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -1707,13 +1707,6 @@ impl<'tcx> Ty<'tcx> { } } - pub fn expect_opaque_type(self) -> ty::OpaqueTypeKey<'tcx> { - match *self.kind() { - Opaque(def_id, substs) => ty::OpaqueTypeKey { def_id, substs }, - _ => bug!("`expect_opaque_type` called on non-opaque type: {}", self), - } - } - pub fn simd_size_and_type(self, tcx: TyCtxt<'tcx>) -> (u64, Ty<'tcx>) { match self.kind() { Adt(def, substs) => { diff --git a/compiler/rustc_typeck/src/check/compare_method.rs b/compiler/rustc_typeck/src/check/compare_method.rs index 6ae17fc61762f..3fb8e5080f346 100644 --- a/compiler/rustc_typeck/src/check/compare_method.rs +++ b/compiler/rustc_typeck/src/check/compare_method.rs @@ -1513,7 +1513,7 @@ pub fn check_type_bounds<'tcx>( value.hidden_type.span, tcx.hir().local_def_id_to_hir_id(impl_ty.def_id.expect_local()), ), - tcx.mk_opaque(key.def_id, key.substs), + tcx.mk_opaque(key.def_id.to_def_id(), key.substs), value.hidden_type.ty, TypeError::Mismatch, ) diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs index d33b5b2140362..d079aeb4801ca 100644 --- a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs +++ b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs @@ -763,12 +763,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // src/test/ui/impl-trait/hidden-type-is-opaque-2.rs for examples that hit this path. if formal_ret.has_infer_types() { for ty in ret_ty.walk() { - if let ty::subst::GenericArgKind::Type(ty) = ty.unpack() { - if let ty::Opaque(def_id, _) = *ty.kind() { - if self.infcx.opaque_type_origin(def_id, DUMMY_SP).is_some() { - return None; - } - } + if let ty::subst::GenericArgKind::Type(ty) = ty.unpack() + && let ty::Opaque(def_id, _) = *ty.kind() + && let Some(def_id) = def_id.as_local() + && self.infcx.opaque_type_origin(def_id, DUMMY_SP).is_some() { + return None; } } } diff --git a/compiler/rustc_typeck/src/check/writeback.rs b/compiler/rustc_typeck/src/check/writeback.rs index 0cbb0e25d0d42..23ac638b2f430 100644 --- a/compiler/rustc_typeck/src/check/writeback.rs +++ b/compiler/rustc_typeck/src/check/writeback.rs @@ -4,6 +4,7 @@ use crate::check::FnCtxt; +use hir::def_id::LocalDefId; use rustc_data_structures::stable_map::FxHashMap; use rustc_errors::ErrorGuaranteed; use rustc_hir as hir; @@ -509,13 +510,13 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { hir::OpaqueTyOrigin::FnReturn(_) | hir::OpaqueTyOrigin::AsyncFn(_) => { let ty = self.resolve(decl.hidden_type.ty, &decl.hidden_type.span); struct RecursionChecker { - def_id: DefId, + def_id: LocalDefId, } impl<'tcx> ty::TypeVisitor<'tcx> for RecursionChecker { type BreakTy = (); fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow { if let ty::Opaque(def_id, _) = *t.kind() { - if def_id == self.def_id { + if def_id == self.def_id.to_def_id() { return ControlFlow::Break(()); } } diff --git a/compiler/rustc_typeck/src/collect/type_of.rs b/compiler/rustc_typeck/src/collect/type_of.rs index f942a4fb53a26..faa4f3700bba8 100644 --- a/compiler/rustc_typeck/src/collect/type_of.rs +++ b/compiler/rustc_typeck/src/collect/type_of.rs @@ -342,7 +342,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> { let concrete_ty = tcx .mir_borrowck(owner) .concrete_opaque_types - .get(&def_id.to_def_id()) + .get(&def_id) .copied() .map(|concrete| concrete.ty) .unwrap_or_else(|| { @@ -353,7 +353,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> { // the `concrete_opaque_types` table. tcx.ty_error() } else { - table.concrete_opaque_types.get(&def_id.to_def_id()).copied().unwrap_or_else(|| { + table.concrete_opaque_types.get(&def_id).copied().unwrap_or_else(|| { // We failed to resolve the opaque type or it // resolves to itself. We interpret this as the // no values of the hidden type ever being constructed, @@ -526,7 +526,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> { tcx: TyCtxt<'tcx>, /// def_id of the opaque type whose defining uses are being checked - def_id: DefId, + def_id: LocalDefId, /// as we walk the defining uses, we are checking that all of them /// define the same hidden type. This variable is set to `Some` @@ -602,7 +602,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> { fn visit_item(&mut self, it: &'tcx Item<'tcx>) { trace!(?it.def_id); // The opaque type itself or its children are not within its reveal scope. - if it.def_id.to_def_id() != self.def_id { + if it.def_id != self.def_id { self.check(it.def_id); intravisit::walk_item(self, it); } @@ -610,7 +610,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> { fn visit_impl_item(&mut self, it: &'tcx ImplItem<'tcx>) { trace!(?it.def_id); // The opaque type itself or its children are not within its reveal scope. - if it.def_id.to_def_id() != self.def_id { + if it.def_id != self.def_id { self.check(it.def_id); intravisit::walk_impl_item(self, it); } @@ -624,7 +624,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> { let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); let scope = tcx.hir().get_defining_scope(hir_id); - let mut locator = ConstraintLocator { def_id: def_id.to_def_id(), tcx, found: None }; + let mut locator = ConstraintLocator { def_id: def_id, tcx, found: None }; debug!(?scope); From 01b2379e4902658de68fcdca2a15b48fe4d57875 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 20 Jun 2022 19:25:52 -0700 Subject: [PATCH 9/9] Mention first and last macro in backtrace --- compiler/rustc_errors/src/emitter.rs | 24 ++++++++++++++----- compiler/rustc_errors/src/lib.rs | 1 + src/test/ui/borrowck/borrowck-and-init.stderr | 2 +- .../borrowck/borrowck-break-uninit-2.stderr | 2 +- .../ui/borrowck/borrowck-break-uninit.stderr | 2 +- src/test/ui/borrowck/borrowck-or-init.stderr | 2 +- .../ui/borrowck/borrowck-while-break.stderr | 2 +- .../ui/borrowck/issue-24267-flow-exit.stderr | 4 ++-- src/test/ui/borrowck/issue-64453.stderr | 2 +- src/test/ui/borrowck/issue-81899.stderr | 2 +- .../issue-88434-minimal-example.stderr | 2 +- ...-88434-removal-index-should-be-less.stderr | 2 +- .../ui/borrowck/move-error-snippets.stderr | 2 +- .../diagnostics/arrays.stderr | 2 +- .../diagnostics/box.stderr | 2 +- .../diagnostics/repr_packed.stderr | 4 ++-- .../simple-struct-min-capture.stderr | 2 +- .../ui/codemap_tests/bad-format-args.stderr | 2 +- src/test/ui/codemap_tests/tab_3.stderr | 2 +- .../conditional_array_execution.stderr | 4 ++-- .../ui/consts/const-eval/const_panic.stderr | 20 ++++++++-------- .../consts/const-eval/const_panic_2021.stderr | 16 ++++++------- .../const-eval/const_panic_libcore_bin.stderr | 4 ++-- src/test/ui/consts/const-eval/format.stderr | 14 +++++------ .../ui/consts/const-eval/issue-43197.stderr | 8 +++---- .../ui/consts/const-eval/issue-44578.stderr | 2 +- .../ui/consts/const-eval/issue-85907.stderr | 2 +- .../const-eval/panic-assoc-never-type.stderr | 2 +- .../consts/const-eval/panic-never-type.stderr | 2 +- .../ui/consts/const-eval/unwind-abort.stderr | 2 +- .../const-float-bits-reject-conv.stderr | 8 +++---- src/test/ui/consts/issue-32829.stderr | 2 +- .../issue-66693-panic-in-array-len.stderr | 4 ++-- src/test/ui/consts/issue-66693.stderr | 6 ++--- src/test/ui/consts/issue-76064.stderr | 2 +- .../cross-crate-macro-backtrace/main.stderr | 2 +- src/test/ui/expr/if/if-let.stderr | 2 +- src/test/ui/fmt/ifmt-bad-arg.stderr | 4 ++-- src/test/ui/fmt/ifmt-unimpl.stderr | 2 +- src/test/ui/for-loop-while/while-let-2.stderr | 2 +- .../yield-while-ref-reborrowed.stderr | 2 +- src/test/ui/internal/internal-unstable.stderr | 2 +- src/test/ui/issues/issue-16966.stderr | 2 +- src/test/ui/issues/issue-42796.stderr | 2 +- src/test/ui/issues/issue-47646.stderr | 2 +- src/test/ui/issues/issue-69455.stderr | 2 +- src/test/ui/limits/issue-55878.stderr | 4 ++-- .../ui/liveness/liveness-move-in-while.stderr | 2 +- .../liveness/liveness-use-after-move.stderr | 2 +- .../liveness/liveness-use-after-send.stderr | 2 +- src/test/ui/loops/loop-proper-liveness.stderr | 2 +- .../ui/macro_backtrace/main.default.stderr | 4 ++-- src/test/ui/macros/format-parse-errors.stderr | 2 +- .../ui/macros/macro-backtrace-nested.stderr | 4 ++-- .../ui/macros/macro-backtrace-println.stderr | 2 +- .../macros/macro-local-data-key-priv.stderr | 2 +- .../macros/restricted-shadowing-legacy.stderr | 10 ++++---- .../macros/restricted-shadowing-modern.stderr | 8 +++---- ...nreachable-format-args.edition_2015.stderr | 2 +- ...es-based-on-type-capture-clause-bad.stderr | 2 +- src/test/ui/on-unimplemented/no-debug.stderr | 8 +++---- .../ui/parser/macro/pub-item-macro.stderr | 2 +- src/test/ui/proc-macro/mixed-site-span.stderr | 2 +- .../ui/proc-macro/parent-source-spans.stderr | 10 ++++---- src/test/ui/proc-macro/weird-hygiene.stderr | 2 +- .../dbg-macro-requires-debug.stderr | 2 +- .../ui/suggestions/bound-suggestions.stderr | 12 +++++----- ...gest-deref-inside-macro-issue-58298.stderr | 2 +- src/test/ui/suggestions/issue-97760.stderr | 2 +- src/test/ui/suggestions/path-display.stderr | 4 ++-- .../try-block-maybe-bad-lifetime.stderr | 2 +- .../ui/type-alias-impl-trait/nested.stderr | 2 +- .../ui/type/ascription/issue-47666.stderr | 2 +- .../use/use-after-move-based-on-type.stderr | 2 +- src/test/ui/walk-struct-literal-with.stderr | 2 +- .../tests/ui/diverging_sub_expression.stderr | 2 +- .../clippy/tests/ui/fallible_impl_from.stderr | 6 ++--- src/tools/clippy/tests/ui/issue-7447.stderr | 4 ++-- 78 files changed, 157 insertions(+), 144 deletions(-) diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 85ea8eb393782..61d953cd6f1cc 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -399,11 +399,11 @@ pub trait Emitter { ) { // Check for spans in macros, before `fix_multispans_in_extern_macros` // has a chance to replace them. - let has_macro_spans = iter::once(&*span) + let has_macro_spans: Vec<_> = iter::once(&*span) .chain(children.iter().map(|child| &child.span)) .flat_map(|span| span.primary_spans()) .flat_map(|sp| sp.macro_backtrace()) - .find_map(|expn_data| { + .filter_map(|expn_data| { match expn_data.kind { ExpnKind::Root => None, @@ -413,7 +413,8 @@ pub trait Emitter { ExpnKind::Macro(macro_kind, name) => Some((macro_kind, name)), } - }); + }) + .collect(); if !backtrace { self.fix_multispans_in_extern_macros(source_map, span, children); @@ -422,11 +423,22 @@ pub trait Emitter { self.render_multispans_macro_backtrace(span, children, backtrace); if !backtrace { - if let Some((macro_kind, name)) = has_macro_spans { - let descr = macro_kind.descr(); + if let Some((macro_kind, name)) = has_macro_spans.first() { + // Mark the actual macro this originates from + let and_then = if let Some((macro_kind, last_name)) = has_macro_spans.last() + && last_name != name + { + let descr = macro_kind.descr(); + format!( + " which comes from the expansion of the {descr} `{last_name}`", + ) + } else { + "".to_string() + }; + let descr = macro_kind.descr(); let msg = format!( - "this {level} originates in the {descr} `{name}` \ + "this {level} originates in the {descr} `{name}`{and_then} \ (in Nightly builds, run with -Z macro-backtrace for more info)", ); diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index e59a74e380ae3..b173ac0e916b8 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -6,6 +6,7 @@ #![feature(drain_filter)] #![feature(backtrace)] #![feature(if_let_guard)] +#![cfg_attr(bootstrap, feature(let_chains))] #![feature(let_else)] #![feature(never_type)] #![feature(adt_const_params)] diff --git a/src/test/ui/borrowck/borrowck-and-init.stderr b/src/test/ui/borrowck/borrowck-and-init.stderr index 7f3d27d6091d8..5abf07a3118d8 100644 --- a/src/test/ui/borrowck/borrowck-and-init.stderr +++ b/src/test/ui/borrowck/borrowck-and-init.stderr @@ -9,7 +9,7 @@ LL | println!("{}", false && { i = 5; true }); LL | println!("{}", i); | ^ `i` used here but it is possibly-uninitialized | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-break-uninit-2.stderr b/src/test/ui/borrowck/borrowck-break-uninit-2.stderr index 23ea1a2de7fc7..91038b3adca9d 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit-2.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit-2.stderr @@ -7,7 +7,7 @@ LL | let x: isize; LL | println!("{}", x); | ^ `x` used here but it isn't initialized | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-break-uninit.stderr b/src/test/ui/borrowck/borrowck-break-uninit.stderr index 2b9b0a190f6c8..8d0c9582fda92 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit.stderr @@ -7,7 +7,7 @@ LL | let x: isize; LL | println!("{}", x); | ^ `x` used here but it isn't initialized | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-or-init.stderr b/src/test/ui/borrowck/borrowck-or-init.stderr index 0bc24f1b6932f..16d66bf40d109 100644 --- a/src/test/ui/borrowck/borrowck-or-init.stderr +++ b/src/test/ui/borrowck/borrowck-or-init.stderr @@ -9,7 +9,7 @@ LL | println!("{}", false || { i = 5; true }); LL | println!("{}", i); | ^ `i` used here but it is possibly-uninitialized | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-while-break.stderr b/src/test/ui/borrowck/borrowck-while-break.stderr index 44674febf4973..13143d436df8e 100644 --- a/src/test/ui/borrowck/borrowck-while-break.stderr +++ b/src/test/ui/borrowck/borrowck-while-break.stderr @@ -9,7 +9,7 @@ LL | while cond { LL | println!("{}", v); | ^ `v` used here but it is possibly-uninitialized | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/borrowck/issue-24267-flow-exit.stderr b/src/test/ui/borrowck/issue-24267-flow-exit.stderr index d436e8ff9096c..b85e8f216e5df 100644 --- a/src/test/ui/borrowck/issue-24267-flow-exit.stderr +++ b/src/test/ui/borrowck/issue-24267-flow-exit.stderr @@ -7,7 +7,7 @@ LL | loop { x = break; } LL | println!("{}", x); | ^ `x` used here but it isn't initialized | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0381]: used binding `x` isn't initialized --> $DIR/issue-24267-flow-exit.rs:18:20 @@ -18,7 +18,7 @@ LL | for _ in 0..10 { x = continue; } LL | println!("{}", x); | ^ `x` used here but it isn't initialized | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/issue-64453.stderr b/src/test/ui/borrowck/issue-64453.stderr index f3436fbec66a6..1f8a1acb89f50 100644 --- a/src/test/ui/borrowck/issue-64453.stderr +++ b/src/test/ui/borrowck/issue-64453.stderr @@ -5,7 +5,7 @@ LL | static settings_dir: String = format!(""); | ^^^^^^^^^^^ | = help: add `#![feature(const_fmt_arguments_new)]` to the crate attributes to enable - = note: this error originates in the macro `$crate::__export::format_args` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0015]: cannot call non-const fn `format` in statics --> $DIR/issue-64453.rs:4:31 diff --git a/src/test/ui/borrowck/issue-81899.stderr b/src/test/ui/borrowck/issue-81899.stderr index 1acabefb893e3..fd591c7b563b2 100644 --- a/src/test/ui/borrowck/issue-81899.stderr +++ b/src/test/ui/borrowck/issue-81899.stderr @@ -10,7 +10,7 @@ LL | panic!() | the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:12:5 | inside `f::<[closure@$DIR/issue-81899.rs:4:31: 4:34]>` at $SRC_DIR/std/src/panic.rs:LL:COL | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: any use of this value will cause an error --> $DIR/issue-81899.rs:4:23 diff --git a/src/test/ui/borrowck/issue-88434-minimal-example.stderr b/src/test/ui/borrowck/issue-88434-minimal-example.stderr index c7b5d773e8259..a3582e7804157 100644 --- a/src/test/ui/borrowck/issue-88434-minimal-example.stderr +++ b/src/test/ui/borrowck/issue-88434-minimal-example.stderr @@ -10,7 +10,7 @@ LL | panic!() | the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:11:5 | inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28]>` at $SRC_DIR/std/src/panic.rs:LL:COL | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: any use of this value will cause an error --> $DIR/issue-88434-minimal-example.rs:3:21 diff --git a/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr b/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr index f4bb895e6b5a0..a6c65b302db10 100644 --- a/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr +++ b/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr @@ -10,7 +10,7 @@ LL | panic!() | the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:11:5 | inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34]>` at $SRC_DIR/std/src/panic.rs:LL:COL | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: any use of this value will cause an error --> $DIR/issue-88434-removal-index-should-be-less.rs:3:23 diff --git a/src/test/ui/borrowck/move-error-snippets.stderr b/src/test/ui/borrowck/move-error-snippets.stderr index 78f99e9041522..984981ce2ea14 100644 --- a/src/test/ui/borrowck/move-error-snippets.stderr +++ b/src/test/ui/borrowck/move-error-snippets.stderr @@ -12,7 +12,7 @@ LL | let a = $c; LL | sss!(); | ------ in this macro invocation | - = note: this error originates in the macro `aaa` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `aaa` which comes from the expansion of the macro `sss` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr index f6c2190183211..4f41060dc9842 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr @@ -82,7 +82,7 @@ LL | println!("{}", arr[3]); LL | c(); | - mutable borrow later used here | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0502]: cannot borrow `arr` as immutable because it is also borrowed as mutable --> $DIR/arrays.rs:73:24 diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/box.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/box.stderr index 29228d85324ef..f8b178752351a 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/box.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/box.stderr @@ -26,7 +26,7 @@ LL | LL | c(); | - mutable borrow later used here | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0506]: cannot assign to `e.0.0.m.x` because it is borrowed --> $DIR/box.rs:55:5 diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr index 8629837ba8d34..93abbecf4e46d 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr @@ -9,7 +9,7 @@ LL | println!("{}", foo.x); = note: for more information, see issue #82523 = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error @@ -25,5 +25,5 @@ LL | println!("{}", foo.x); = note: for more information, see issue #82523 = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/simple-struct-min-capture.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/simple-struct-min-capture.stderr index 4f9fdbd368a88..06157b2af7a07 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/simple-struct-min-capture.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/simple-struct-min-capture.stderr @@ -14,7 +14,7 @@ LL | LL | c(); | - mutable borrow later used here | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/bad-format-args.stderr b/src/test/ui/codemap_tests/bad-format-args.stderr index ba056cccf997d..8f79beaa9e1b7 100644 --- a/src/test/ui/codemap_tests/bad-format-args.stderr +++ b/src/test/ui/codemap_tests/bad-format-args.stderr @@ -4,7 +4,7 @@ error: requires at least a format string argument LL | format!(); | ^^^^^^^^^ | - = note: this error originates in the macro `$crate::__export::format_args` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected `,`, found `1` --> $DIR/bad-format-args.rs:3:16 diff --git a/src/test/ui/codemap_tests/tab_3.stderr b/src/test/ui/codemap_tests/tab_3.stderr index ceb91142ac826..9072cc925ffff 100644 --- a/src/test/ui/codemap_tests/tab_3.stderr +++ b/src/test/ui/codemap_tests/tab_3.stderr @@ -14,7 +14,7 @@ note: this function takes ownership of the receiver `self`, which moves `some_ve | LL | fn into_iter(self) -> Self::IntoIter; | ^^^^ - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/conditional_array_execution.stderr b/src/test/ui/consts/const-eval/conditional_array_execution.stderr index 2312e2a45db5b..2953406ee4057 100644 --- a/src/test/ui/consts/const-eval/conditional_array_execution.stderr +++ b/src/test/ui/consts/const-eval/conditional_array_execution.stderr @@ -26,7 +26,7 @@ LL | println!("{}", FOO); | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 - = note: this warning originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error; 2 warnings emitted @@ -60,5 +60,5 @@ LL | #![warn(const_err)] | ^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 - = note: this warning originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/const-eval/const_panic.stderr b/src/test/ui/consts/const-eval/const_panic.stderr index 2955f11716c41..0f7be46072df5 100644 --- a/src/test/ui/consts/const-eval/const_panic.stderr +++ b/src/test/ui/consts/const-eval/const_panic.stderr @@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed LL | const Z: () = std::panic!("cheese"); | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic.rs:6:15 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:9:16 @@ -12,7 +12,7 @@ error[E0080]: evaluation of constant value failed LL | const Z2: () = std::panic!(); | ^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:9:16 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:12:15 @@ -20,7 +20,7 @@ error[E0080]: evaluation of constant value failed LL | const Y: () = std::unreachable!(); | ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:12:15 | - = note: this error originates in the macro `$crate::panic::unreachable_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::unreachable_2015` which comes from the expansion of the macro `std::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:15:15 @@ -36,7 +36,7 @@ error[E0080]: evaluation of constant value failed LL | const W: () = std::panic!(MSG); | ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:18:15 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:21:16 @@ -44,7 +44,7 @@ error[E0080]: evaluation of constant value failed LL | const W2: () = std::panic!("{}", MSG); | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:21:16 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:24:20 @@ -52,7 +52,7 @@ error[E0080]: evaluation of constant value failed LL | const Z_CORE: () = core::panic!("cheese"); | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic.rs:24:20 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:27:21 @@ -60,7 +60,7 @@ error[E0080]: evaluation of constant value failed LL | const Z2_CORE: () = core::panic!(); | ^^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:27:21 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:30:20 @@ -68,7 +68,7 @@ error[E0080]: evaluation of constant value failed LL | const Y_CORE: () = core::unreachable!(); | ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:30:20 | - = note: this error originates in the macro `$crate::panic::unreachable_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::unreachable_2015` which comes from the expansion of the macro `core::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:33:20 @@ -84,7 +84,7 @@ error[E0080]: evaluation of constant value failed LL | const W_CORE: () = core::panic!(MSG); | ^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:36:20 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:39:21 @@ -92,7 +92,7 @@ error[E0080]: evaluation of constant value failed LL | const W2_CORE: () = core::panic!("{}", MSG); | ^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:39:21 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 12 previous errors diff --git a/src/test/ui/consts/const-eval/const_panic_2021.stderr b/src/test/ui/consts/const-eval/const_panic_2021.stderr index cb3b08e0e0999..192fa3a12c25c 100644 --- a/src/test/ui/consts/const-eval/const_panic_2021.stderr +++ b/src/test/ui/consts/const-eval/const_panic_2021.stderr @@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed LL | const A: () = std::panic!("blåhaj"); | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'blåhaj', $DIR/const_panic_2021.rs:6:15 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:9:15 @@ -12,7 +12,7 @@ error[E0080]: evaluation of constant value failed LL | const B: () = std::panic!(); | ^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic_2021.rs:9:15 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:12:15 @@ -20,7 +20,7 @@ error[E0080]: evaluation of constant value failed LL | const C: () = std::unreachable!(); | ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_2021.rs:12:15 | - = note: this error originates in the macro `$crate::panic::unreachable_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::unreachable_2021` which comes from the expansion of the macro `std::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:15:15 @@ -36,7 +36,7 @@ error[E0080]: evaluation of constant value failed LL | const E: () = std::panic!("{}", MSG); | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic_2021.rs:18:15 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `std::panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:21:20 @@ -44,7 +44,7 @@ error[E0080]: evaluation of constant value failed LL | const A_CORE: () = core::panic!("shark"); | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'shark', $DIR/const_panic_2021.rs:21:20 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:24:20 @@ -52,7 +52,7 @@ error[E0080]: evaluation of constant value failed LL | const B_CORE: () = core::panic!(); | ^^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic_2021.rs:24:20 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:27:20 @@ -60,7 +60,7 @@ error[E0080]: evaluation of constant value failed LL | const C_CORE: () = core::unreachable!(); | ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_2021.rs:27:20 | - = note: this error originates in the macro `$crate::panic::unreachable_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::unreachable_2021` which comes from the expansion of the macro `core::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:30:20 @@ -76,7 +76,7 @@ error[E0080]: evaluation of constant value failed LL | const E_CORE: () = core::panic!("{}", MSG); | ^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic_2021.rs:33:20 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `core::panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 10 previous errors diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr b/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr index 417120c453e92..df19ed4a89861 100644 --- a/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr +++ b/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr @@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed LL | const Z: () = panic!("cheese"); | ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_bin.rs:8:15 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_libcore_bin.rs:11:15 @@ -12,7 +12,7 @@ error[E0080]: evaluation of constant value failed LL | const Y: () = unreachable!(); | ^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_bin.rs:11:15 | - = note: this error originates in the macro `$crate::panic::unreachable_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::unreachable_2015` which comes from the expansion of the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_libcore_bin.rs:14:15 diff --git a/src/test/ui/consts/const-eval/format.stderr b/src/test/ui/consts/const-eval/format.stderr index b00cadcea991f..a476b0f587fe1 100644 --- a/src/test/ui/consts/const-eval/format.stderr +++ b/src/test/ui/consts/const-eval/format.stderr @@ -5,7 +5,7 @@ LL | panic!("{:?}", 0); | ^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = note: this error originates in the macro `$crate::const_format_args` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0015]: cannot call non-const formatting macro in constant functions --> $DIR/format.rs:11:22 @@ -14,7 +14,7 @@ LL | println!("{:?}", 0); | ^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: `Arguments::<'a>::new_v1` is not yet stable as a const fn --> $DIR/format.rs:11:5 @@ -23,7 +23,7 @@ LL | println!("{:?}", 0); | ^^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(const_fmt_arguments_new)]` to the crate attributes to enable - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0015]: cannot call non-const fn `_print` in constant functions --> $DIR/format.rs:11:5 @@ -52,7 +52,7 @@ LL | panic!("{:?}", 0); | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 - = note: this error originates in the macro `$crate::const_format_args` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: erroneous constant used --> $DIR/format.rs:11:14 @@ -71,7 +71,7 @@ LL | println!("{:?}", 0); | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 8 previous errors @@ -97,7 +97,7 @@ LL | panic!("{:?}", 0); = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 - = note: this error originates in the macro `$crate::const_format_args` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: error: erroneous constant used @@ -120,5 +120,5 @@ LL | println!("{:?}", 0); = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/const-eval/issue-43197.stderr b/src/test/ui/consts/const-eval/issue-43197.stderr index 91065f4168256..3f67c38f82e01 100644 --- a/src/test/ui/consts/const-eval/issue-43197.stderr +++ b/src/test/ui/consts/const-eval/issue-43197.stderr @@ -35,7 +35,7 @@ LL | println!("{} {}", X, Y); | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 - = note: this warning originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/issue-43197.rs:16:26 @@ -51,7 +51,7 @@ LL | println!("{} {}", X, Y); | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 - = note: this warning originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors; 4 warnings emitted @@ -100,7 +100,7 @@ LL | #![warn(const_err)] | ^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 - = note: this warning originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: warning: erroneous constant used @@ -116,5 +116,5 @@ LL | #![warn(const_err)] | ^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 - = note: this warning originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/const-eval/issue-44578.stderr b/src/test/ui/consts/const-eval/issue-44578.stderr index 81e563b4f5460..4c27ceea19bd0 100644 --- a/src/test/ui/consts/const-eval/issue-44578.stderr +++ b/src/test/ui/consts/const-eval/issue-44578.stderr @@ -36,5 +36,5 @@ LL | #![allow(const_err)] | ^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 - = note: this warning originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/const-eval/issue-85907.stderr b/src/test/ui/consts/const-eval/issue-85907.stderr index 381f2fd1114ec..fd7b40572c1bb 100644 --- a/src/test/ui/consts/const-eval/issue-85907.stderr +++ b/src/test/ui/consts/const-eval/issue-85907.stderr @@ -4,7 +4,7 @@ error: argument to `panic!()` in a const context must have type `&str` LL | panic!(123); | ^^^^^^^^^^^ | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr index 0116a83910d6c..b26286411d2d6 100644 --- a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr +++ b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr @@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed LL | const VOID: ! = panic!(); | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:10:21 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: erroneous constant used --> $DIR/panic-assoc-never-type.rs:15:13 diff --git a/src/test/ui/consts/const-eval/panic-never-type.stderr b/src/test/ui/consts/const-eval/panic-never-type.stderr index 8f312d673a175..9728aed07223c 100644 --- a/src/test/ui/consts/const-eval/panic-never-type.stderr +++ b/src/test/ui/consts/const-eval/panic-never-type.stderr @@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed LL | const VOID: ! = panic!(); | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:5:17 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/unwind-abort.stderr b/src/test/ui/consts/const-eval/unwind-abort.stderr index 78ebd36abd86b..99178ae8c83d1 100644 --- a/src/test/ui/consts/const-eval/unwind-abort.stderr +++ b/src/test/ui/consts/const-eval/unwind-abort.stderr @@ -10,7 +10,7 @@ LL | panic!() LL | const _: () = foo(); | ----- inside `_` at $DIR/unwind-abort.rs:7:15 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/consts/const-float-bits-reject-conv.stderr b/src/test/ui/consts/const-float-bits-reject-conv.stderr index b77c6591d4975..d6e993a10101d 100644 --- a/src/test/ui/consts/const-float-bits-reject-conv.stderr +++ b/src/test/ui/consts/const-float-bits-reject-conv.stderr @@ -25,7 +25,7 @@ LL | called_in_const.call_once(arg) LL | const MASKED_NAN1: u32 = f32::NAN.to_bits() ^ 0x002A_AAAA; | ------------------ inside `f32::MASKED_NAN1` at $DIR/const-float-bits-reject-conv.rs:27:30 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/num/f32.rs:LL:COL @@ -54,7 +54,7 @@ LL | called_in_const.call_once(arg) LL | const MASKED_NAN2: u32 = f32::NAN.to_bits() ^ 0x0055_5555; | ------------------ inside `f32::MASKED_NAN2` at $DIR/const-float-bits-reject-conv.rs:28:30 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:30:34 @@ -132,7 +132,7 @@ LL | called_in_const.call_once(arg) LL | const MASKED_NAN1: u64 = f64::NAN.to_bits() ^ 0x000A_AAAA_AAAA_AAAA; | ------------------ inside `f64::MASKED_NAN1` at $DIR/const-float-bits-reject-conv.rs:54:30 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/num/f64.rs:LL:COL @@ -161,7 +161,7 @@ LL | called_in_const.call_once(arg) LL | const MASKED_NAN2: u64 = f64::NAN.to_bits() ^ 0x0005_5555_5555_5555; | ------------------ inside `f64::MASKED_NAN2` at $DIR/const-float-bits-reject-conv.rs:55:30 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: any use of this value will cause an error --> $DIR/const-float-bits-reject-conv.rs:57:34 diff --git a/src/test/ui/consts/issue-32829.stderr b/src/test/ui/consts/issue-32829.stderr index 6155c935a5f6c..cae5163f0df92 100644 --- a/src/test/ui/consts/issue-32829.stderr +++ b/src/test/ui/consts/issue-32829.stderr @@ -4,7 +4,7 @@ error[E0080]: could not evaluate static initializer LL | static S : u64 = { { panic!("foo"); 0 } }; | ^^^^^^^^^^^^^ the evaluated program panicked at 'foo', $DIR/issue-32829.rs:1:22 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/consts/issue-66693-panic-in-array-len.stderr b/src/test/ui/consts/issue-66693-panic-in-array-len.stderr index 4ccbeb73c8a25..1585ea317d9b1 100644 --- a/src/test/ui/consts/issue-66693-panic-in-array-len.stderr +++ b/src/test/ui/consts/issue-66693-panic-in-array-len.stderr @@ -4,7 +4,7 @@ error: argument to `panic!()` in a const context must have type `&str` LL | let _ = [0i32; panic!(2f32)]; | ^^^^^^^^^^^^ | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/issue-66693-panic-in-array-len.rs:10:21 @@ -12,7 +12,7 @@ error[E0080]: evaluation of constant value failed LL | let _ = [false; panic!()]; | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-66693-panic-in-array-len.rs:10:21 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/issue-66693.stderr b/src/test/ui/consts/issue-66693.stderr index 929f905ae918b..5460cc1ee82a4 100644 --- a/src/test/ui/consts/issue-66693.stderr +++ b/src/test/ui/consts/issue-66693.stderr @@ -4,7 +4,7 @@ error: argument to `panic!()` in a const context must have type `&str` LL | const _: () = panic!(1); | ^^^^^^^^^ | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: argument to `panic!()` in a const context must have type `&str` --> $DIR/issue-66693.rs:7:19 @@ -12,7 +12,7 @@ error: argument to `panic!()` in a const context must have type `&str` LL | static _FOO: () = panic!(true); | ^^^^^^^^^^^^ | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: argument to `panic!()` in a const context must have type `&str` --> $DIR/issue-66693.rs:11:5 @@ -20,7 +20,7 @@ error: argument to `panic!()` in a const context must have type `&str` LL | panic!(&1); | ^^^^^^^^^^ | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: erroneous constant used --> $DIR/issue-66693.rs:11:12 diff --git a/src/test/ui/consts/issue-76064.stderr b/src/test/ui/consts/issue-76064.stderr index ef9d140536a3d..67b2e90db7508 100644 --- a/src/test/ui/consts/issue-76064.stderr +++ b/src/test/ui/consts/issue-76064.stderr @@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed LL | struct Bug([u8; panic!("panic")]); | ^^^^^^^^^^^^^^^ the evaluated program panicked at 'panic', $DIR/issue-76064.rs:1:17 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/cross/cross-crate-macro-backtrace/main.stderr b/src/test/ui/cross/cross-crate-macro-backtrace/main.stderr index 6e2a1d3bbc4df..5bd4ea97e9cd2 100644 --- a/src/test/ui/cross/cross-crate-macro-backtrace/main.stderr +++ b/src/test/ui/cross/cross-crate-macro-backtrace/main.stderr @@ -4,7 +4,7 @@ error: 1 positional argument in format string, but no arguments were given LL | myprintln!("{}"); | ^^^^^^^^^^^^^^^^ | - = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `concat` which comes from the expansion of the macro `myprintln` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/expr/if/if-let.stderr b/src/test/ui/expr/if/if-let.stderr index 3f3a224583424..8238b3f0e4971 100644 --- a/src/test/ui/expr/if/if-let.stderr +++ b/src/test/ui/expr/if/if-let.stderr @@ -27,7 +27,7 @@ LL | | }); | = note: this pattern will always match, so the `if let` is useless = help: consider replacing the `if let` with a `let` - = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this warning originates in the macro `foo` which comes from the expansion of the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) warning: irrefutable `if let` pattern --> $DIR/if-let.rs:26:8 diff --git a/src/test/ui/fmt/ifmt-bad-arg.stderr b/src/test/ui/fmt/ifmt-bad-arg.stderr index c25da900951cc..d181fe14107e7 100644 --- a/src/test/ui/fmt/ifmt-bad-arg.stderr +++ b/src/test/ui/fmt/ifmt-bad-arg.stderr @@ -308,7 +308,7 @@ note: associated function defined here | LL | pub fn from_usize(x: &usize) -> ArgumentV1<'_> { | ^^^^^^^^^^ - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types --> $DIR/ifmt-bad-arg.rs:81:35 @@ -326,7 +326,7 @@ note: associated function defined here | LL | pub fn from_usize(x: &usize) -> ArgumentV1<'_> { | ^^^^^^^^^^ - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 36 previous errors diff --git a/src/test/ui/fmt/ifmt-unimpl.stderr b/src/test/ui/fmt/ifmt-unimpl.stderr index 5204afa4e6bc5..dbcb2eb6693dd 100644 --- a/src/test/ui/fmt/ifmt-unimpl.stderr +++ b/src/test/ui/fmt/ifmt-unimpl.stderr @@ -20,7 +20,7 @@ note: required by a bound in `ArgumentV1::<'a>::new_upper_hex` | LL | arg_new!(new_upper_hex, UpperHex); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ArgumentV1::<'a>::new_upper_hex` - = note: this error originates in the macro `$crate::__export::format_args` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `arg_new` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/for-loop-while/while-let-2.stderr b/src/test/ui/for-loop-while/while-let-2.stderr index cb1abd435710e..2d23a637361ec 100644 --- a/src/test/ui/for-loop-while/while-let-2.stderr +++ b/src/test/ui/for-loop-while/while-let-2.stderr @@ -27,7 +27,7 @@ LL | | }); | = note: this pattern will always match, so the loop will never exit = help: consider instead using a `loop { ... }` with a `let` inside it - = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this warning originates in the macro `foo` which comes from the expansion of the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) warning: irrefutable `while let` pattern --> $DIR/while-let-2.rs:27:11 diff --git a/src/test/ui/generator/yield-while-ref-reborrowed.stderr b/src/test/ui/generator/yield-while-ref-reborrowed.stderr index 67cd1f64d94aa..47147f9c05d78 100644 --- a/src/test/ui/generator/yield-while-ref-reborrowed.stderr +++ b/src/test/ui/generator/yield-while-ref-reborrowed.stderr @@ -11,7 +11,7 @@ LL | println!("{}", x); LL | Pin::new(&mut b).resume(()); | ------ first borrow later used here | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/internal/internal-unstable.stderr b/src/test/ui/internal/internal-unstable.stderr index b973ea67bf7a3..f0f9bfb8d234f 100644 --- a/src/test/ui/internal/internal-unstable.stderr +++ b/src/test/ui/internal/internal-unstable.stderr @@ -40,7 +40,7 @@ LL | bar!(internal_unstable::unstable()); | ----------------------------------- in this macro invocation | = help: add `#![feature(function)]` to the crate attributes to enable - = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `foo` which comes from the expansion of the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 5 previous errors diff --git a/src/test/ui/issues/issue-16966.stderr b/src/test/ui/issues/issue-16966.stderr index 6eb56ca5516bf..8524a62a0a42d 100644 --- a/src/test/ui/issues/issue-16966.stderr +++ b/src/test/ui/issues/issue-16966.stderr @@ -4,7 +4,7 @@ error[E0282]: type annotations needed LL | panic!(std::default::Default::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `M` declared on the function `begin_panic` | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider specifying the generic argument --> $SRC_DIR/std/src/panic.rs:LL:COL | diff --git a/src/test/ui/issues/issue-42796.stderr b/src/test/ui/issues/issue-42796.stderr index 4a1debf37a079..f3e0e7b20a178 100644 --- a/src/test/ui/issues/issue-42796.stderr +++ b/src/test/ui/issues/issue-42796.stderr @@ -9,7 +9,7 @@ LL | let mut s_copy = s; LL | println!("{}", s); | ^ value borrowed here after move | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/issues/issue-47646.stderr b/src/test/ui/issues/issue-47646.stderr index 4e28874e140a4..84cf9237a56d2 100644 --- a/src/test/ui/issues/issue-47646.stderr +++ b/src/test/ui/issues/issue-47646.stderr @@ -13,7 +13,7 @@ LL | println!("{:?}", heap); LL | }; | - ... and the mutable borrow might be used here, when that temporary is dropped and runs the destructor for type `(Option>, ())` | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/issues/issue-69455.stderr b/src/test/ui/issues/issue-69455.stderr index 9be6c2f8564ff..b732df764e57f 100644 --- a/src/test/ui/issues/issue-69455.stderr +++ b/src/test/ui/issues/issue-69455.stderr @@ -4,7 +4,7 @@ error[E0282]: type annotations needed LL | println!("{}", 23u64.test(xs.iter().sum())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the associated function `new_display` | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider specifying the generic argument | LL | println!("{}", 23u64.test(xs.iter().sum())::); diff --git a/src/test/ui/limits/issue-55878.stderr b/src/test/ui/limits/issue-55878.stderr index 1402d1387037e..6c3683d78961d 100644 --- a/src/test/ui/limits/issue-55878.stderr +++ b/src/test/ui/limits/issue-55878.stderr @@ -18,7 +18,7 @@ LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors @@ -33,5 +33,5 @@ LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #71800 - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/liveness/liveness-move-in-while.stderr b/src/test/ui/liveness/liveness-move-in-while.stderr index ff6c02f2110f6..b04a05fe40906 100644 --- a/src/test/ui/liveness/liveness-move-in-while.stderr +++ b/src/test/ui/liveness/liveness-move-in-while.stderr @@ -29,7 +29,7 @@ LL | println!("{}", y); LL | while true { while true { while true { x = y; x.clone(); } } } | - value moved here, in previous iteration of loop | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error; 3 warnings emitted diff --git a/src/test/ui/liveness/liveness-use-after-move.stderr b/src/test/ui/liveness/liveness-use-after-move.stderr index f7d131109ea8f..218b93c8e4f45 100644 --- a/src/test/ui/liveness/liveness-use-after-move.stderr +++ b/src/test/ui/liveness/liveness-use-after-move.stderr @@ -9,7 +9,7 @@ LL | LL | println!("{}", *x); | ^^ value borrowed here after move | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/liveness/liveness-use-after-send.stderr b/src/test/ui/liveness/liveness-use-after-send.stderr index becede1ceb6b3..8edc0463fe571 100644 --- a/src/test/ui/liveness/liveness-use-after-send.stderr +++ b/src/test/ui/liveness/liveness-use-after-send.stderr @@ -8,7 +8,7 @@ LL | send(ch, message); LL | println!("{}", message); | ^^^^^^^ value borrowed here after move | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/loops/loop-proper-liveness.stderr b/src/test/ui/loops/loop-proper-liveness.stderr index 7504103173652..14e86aee059b2 100644 --- a/src/test/ui/loops/loop-proper-liveness.stderr +++ b/src/test/ui/loops/loop-proper-liveness.stderr @@ -7,7 +7,7 @@ LL | let x: i32; LL | println!("{:?}", x); | ^ `x` used here but it isn't initialized | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/macro_backtrace/main.default.stderr b/src/test/ui/macro_backtrace/main.default.stderr index fa9b4090ddfd3..9ed4b3525e1d0 100644 --- a/src/test/ui/macro_backtrace/main.default.stderr +++ b/src/test/ui/macro_backtrace/main.default.stderr @@ -18,7 +18,7 @@ LL | () => { syntax error }; LL | ping!(); | ------- in this macro invocation | - = note: this error originates in the macro `pong` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `pong` which comes from the expansion of the macro `ping` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` --> $DIR/main.rs:10:20 @@ -29,7 +29,7 @@ LL | () => { syntax error }; LL | deep!(); | ------- in this macro invocation | - = note: this error originates in the macro `pong` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `pong` which comes from the expansion of the macro `deep` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/src/test/ui/macros/format-parse-errors.stderr b/src/test/ui/macros/format-parse-errors.stderr index c0e766681fed6..1a7578e6076eb 100644 --- a/src/test/ui/macros/format-parse-errors.stderr +++ b/src/test/ui/macros/format-parse-errors.stderr @@ -4,7 +4,7 @@ error: requires at least a format string argument LL | format!(); | ^^^^^^^^^ | - = note: this error originates in the macro `$crate::__export::format_args` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) error: expected expression, found keyword `struct` --> $DIR/format-parse-errors.rs:5:13 diff --git a/src/test/ui/macros/macro-backtrace-nested.stderr b/src/test/ui/macros/macro-backtrace-nested.stderr index 38b52e1a12909..dadedfbe8f671 100644 --- a/src/test/ui/macros/macro-backtrace-nested.stderr +++ b/src/test/ui/macros/macro-backtrace-nested.stderr @@ -7,7 +7,7 @@ LL | () => (fake) LL | 1 + call_nested_expr!(); | ------------------- in this macro invocation | - = note: this error originates in the macro `nested_expr` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `nested_expr` which comes from the expansion of the macro `call_nested_expr` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `fake` in this scope --> $DIR/macro-backtrace-nested.rs:5:12 @@ -18,7 +18,7 @@ LL | () => (fake) LL | call_nested_expr_sum!(); | ----------------------- in this macro invocation | - = note: this error originates in the macro `nested_expr` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `nested_expr` which comes from the expansion of the macro `call_nested_expr_sum` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/src/test/ui/macros/macro-backtrace-println.stderr b/src/test/ui/macros/macro-backtrace-println.stderr index bc00e0db83ed5..b4e2883e83716 100644 --- a/src/test/ui/macros/macro-backtrace-println.stderr +++ b/src/test/ui/macros/macro-backtrace-println.stderr @@ -7,7 +7,7 @@ LL | ($fmt:expr) => (myprint!(concat!($fmt, "\n"))); LL | myprintln!("{}"); | ---------------- in this macro invocation | - = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `concat` which comes from the expansion of the macro `myprintln` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/macros/macro-local-data-key-priv.stderr b/src/test/ui/macros/macro-local-data-key-priv.stderr index b449e34736820..fb8cab2794bc6 100644 --- a/src/test/ui/macros/macro-local-data-key-priv.stderr +++ b/src/test/ui/macros/macro-local-data-key-priv.stderr @@ -9,7 +9,7 @@ note: the constant `baz` is defined here | LL | thread_local!(static baz: f64 = 0.0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the macro `$crate::__thread_local_inner` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::__thread_local_inner` which comes from the expansion of the macro `thread_local` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/macros/restricted-shadowing-legacy.stderr b/src/test/ui/macros/restricted-shadowing-legacy.stderr index 99b27a5cab123..b8865112ed52e 100644 --- a/src/test/ui/macros/restricted-shadowing-legacy.stderr +++ b/src/test/ui/macros/restricted-shadowing-legacy.stderr @@ -24,7 +24,7 @@ LL | macro_rules! m { () => {} } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_gen_inner_invoc` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `gen_gen_inner_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-legacy.rs:139:42 @@ -52,7 +52,7 @@ LL | macro_rules! m { () => {} } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_invoc` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `gen_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-legacy.rs:148:9 @@ -136,7 +136,7 @@ LL | macro_rules! m { () => { Wrong } } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_gen_inner_invoc` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `gen_gen_inner_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-legacy.rs:218:42 @@ -164,7 +164,7 @@ LL | macro_rules! m { () => { Wrong } } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_invoc` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `gen_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-legacy.rs:232:9 @@ -220,7 +220,7 @@ LL | macro_rules! m { () => {} } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_invoc` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `gen_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 8 previous errors diff --git a/src/test/ui/macros/restricted-shadowing-modern.stderr b/src/test/ui/macros/restricted-shadowing-modern.stderr index b169e63132e45..27665bfc31044 100644 --- a/src/test/ui/macros/restricted-shadowing-modern.stderr +++ b/src/test/ui/macros/restricted-shadowing-modern.stderr @@ -24,7 +24,7 @@ LL | macro m() {} ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_gen_inner_invoc` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `gen_gen_inner_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-modern.rs:147:33 @@ -52,7 +52,7 @@ LL | macro m() {} ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_invoc` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `gen_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-modern.rs:156:13 @@ -136,7 +136,7 @@ LL | macro m() { Wrong } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_gen_inner_invoc` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `gen_gen_inner_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `m` is ambiguous --> $DIR/restricted-shadowing-modern.rs:233:33 @@ -164,7 +164,7 @@ LL | macro m() { Wrong } ... LL | include!(); | ---------- in this macro invocation - = note: this error originates in the macro `gen_invoc` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `gen_invoc` which comes from the expansion of the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 6 previous errors diff --git a/src/test/ui/macros/unreachable-format-args.edition_2015.stderr b/src/test/ui/macros/unreachable-format-args.edition_2015.stderr index dda45d14a3f1b..2cc2e134bfdf6 100644 --- a/src/test/ui/macros/unreachable-format-args.edition_2015.stderr +++ b/src/test/ui/macros/unreachable-format-args.edition_2015.stderr @@ -6,7 +6,7 @@ LL | unreachable!("x is {x} and y is {y}", y = 0); | = note: did you intend to capture a variable `x` from the surrounding scope? = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro - = note: this error originates in the macro `$crate::concat` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::concat` which comes from the expansion of the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr index ac921c18e07d5..34b7ea6586718 100644 --- a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr +++ b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr @@ -11,7 +11,7 @@ LL | }); LL | println!("{}", x); | ^ value borrowed here after move | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/on-unimplemented/no-debug.stderr b/src/test/ui/on-unimplemented/no-debug.stderr index 417e01e491b47..1035da54d8a77 100644 --- a/src/test/ui/on-unimplemented/no-debug.stderr +++ b/src/test/ui/on-unimplemented/no-debug.stderr @@ -6,7 +6,7 @@ LL | println!("{:?} {:?}", Foo, Bar); | = help: the trait `Debug` is not implemented for `Foo` = note: add `#[derive(Debug)]` to `Foo` or manually `impl Debug for Foo` - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Foo` with `#[derive(Debug)]` | LL | #[derive(Debug)] @@ -19,7 +19,7 @@ LL | println!("{:?} {:?}", Foo, Bar); | ^^^ `Bar` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = help: the trait `Debug` is not implemented for `Bar` - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `Foo` doesn't implement `std::fmt::Display` --> $DIR/no-debug.rs:11:23 @@ -29,7 +29,7 @@ LL | println!("{} {}", Foo, Bar); | = help: the trait `std::fmt::Display` is not implemented for `Foo` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `Bar` doesn't implement `std::fmt::Display` --> $DIR/no-debug.rs:11:28 @@ -39,7 +39,7 @@ LL | println!("{} {}", Foo, Bar); | = help: the trait `std::fmt::Display` is not implemented for `Bar` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/macro/pub-item-macro.stderr b/src/test/ui/parser/macro/pub-item-macro.stderr index 4f82acf38e109..9a2fffcced553 100644 --- a/src/test/ui/parser/macro/pub-item-macro.stderr +++ b/src/test/ui/parser/macro/pub-item-macro.stderr @@ -24,7 +24,7 @@ LL | static x: u32 = 0; ... LL | pub_x!(); | -------- in this macro invocation - = note: this error originates in the macro `priv_x` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `priv_x` which comes from the expansion of the macro `pub_x` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/src/test/ui/proc-macro/mixed-site-span.stderr b/src/test/ui/proc-macro/mixed-site-span.stderr index 60f082d177a9e..eab4317ded85d 100644 --- a/src/test/ui/proc-macro/mixed-site-span.stderr +++ b/src/test/ui/proc-macro/mixed-site-span.stderr @@ -26,7 +26,7 @@ error[E0412]: cannot find type `ItemUse` in crate `$crate` LL | pass_dollar_crate!(); | ^^^^^^^^^^^^^^^^^^^^ not found in `$crate` | - = note: this error originates in the macro `proc_macro_rules` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `proc_macro_rules` which comes from the expansion of the macro `pass_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 4 previous errors diff --git a/src/test/ui/proc-macro/parent-source-spans.stderr b/src/test/ui/proc-macro/parent-source-spans.stderr index 3c46b95cbc685..65ce24e552296 100644 --- a/src/test/ui/proc-macro/parent-source-spans.stderr +++ b/src/test/ui/proc-macro/parent-source-spans.stderr @@ -7,7 +7,7 @@ LL | three!($a, $b); LL | one!("hello", "world"); | ---------------------- in this macro invocation | - = note: this error originates in the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `two` which comes from the expansion of the macro `one` (in Nightly builds, run with -Z macro-backtrace for more info) error: second final: "world" --> $DIR/parent-source-spans.rs:16:16 @@ -18,7 +18,7 @@ LL | three!($a, $b); LL | one!("hello", "world"); | ---------------------- in this macro invocation | - = note: this error originates in the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `two` which comes from the expansion of the macro `one` (in Nightly builds, run with -Z macro-backtrace for more info) error: first parent: "hello" --> $DIR/parent-source-spans.rs:10:5 @@ -150,7 +150,7 @@ LL | one!("hello", "world"); LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), | -- similarly named tuple variant `Ok` defined here | - = note: this error originates in the macro `parent_source_spans` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `parent_source_spans` which comes from the expansion of the macro `one` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `ok` in this scope --> $DIR/parent-source-spans.rs:29:5 @@ -166,7 +166,7 @@ LL | two!("yay", "rust"); LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), | -- similarly named tuple variant `Ok` defined here | - = note: this error originates in the macro `parent_source_spans` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `parent_source_spans` which comes from the expansion of the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `ok` in this scope --> $DIR/parent-source-spans.rs:29:5 @@ -182,7 +182,7 @@ LL | three!("hip", "hop"); LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), | -- similarly named tuple variant `Ok` defined here | - = note: this error originates in the macro `parent_source_spans` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `parent_source_spans` which comes from the expansion of the macro `three` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 21 previous errors diff --git a/src/test/ui/proc-macro/weird-hygiene.stderr b/src/test/ui/proc-macro/weird-hygiene.stderr index b4e7fe444acce..256e68e8970e6 100644 --- a/src/test/ui/proc-macro/weird-hygiene.stderr +++ b/src/test/ui/proc-macro/weird-hygiene.stderr @@ -7,7 +7,7 @@ LL | Value = (stringify!($tokens + hidden_ident), 1).1 LL | other!(50); | ---------- in this macro invocation | - = note: this error originates in the macro `inner` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `inner` which comes from the expansion of the macro `other` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `hidden_ident` in this scope --> $DIR/weird-hygiene.rs:34:13 diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr index ea1f66d78a378..d8b5a9e63643d 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr @@ -6,7 +6,7 @@ LL | let _: NotDebug = dbg!(NotDebug); | = help: the trait `Debug` is not implemented for `NotDebug` = note: add `#[derive(Debug)]` to `NotDebug` or manually `impl Debug for NotDebug` - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `NotDebug` with `#[derive(Debug)]` | LL | #[derive(Debug)] diff --git a/src/test/ui/suggestions/bound-suggestions.stderr b/src/test/ui/suggestions/bound-suggestions.stderr index e5e19444d2435..d53715937f7d8 100644 --- a/src/test/ui/suggestions/bound-suggestions.stderr +++ b/src/test/ui/suggestions/bound-suggestions.stderr @@ -4,7 +4,7 @@ error[E0277]: `impl Sized` doesn't implement `Debug` LL | println!("{:?}", t); | ^ `impl Sized` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting this bound | LL | fn test_impl(t: impl Sized + std::fmt::Debug) { @@ -16,7 +16,7 @@ error[E0277]: `T` doesn't implement `Debug` LL | println!("{:?}", t); | ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | LL | fn test_no_bounds(t: T) { @@ -28,7 +28,7 @@ error[E0277]: `T` doesn't implement `Debug` LL | println!("{:?}", t); | ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting this bound | LL | fn test_one_bound(t: T) { @@ -40,7 +40,7 @@ error[E0277]: `Y` doesn't implement `Debug` LL | println!("{:?} {:?}", x, y); | ^ `Y` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting type parameter `Y` | LL | fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { @@ -52,7 +52,7 @@ error[E0277]: `X` doesn't implement `Debug` LL | println!("{:?}", x); | ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting this bound | LL | fn test_one_bound_where(x: X) where X: Sized + std::fmt::Debug { @@ -64,7 +64,7 @@ error[E0277]: `X` doesn't implement `Debug` LL | println!("{:?}", x); | ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting this bound | LL | fn test_many_bounds_where(x: X) where X: Sized + std::fmt::Debug, X: Sized { diff --git a/src/test/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr b/src/test/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr index 3599d53d2a11f..5dc4e64446fb2 100644 --- a/src/test/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr +++ b/src/test/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr @@ -6,7 +6,7 @@ LL | | "abc" LL | | }; | |_____^ expected `&str`, found struct `String` | - = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `format` which comes from the expansion of the macro `intrinsic_match` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/suggestions/issue-97760.stderr b/src/test/ui/suggestions/issue-97760.stderr index 459556bddaee5..bbcc3693fff5a 100644 --- a/src/test/ui/suggestions/issue-97760.stderr +++ b/src/test/ui/suggestions/issue-97760.stderr @@ -6,7 +6,7 @@ LL | println!("{x}"); | = help: the trait `std::fmt::Display` is not implemented for `::Item` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) help: introduce a type parameter with a trait bound instead of using `impl Trait` | LL ~ pub fn print_values(values: &I) diff --git a/src/test/ui/suggestions/path-display.stderr b/src/test/ui/suggestions/path-display.stderr index 5e718d79307a8..8359b36588e6b 100644 --- a/src/test/ui/suggestions/path-display.stderr +++ b/src/test/ui/suggestions/path-display.stderr @@ -6,7 +6,7 @@ LL | println!("{}", path); | = help: the trait `std::fmt::Display` is not implemented for `Path` = note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `PathBuf` doesn't implement `std::fmt::Display` --> $DIR/path-display.rs:9:20 @@ -16,7 +16,7 @@ LL | println!("{}", path); | = help: the trait `std::fmt::Display` is not implemented for `PathBuf` = note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr b/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr index d6822d94ca8c9..c9f2a3ed9f4bf 100644 --- a/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr +++ b/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr @@ -22,7 +22,7 @@ LL | }; LL | println!("{}", x); | ^ value borrowed here after move | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0506]: cannot assign to `i` because it is borrowed --> $DIR/try-block-maybe-bad-lifetime.rs:40:9 diff --git a/src/test/ui/type-alias-impl-trait/nested.stderr b/src/test/ui/type-alias-impl-trait/nested.stderr index cf4d23656e0e1..732af5c0b561f 100644 --- a/src/test/ui/type-alias-impl-trait/nested.stderr +++ b/src/test/ui/type-alias-impl-trait/nested.stderr @@ -5,7 +5,7 @@ LL | println!("{:?}", bar()); | ^^^^^ `Bar` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = help: the trait `Debug` is not implemented for `Bar` - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/type/ascription/issue-47666.stderr b/src/test/ui/type/ascription/issue-47666.stderr index b59a73af9f93b..0f90fce3a42b9 100644 --- a/src/test/ui/type/ascription/issue-47666.stderr +++ b/src/test/ui/type/ascription/issue-47666.stderr @@ -10,7 +10,7 @@ LL | let _ = Option:Some(vec![0, 1]); | help: maybe write a path separator here: `::` | = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` - = note: this error originates in the macro `$crate::__rust_force_expr` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::__rust_force_expr` which comes from the expansion of the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/use/use-after-move-based-on-type.stderr b/src/test/ui/use/use-after-move-based-on-type.stderr index 361a6e2d8c278..445f14d65e3ce 100644 --- a/src/test/ui/use/use-after-move-based-on-type.stderr +++ b/src/test/ui/use/use-after-move-based-on-type.stderr @@ -8,7 +8,7 @@ LL | let _y = x; LL | println!("{}", x); | ^ value borrowed here after move | - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/walk-struct-literal-with.stderr b/src/test/ui/walk-struct-literal-with.stderr index 377a807445891..4384e345e85c7 100644 --- a/src/test/ui/walk-struct-literal-with.stderr +++ b/src/test/ui/walk-struct-literal-with.stderr @@ -13,7 +13,7 @@ note: this function takes ownership of the receiver `self`, which moves `start` | LL | fn make_string_bar(mut self) -> Mine{ | ^^^^ - = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/tools/clippy/tests/ui/diverging_sub_expression.stderr b/src/tools/clippy/tests/ui/diverging_sub_expression.stderr index c712a6a7e38ea..9c91d935716d8 100644 --- a/src/tools/clippy/tests/ui/diverging_sub_expression.stderr +++ b/src/tools/clippy/tests/ui/diverging_sub_expression.stderr @@ -36,7 +36,7 @@ error: sub-expression diverges LL | _ => true || panic!("boo"), | ^^^^^^^^^^^^^ | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: sub-expression diverges --> $DIR/diverging_sub_expression.rs:38:26 diff --git a/src/tools/clippy/tests/ui/fallible_impl_from.stderr b/src/tools/clippy/tests/ui/fallible_impl_from.stderr index 4e0f08a1215c0..d637dbce5d792 100644 --- a/src/tools/clippy/tests/ui/fallible_impl_from.stderr +++ b/src/tools/clippy/tests/ui/fallible_impl_from.stderr @@ -38,7 +38,7 @@ note: potential failure(s) | LL | panic!(); | ^^^^^^^^ - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: consider implementing `TryFrom` instead --> $DIR/fallible_impl_from.rs:35:1 @@ -65,7 +65,7 @@ LL | } else if s.parse::().unwrap() != 42 { | ^^^^^^^^^^^^^^^^^^^^^^^^^ LL | panic!("{:?}", s); | ^^^^^^^^^^^^^^^^^ - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: consider implementing `TryFrom` instead --> $DIR/fallible_impl_from.rs:53:1 @@ -87,7 +87,7 @@ LL | if s.parse::().ok().unwrap() != 42 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | panic!("{:?}", s); | ^^^^^^^^^^^^^^^^^ - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 4 previous errors diff --git a/src/tools/clippy/tests/ui/issue-7447.stderr b/src/tools/clippy/tests/ui/issue-7447.stderr index 463a48b24a321..8d8c29f138587 100644 --- a/src/tools/clippy/tests/ui/issue-7447.stderr +++ b/src/tools/clippy/tests/ui/issue-7447.stderr @@ -5,7 +5,7 @@ LL | byte_view(panic!()); | ^^^^^^^^ | = note: `-D clippy::diverging-sub-expression` implied by `-D warnings` - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: sub-expression diverges --> $DIR/issue-7447.rs:24:19 @@ -13,7 +13,7 @@ error: sub-expression diverges LL | group_entries(panic!()); | ^^^^^^^^ | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors