diff options
Diffstat (limited to 'src/test')
193 files changed, 1448 insertions, 1018 deletions
diff --git a/src/test/codegen/gdb_debug_script_load.rs b/src/test/codegen/gdb_debug_script_load.rs index 2e8dc7b6f36..178269f611e 100644 --- a/src/test/codegen/gdb_debug_script_load.rs +++ b/src/test/codegen/gdb_debug_script_load.rs @@ -1,6 +1,8 @@ // ignore-tidy-linelength // ignore-windows // ignore-macos +// ignore-wasm +// ignore-emscripten // compile-flags: -g -C no-prepopulate-passes diff --git a/src/test/codegen/set-discriminant-invalid.rs b/src/test/codegen/set-discriminant-invalid.rs new file mode 100644 index 00000000000..d9614f062b7 --- /dev/null +++ b/src/test/codegen/set-discriminant-invalid.rs @@ -0,0 +1,43 @@ +// compile-flags: -C opt-level=0 +#![crate_type = "lib"] + +pub enum ApiError {} +#[allow(dead_code)] +pub struct TokioError { + b: bool, +} +pub enum Error { + Api { + source: ApiError, + }, + Ethereum, + Tokio { + source: TokioError, + }, +} +struct Api; +impl IntoError<Error> for Api +{ + type Source = ApiError; + // CHECK-LABEL: @into_error + // CHECK: llvm.trap() + // Also check the next two instructions to make sure we do not match against `trap` + // elsewhere in the code. + // CHECK-NEXT: load + // CHECK-NEXT: ret + #[no_mangle] + fn into_error(self, error: Self::Source) -> Error { + Error::Api { + source: (|v| v)(error), + } + } +} + +pub trait IntoError<E> +{ + /// The underlying error + type Source; + + /// Combine the information to produce the error + fn into_error(self, source: Self::Source) -> E; +} diff --git a/src/test/compile-fail/consts/const-err3.rs b/src/test/compile-fail/consts/const-err3.rs index add4eef13c7..fc10824f0c0 100644 --- a/src/test/compile-fail/consts/const-err3.rs +++ b/src/test/compile-fail/consts/const-err3.rs @@ -14,7 +14,6 @@ fn main() { //~^ ERROR const_err let _e = [5u8][1]; //~^ ERROR const_err - //~| ERROR this expression will panic at runtime black_box(b); black_box(c); black_box(d); diff --git a/src/test/compile-fail/consts/const-fn-error.rs b/src/test/compile-fail/consts/const-fn-error.rs index 1a4fc72e817..5d26059644d 100644 --- a/src/test/compile-fail/consts/const-fn-error.rs +++ b/src/test/compile-fail/consts/const-fn-error.rs @@ -6,7 +6,7 @@ const fn f(x: usize) -> usize { let mut sum = 0; for i in 0..x { //~^ ERROR E0015 - //~| ERROR E0017 + //~| ERROR E0658 //~| ERROR E0080 //~| ERROR E0744 //~| ERROR E0019 diff --git a/src/test/incremental/issue-61323.rs b/src/test/incremental/issue-61323.rs new file mode 100644 index 00000000000..448ce367b8c --- /dev/null +++ b/src/test/incremental/issue-61323.rs @@ -0,0 +1,15 @@ +// revisions: rpass cfail + +enum A { + //[cfail]~^ ERROR 3:1: 3:7: recursive type `A` has infinite size [E0072] + B(C), +} + +#[cfg(rpass)] +struct C(Box<A>); + +#[cfg(cfail)] +struct C(A); +//[cfail]~^ ERROR 12:1: 12:13: recursive type `C` has infinite size [E0072] + +fn main() {} diff --git a/src/test/rustdoc-ui/issue-61732.rs b/src/test/rustdoc-ui/issue-61732.rs new file mode 100644 index 00000000000..d4835c09224 --- /dev/null +++ b/src/test/rustdoc-ui/issue-61732.rs @@ -0,0 +1,4 @@ +// This previously triggered an ICE. + +pub(in crate::r#mod) fn main() {} +//~^ ERROR expected module, found unresolved item diff --git a/src/test/rustdoc-ui/issue-61732.stderr b/src/test/rustdoc-ui/issue-61732.stderr new file mode 100644 index 00000000000..6c8ba48864d --- /dev/null +++ b/src/test/rustdoc-ui/issue-61732.stderr @@ -0,0 +1,11 @@ +error[E0577]: expected module, found unresolved item `crate::r#mod` + --> $DIR/issue-61732.rs:3:8 + | +LL | pub(in crate::r#mod) fn main() {} + | ^^^^^^^^^^^^ not a module + +error: Compilation failed, aborting rustdoc + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0577`. diff --git a/src/test/rustdoc/duplicate-cfg.rs b/src/test/rustdoc/duplicate-cfg.rs new file mode 100644 index 00000000000..505d6ee769a --- /dev/null +++ b/src/test/rustdoc/duplicate-cfg.rs @@ -0,0 +1,15 @@ +#![crate_name = "foo"] +#![feature(doc_cfg)] + +// @has 'foo/index.html' +// @!has '-' '//*[@class="stab portability"]' 'feature="sync" and' +// @has '-' '//*[@class="stab portability"]' 'feature="sync"' +#[doc(cfg(feature = "sync"))] +#[doc(cfg(feature = "sync"))] +pub struct Foo; + +#[doc(cfg(feature = "sync"))] +pub mod bar { + #[doc(cfg(feature = "sync"))] + pub struct Bar; +} diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.stderr b/src/test/ui/anonymous-higher-ranked-lifetime.stderr index 9be44c7f448..c6d9a61bdd9 100644 --- a/src/test/ui/anonymous-higher-ranked-lifetime.stderr +++ b/src/test/ui/anonymous-higher-ranked-lifetime.stderr @@ -121,3 +121,4 @@ LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(), error: aborting due to 11 previous errors +For more information about this error, try `rustc --explain E0631`. diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr index 627609c4a9c..3e39c8a7924 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr @@ -9,13 +9,21 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the fun | LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> { | ^^ - = note: ...so that the expression is assignable: - expected Type<'_> - found Type<'a> +note: ...so that the expression is assignable + --> $DIR/project-fn-ret-invariant.rs:48:13 + | +LL | bar(foo, x) + | ^ + = note: expected `Type<'_>` + found `Type<'a>` = note: but, the lifetime must be valid for the static lifetime... - = note: ...so that the expression is assignable: - expected Type<'static> - found Type<'_> +note: ...so that the expression is assignable + --> $DIR/project-fn-ret-invariant.rs:48:4 + | +LL | bar(foo, x) + | ^^^^^^^^^^^ + = note: expected `Type<'static>` + found `Type<'_>` error: aborting due to previous error diff --git a/src/test/ui/async-await/suggest-missing-await.fixed b/src/test/ui/async-await/suggest-missing-await.fixed index 7c02a907ce7..1ec59d90620 100644 --- a/src/test/ui/async-await/suggest-missing-await.fixed +++ b/src/test/ui/async-await/suggest-missing-await.fixed @@ -16,4 +16,15 @@ async fn suggest_await_in_async_fn() { //~| SUGGESTION x.await } +async fn dummy() {} + +#[allow(unused)] +async fn suggest_await_in_async_fn_return() { + dummy().await; + //~^ ERROR mismatched types [E0308] + //~| HELP try adding a semicolon + //~| HELP consider using `.await` here + //~| SUGGESTION dummy().await +} + fn main() {} diff --git a/src/test/ui/async-await/suggest-missing-await.rs b/src/test/ui/async-await/suggest-missing-await.rs index 91abd44e65c..70cc1f1d5a2 100644 --- a/src/test/ui/async-await/suggest-missing-await.rs +++ b/src/test/ui/async-await/suggest-missing-await.rs @@ -16,4 +16,15 @@ async fn suggest_await_in_async_fn() { //~| SUGGESTION x.await } +async fn dummy() {} + +#[allow(unused)] +async fn suggest_await_in_async_fn_return() { + dummy() + //~^ ERROR mismatched types [E0308] + //~| HELP try adding a semicolon + //~| HELP consider using `.await` here + //~| SUGGESTION dummy().await +} + fn main() {} diff --git a/src/test/ui/async-await/suggest-missing-await.stderr b/src/test/ui/async-await/suggest-missing-await.stderr index 7a635a37107..7ab024434b2 100644 --- a/src/test/ui/async-await/suggest-missing-await.stderr +++ b/src/test/ui/async-await/suggest-missing-await.stderr @@ -10,6 +10,23 @@ LL | take_u32(x) = note: expected type `u32` found opaque type `impl std::future::Future` -error: aborting due to previous error +error[E0308]: mismatched types + --> $DIR/suggest-missing-await.rs:23:5 + | +LL | dummy() + | ^^^^^^^ expected `()`, found opaque type + | + = note: expected unit type `()` + found opaque type `impl std::future::Future` +help: try adding a semicolon + | +LL | dummy(); + | ^ +help: consider using `.await` here + | +LL | dummy().await + | + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/c-variadic/variadic-ffi-4.stderr b/src/test/ui/c-variadic/variadic-ffi-4.stderr index c80ed5ebf5c..cd4cd8b198d 100644 --- a/src/test/ui/c-variadic/variadic-ffi-4.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-4.stderr @@ -49,9 +49,13 @@ note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on th | LL | let _ = ap.with_copy(|ap| { ap }); | ^^^^^^^^^^^ - = note: ...so that the expression is assignable: - expected core::ffi::VaList<'_, '_> - found core::ffi::VaList<'_, '_> +note: ...so that the expression is assignable + --> $DIR/variadic-ffi-4.rs:16:33 + | +LL | let _ = ap.with_copy(|ap| { ap }); + | ^^ + = note: expected `core::ffi::VaList<'_, '_>` + found `core::ffi::VaList<'_, '_>` note: but, the lifetime must be valid for the method call at 16:13... --> $DIR/variadic-ffi-4.rs:16:13 | diff --git a/src/test/ui/check-static-immutable-mut-slices.stderr b/src/test/ui/check-static-immutable-mut-slices.stderr index 4f4bf16a0ff..39da824ede5 100644 --- a/src/test/ui/check-static-immutable-mut-slices.stderr +++ b/src/test/ui/check-static-immutable-mut-slices.stderr @@ -1,9 +1,12 @@ -error[E0017]: references in statics may only refer to immutable values +error[E0658]: references in statics may only refer to immutable values --> $DIR/check-static-immutable-mut-slices.rs:3:37 | LL | static TEST: &'static mut [isize] = &mut []; | ^^^^^^^ statics require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error: aborting due to previous error -For more information about this error, try `rustc --explain E0017`. +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr index a6b52b258f0..7141c047d7f 100644 --- a/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr +++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr @@ -39,3 +39,4 @@ LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| { error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0631`. diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr index a15444207f5..00333958468 100644 --- a/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr +++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr @@ -77,4 +77,5 @@ LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| { error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0308, E0631. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr index 9fbe95a9c39..1c6564ee426 100644 --- a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr +++ b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr @@ -13,3 +13,4 @@ LL | with_closure(|x: u32, y: i32| { error: aborting due to previous error +For more information about this error, try `rustc --explain E0631`. diff --git a/src/test/ui/closures/issue-41366.stderr b/src/test/ui/closures/issue-41366.stderr index 91d26efbc4f..2f2871e9f0e 100644 --- a/src/test/ui/closures/issue-41366.stderr +++ b/src/test/ui/closures/issue-41366.stderr @@ -19,4 +19,5 @@ LL | (&|_|()) as &dyn for<'x> Fn(<u32 as T<'x>>::V); error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0271`. +Some errors have detailed explanations: E0271, E0631. +For more information about an error, try `rustc --explain E0271`. diff --git a/src/test/ui/conditional-compilation/cfg-attr-parse.rs b/src/test/ui/conditional-compilation/cfg-attr-parse.rs index 93aef72220c..8ca31c11836 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-parse.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-parse.rs @@ -1,11 +1,11 @@ // Parse `cfg_attr` with varying numbers of attributes and trailing commas // Completely empty `cfg_attr` input -#[cfg_attr()] //~ error: expected identifier, found `)` +#[cfg_attr()] //~ error: malformed `cfg_attr` attribute input struct NoConfigurationPredicate; // Zero attributes, zero trailing comma (comma manatory here) -#[cfg_attr(all())] //~ error: expected `,`, found `)` +#[cfg_attr(all())] //~ error: expected `,`, found end of `cfg_attr` struct A0C0; // Zero attributes, one trailing comma @@ -40,4 +40,16 @@ struct A2C1; #[cfg_attr(all(), must_use, deprecated,,)] //~ ERROR expected identifier struct A2C2; +// Wrong delimiter `[` +#[cfg_attr[all(),,]] +//~^ ERROR wrong `cfg_attr` delimiters +//~| ERROR expected identifier, found `,` +struct BracketZero; + +// Wrong delimiter `{` +#[cfg_attr{all(),,}] +//~^ ERROR wrong `cfg_attr` delimiters +//~| ERROR expected identifier, found `,` +struct BraceZero; + fn main() {} diff --git a/src/test/ui/conditional-compilation/cfg-attr-parse.stderr b/src/test/ui/conditional-compilation/cfg-attr-parse.stderr index 3dfbd6df256..3a590d3282d 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-parse.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-parse.stderr @@ -1,32 +1,86 @@ -error: expected identifier, found `)` - --> $DIR/cfg-attr-parse.rs:4:12 +error: malformed `cfg_attr` attribute input + --> $DIR/cfg-attr-parse.rs:4:1 | LL | #[cfg_attr()] - | ^ expected identifier + | ^^^^^^^^^^^^^ help: missing condition and attribute: `#[cfg_attr(condition, attribute, other_attribute, ...)]` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> -error: expected `,`, found `)` +error: expected `,`, found end of `cfg_attr` input --> $DIR/cfg-attr-parse.rs:8:17 | LL | #[cfg_attr(all())] | ^ expected `,` + | + = help: the valid syntax is `#[cfg_attr(condition, attribute, other_attribute, ...)]` + = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> error: expected identifier, found `,` --> $DIR/cfg-attr-parse.rs:16:18 | LL | #[cfg_attr(all(),,)] | ^ expected identifier + | + = help: the valid syntax is `#[cfg_attr(condition, attribute, other_attribute, ...)]` + = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> error: expected identifier, found `,` --> $DIR/cfg-attr-parse.rs:28:28 | LL | #[cfg_attr(all(), must_use,,)] | ^ expected identifier + | + = help: the valid syntax is `#[cfg_attr(condition, attribute, other_attribute, ...)]` + = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> error: expected identifier, found `,` --> $DIR/cfg-attr-parse.rs:40:40 | LL | #[cfg_attr(all(), must_use, deprecated,,)] | ^ expected identifier + | + = help: the valid syntax is `#[cfg_attr(condition, attribute, other_attribute, ...)]` + = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> + +error: wrong `cfg_attr` delimiters + --> $DIR/cfg-attr-parse.rs:44:11 + | +LL | #[cfg_attr[all(),,]] + | ^^^^^^^^^ + | +help: the delimiters should be `(` and `)` + | +LL | #[cfg_attr(all(),,)] + | ^ ^ + +error: expected identifier, found `,` + --> $DIR/cfg-attr-parse.rs:44:18 + | +LL | #[cfg_attr[all(),,]] + | ^ expected identifier + | + = help: the valid syntax is `#[cfg_attr(condition, attribute, other_attribute, ...)]` + = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> + +error: wrong `cfg_attr` delimiters + --> $DIR/cfg-attr-parse.rs:50:11 + | +LL | #[cfg_attr{all(),,}] + | ^^^^^^^^^ + | +help: the delimiters should be `(` and `)` + | +LL | #[cfg_attr(all(),,)] + | ^ ^ + +error: expected identifier, found `,` + --> $DIR/cfg-attr-parse.rs:50:18 + | +LL | #[cfg_attr{all(),,}] + | ^ expected identifier + | + = help: the valid syntax is `#[cfg_attr(condition, attribute, other_attribute, ...)]` + = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> -error: aborting due to 5 previous errors +error: aborting due to 9 previous errors diff --git a/src/test/ui/consts/array-literal-index-oob.stderr b/src/test/ui/consts/array-literal-index-oob.stderr index 0ddc2a0e79c..f4d4e6f969b 100644 --- a/src/test/ui/consts/array-literal-index-oob.stderr +++ b/src/test/ui/consts/array-literal-index-oob.stderr @@ -12,7 +12,7 @@ error: reaching this expression at runtime will panic or abort LL | &{[1, 2, 3][4]}; | --^^^^^^^^^^^^- | | - | index out of bounds: the len is 3 but the index is 4 + | indexing out of bounds: the len is 3 but the index is 4 error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/const-err2.rs b/src/test/ui/consts/const-err2.rs index e5ee90fc9f1..ecbcc2a4b49 100644 --- a/src/test/ui/consts/const-err2.rs +++ b/src/test/ui/consts/const-err2.rs @@ -23,7 +23,6 @@ fn main() { //~^ ERROR const_err let _e = [5u8][1]; //~^ ERROR index out of bounds - //~| ERROR this expression will panic at runtime black_box(a); black_box(b); black_box(c); diff --git a/src/test/ui/consts/const-err2.stderr b/src/test/ui/consts/const-err2.stderr index 0a09a7213da..1d84d44dc27 100644 --- a/src/test/ui/consts/const-err2.stderr +++ b/src/test/ui/consts/const-err2.stderr @@ -34,11 +34,5 @@ error: index out of bounds: the len is 1 but the index is 1 LL | let _e = [5u8][1]; | ^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/const-err2.rs:24:14 - | -LL | let _e = [5u8][1]; - | ^^^^^^^^ index out of bounds: the len is 1 but the index is 1 - -error: aborting due to 6 previous errors +error: aborting due to 5 previous errors diff --git a/src/test/ui/consts/const-err3.rs b/src/test/ui/consts/const-err3.rs index 89373f99f75..a9cf04cda7a 100644 --- a/src/test/ui/consts/const-err3.rs +++ b/src/test/ui/consts/const-err3.rs @@ -23,7 +23,6 @@ fn main() { //~^ ERROR const_err let _e = [5u8][1]; //~^ ERROR const_err - //~| ERROR this expression will panic at runtime black_box(a); black_box(b); black_box(c); diff --git a/src/test/ui/consts/const-err3.stderr b/src/test/ui/consts/const-err3.stderr index 42de247c8f7..0602707be70 100644 --- a/src/test/ui/consts/const-err3.stderr +++ b/src/test/ui/consts/const-err3.stderr @@ -34,11 +34,5 @@ error: index out of bounds: the len is 1 but the index is 1 LL | let _e = [5u8][1]; | ^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/const-err3.rs:24:14 - | -LL | let _e = [5u8][1]; - | ^^^^^^^^ index out of bounds: the len is 1 but the index is 1 - -error: aborting due to 6 previous errors +error: aborting due to 5 previous errors diff --git a/src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.rs b/src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.rs new file mode 100644 index 00000000000..bdcf537859c --- /dev/null +++ b/src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.rs @@ -0,0 +1,6 @@ +#![feature(core_intrinsics)] +fn main() { + // Test that calls to intrinsics are never promoted + let x: &'static usize = + &std::intrinsics::size_of::<i32>(); //~ ERROR temporary value dropped while borrowed +} diff --git a/src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr b/src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr new file mode 100644 index 00000000000..78143042ece --- /dev/null +++ b/src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr @@ -0,0 +1,13 @@ +error[E0716]: temporary value dropped while borrowed + --> $DIR/const-eval-intrinsic-promotion.rs:5:10 + | +LL | let x: &'static usize = + | -------------- type annotation requires that borrow lasts for `'static` +LL | &std::intrinsics::size_of::<i32>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use +LL | } + | - temporary value is freed at the end of this statement + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/const-eval/const_caller_location.rs b/src/test/ui/consts/const-eval/const_caller_location.rs deleted file mode 100644 index c63822f052b..00000000000 --- a/src/test/ui/consts/const-eval/const_caller_location.rs +++ /dev/null @@ -1,23 +0,0 @@ -// run-pass - -#![feature(const_fn, core_intrinsics)] - -use std::{intrinsics::caller_location, panic::Location}; - -const LOCATION: &Location = caller_location(); -const NESTED: &Location = { - const fn nested_location() -> &'static Location<'static> { - caller_location() - }; - nested_location() -}; - -fn main() { - assert_eq!(LOCATION.file(), file!()); - assert_eq!(LOCATION.line(), 7); - assert_eq!(LOCATION.column(), 29); - - assert_eq!(NESTED.file(), file!()); - assert_eq!(NESTED.line(), 10); - assert_eq!(NESTED.column(), 9); -} diff --git a/src/test/ui/consts/const-eval/issue-65394.stderr b/src/test/ui/consts/const-eval/issue-65394.stderr index acf5cbaede6..54b35073340 100644 --- a/src/test/ui/consts/const-eval/issue-65394.stderr +++ b/src/test/ui/consts/const-eval/issue-65394.stderr @@ -1,8 +1,11 @@ -error[E0017]: references in constants may only refer to immutable values +error[E0658]: references in constants may only refer to immutable values --> $DIR/issue-65394.rs:8:13 | LL | let r = &mut x; | ^^^^^^ constants require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/issue-65394.rs:7:9 @@ -12,5 +15,5 @@ LL | let mut x = Vec::<i32>::new(); error: aborting due to 2 previous errors -Some errors have detailed explanations: E0017, E0493. -For more information about an error, try `rustc --explain E0017`. +Some errors have detailed explanations: E0493, E0658. +For more information about an error, try `rustc --explain E0493`. diff --git a/src/test/ui/consts/const-eval/promoted_errors.rs b/src/test/ui/consts/const-eval/promoted_errors.rs index 45941398f4b..dfa6863082c 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.rs +++ b/src/test/ui/consts/const-eval/promoted_errors.rs @@ -8,14 +8,12 @@ fn main() { //~^ ERROR const_err println!("{}", 1/(1-1)); //~^ ERROR attempt to divide by zero [const_err] - //~| ERROR reaching this expression at runtime will panic or abort [const_err] + //~| ERROR const_err let _x = 1/(1-1); //~^ ERROR const_err - //~| ERROR const_err println!("{}", 1/(false as u32)); //~^ ERROR attempt to divide by zero [const_err] - //~| ERROR reaching this expression at runtime will panic or abort [const_err] + //~| ERROR const_err let _x = 1/(false as u32); //~^ ERROR const_err - //~| ERROR const_err } diff --git a/src/test/ui/consts/const-eval/promoted_errors.stderr b/src/test/ui/consts/const-eval/promoted_errors.stderr index 40d5c73e866..848a880ba49 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.stderr @@ -20,7 +20,7 @@ error: reaching this expression at runtime will panic or abort --> $DIR/promoted_errors.rs:9:20 | LL | println!("{}", 1/(1-1)); - | ^^^^^^^ attempt to divide by zero + | ^^^^^^^ dividing by zero error: attempt to divide by zero --> $DIR/promoted_errors.rs:12:14 @@ -28,35 +28,23 @@ error: attempt to divide by zero LL | let _x = 1/(1-1); | ^^^^^^^ -error: this expression will panic at runtime - --> $DIR/promoted_errors.rs:12:14 - | -LL | let _x = 1/(1-1); - | ^^^^^^^ attempt to divide by zero - error: attempt to divide by zero - --> $DIR/promoted_errors.rs:15:20 + --> $DIR/promoted_errors.rs:14:20 | LL | println!("{}", 1/(false as u32)); | ^^^^^^^^^^^^^^^^ error: reaching this expression at runtime will panic or abort - --> $DIR/promoted_errors.rs:15:20 + --> $DIR/promoted_errors.rs:14:20 | LL | println!("{}", 1/(false as u32)); - | ^^^^^^^^^^^^^^^^ attempt to divide by zero + | ^^^^^^^^^^^^^^^^ dividing by zero error: attempt to divide by zero - --> $DIR/promoted_errors.rs:18:14 + --> $DIR/promoted_errors.rs:17:14 | LL | let _x = 1/(false as u32); | ^^^^^^^^^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/promoted_errors.rs:18:14 - | -LL | let _x = 1/(false as u32); - | ^^^^^^^^^^^^^^^^ attempt to divide by zero - -error: aborting due to 9 previous errors +error: aborting due to 7 previous errors diff --git a/src/test/ui/consts/const-eval/promoted_errors2.rs b/src/test/ui/consts/const-eval/promoted_errors2.rs index 7adb394144b..58b17940912 100644 --- a/src/test/ui/consts/const-eval/promoted_errors2.rs +++ b/src/test/ui/consts/const-eval/promoted_errors2.rs @@ -9,14 +9,12 @@ fn main() { //~^ ERROR attempt to subtract with overflow println!("{}", 1/(1-1)); //~^ ERROR attempt to divide by zero [const_err] - //~| ERROR reaching this expression at runtime will panic or abort [const_err] + //~| ERROR const_err let _x = 1/(1-1); //~^ ERROR const_err - //~| ERROR const_err println!("{}", 1/(false as u32)); //~^ ERROR attempt to divide by zero [const_err] - //~| ERROR reaching this expression at runtime will panic or abort [const_err] + //~| ERROR const_err let _x = 1/(false as u32); //~^ ERROR const_err - //~| ERROR const_err } diff --git a/src/test/ui/consts/const-eval/promoted_errors2.stderr b/src/test/ui/consts/const-eval/promoted_errors2.stderr index 2819e6e8fdb..6f4b1c045f4 100644 --- a/src/test/ui/consts/const-eval/promoted_errors2.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors2.stderr @@ -26,7 +26,7 @@ error: reaching this expression at runtime will panic or abort --> $DIR/promoted_errors2.rs:10:20 | LL | println!("{}", 1/(1-1)); - | ^^^^^^^ attempt to divide by zero + | ^^^^^^^ dividing by zero error: attempt to divide by zero --> $DIR/promoted_errors2.rs:13:14 @@ -34,35 +34,23 @@ error: attempt to divide by zero LL | let _x = 1/(1-1); | ^^^^^^^ -error: this expression will panic at runtime - --> $DIR/promoted_errors2.rs:13:14 - | -LL | let _x = 1/(1-1); - | ^^^^^^^ attempt to divide by zero - error: attempt to divide by zero - --> $DIR/promoted_errors2.rs:16:20 + --> $DIR/promoted_errors2.rs:15:20 | LL | println!("{}", 1/(false as u32)); | ^^^^^^^^^^^^^^^^ error: reaching this expression at runtime will panic or abort - --> $DIR/promoted_errors2.rs:16:20 + --> $DIR/promoted_errors2.rs:15:20 | LL | println!("{}", 1/(false as u32)); - | ^^^^^^^^^^^^^^^^ attempt to divide by zero + | ^^^^^^^^^^^^^^^^ dividing by zero error: attempt to divide by zero - --> $DIR/promoted_errors2.rs:19:14 + --> $DIR/promoted_errors2.rs:18:14 | LL | let _x = 1/(false as u32); | ^^^^^^^^^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/promoted_errors2.rs:19:14 - | -LL | let _x = 1/(false as u32); - | ^^^^^^^^^^^^^^^^ attempt to divide by zero - -error: aborting due to 10 previous errors +error: aborting due to 8 previous errors diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.rs b/src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.rs index 7c6a574a211..6469a65700d 100644 --- a/src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.rs +++ b/src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.rs @@ -7,7 +7,7 @@ extern "C" { const extern fn bar() { unsafe { regular_in_block(); - //~^ ERROR: cannot call functions with `"C"` abi in `min_const_fn` + //~^ ERROR: can only call other `const fn` within a `const fn` } } @@ -16,7 +16,7 @@ extern fn regular() {} const extern fn foo() { unsafe { regular(); - //~^ ERROR: cannot call functions with `"C"` abi in `min_const_fn` + //~^ ERROR: can only call other `const fn` within a `const fn` } } diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.stderr b/src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.stderr index d8bdf0a57cf..eed279ecf75 100644 --- a/src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.stderr +++ b/src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.stderr @@ -1,4 +1,4 @@ -error[E0723]: cannot call functions with `"C"` abi in `min_const_fn` +error[E0723]: can only call other `const fn` within a `const fn`, but `const regular_in_block` is not stable as `const fn` --> $DIR/const-extern-fn-call-extern-fn.rs:9:9 | LL | regular_in_block(); @@ -7,7 +7,7 @@ LL | regular_in_block(); = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 = help: add `#![feature(const_fn)]` to the crate attributes to enable -error[E0723]: cannot call functions with `"C"` abi in `min_const_fn` +error[E0723]: can only call other `const fn` within a `const fn`, but `const regular` is not stable as `const fn` --> $DIR/const-extern-fn-call-extern-fn.rs:18:9 | LL | regular(); diff --git a/src/test/ui/consts/const-multi-ref.stderr b/src/test/ui/consts/const-multi-ref.stderr index ed3837e9c9e..0809c77c1b6 100644 --- a/src/test/ui/consts/const-multi-ref.stderr +++ b/src/test/ui/consts/const-multi-ref.stderr @@ -1,8 +1,11 @@ -error[E0017]: references in constants may only refer to immutable values +error[E0658]: references in constants may only refer to immutable values --> $DIR/const-multi-ref.rs:6:13 | LL | let p = &mut a; | ^^^^^^ constants require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead --> $DIR/const-multi-ref.rs:16:13 @@ -12,5 +15,5 @@ LL | let p = &a; error: aborting due to 2 previous errors -Some errors have detailed explanations: E0017, E0492. -For more information about an error, try `rustc --explain E0017`. +Some errors have detailed explanations: E0492, E0658. +For more information about an error, try `rustc --explain E0492`. diff --git a/src/test/ui/consts/const-mut-refs/const_mut_refs.rs b/src/test/ui/consts/const-mut-refs/const_mut_refs.rs new file mode 100644 index 00000000000..99006a20b1b --- /dev/null +++ b/src/test/ui/consts/const-mut-refs/const_mut_refs.rs @@ -0,0 +1,36 @@ +// run-pass + +#![feature(const_mut_refs)] + +struct Foo { + x: usize +} + +const fn foo() -> Foo { + Foo { x: 0 } +} + +impl Foo { + const fn bar(&mut self) -> usize { + self.x = 1; + self.x + } + +} + +const fn baz(foo: &mut Foo) -> usize { + let x = &mut foo.x; + *x = 2; + *x +} + +const fn bazz(foo: &mut Foo) -> usize { + foo.x = 3; + foo.x +} + +fn main() { + let _: [(); foo().bar()] = [(); 1]; + let _: [(); baz(&mut foo())] = [(); 2]; + let _: [(); bazz(&mut foo())] = [(); 3]; +} diff --git a/src/test/ui/consts/const-mut-refs/feature-gate-const_mut_refs.rs b/src/test/ui/consts/const-mut-refs/feature-gate-const_mut_refs.rs new file mode 100644 index 00000000000..2207599815e --- /dev/null +++ b/src/test/ui/consts/const-mut-refs/feature-gate-const_mut_refs.rs @@ -0,0 +1,7 @@ +fn main() { + foo(&mut 5); +} + +const fn foo(x: &mut i32) -> i32 { //~ ERROR mutable references in const fn are unstable + *x + 1 +} diff --git a/src/test/ui/consts/const-mut-refs/feature-gate-const_mut_refs.stderr b/src/test/ui/consts/const-mut-refs/feature-gate-const_mut_refs.stderr new file mode 100644 index 00000000000..4fae119f026 --- /dev/null +++ b/src/test/ui/consts/const-mut-refs/feature-gate-const_mut_refs.stderr @@ -0,0 +1,12 @@ +error[E0723]: mutable references in const fn are unstable + --> $DIR/feature-gate-const_mut_refs.rs:5:14 + | +LL | const fn foo(x: &mut i32) -> i32 { + | ^ + | + = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 + = help: add `#![feature(const_fn)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0723`. diff --git a/src/test/ui/consts/const-prop-ice.rs b/src/test/ui/consts/const-prop-ice.rs index 48c4b7da942..13309f978b6 100644 --- a/src/test/ui/consts/const-prop-ice.rs +++ b/src/test/ui/consts/const-prop-ice.rs @@ -1,4 +1,3 @@ fn main() { [0; 3][3u64 as usize]; //~ ERROR the len is 3 but the index is 3 - //~| ERROR this expression will panic at runtime } diff --git a/src/test/ui/consts/const-prop-ice.stderr b/src/test/ui/consts/const-prop-ice.stderr index 8ecc6f4bc6b..4b3880198bf 100644 --- a/src/test/ui/consts/const-prop-ice.stderr +++ b/src/test/ui/consts/const-prop-ice.stderr @@ -6,11 +6,5 @@ LL | [0; 3][3u64 as usize]; | = note: `#[deny(const_err)]` on by default -error: this expression will panic at runtime - --> $DIR/const-prop-ice.rs:2:5 - | -LL | [0; 3][3u64 as usize]; - | ^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the len is 3 but the index is 3 - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/src/test/ui/consts/const_let_assign3.stderr b/src/test/ui/consts/const_let_assign3.stderr index 53b960b4ec0..7852874944b 100644 --- a/src/test/ui/consts/const_let_assign3.stderr +++ b/src/test/ui/consts/const_let_assign3.stderr @@ -4,17 +4,23 @@ error[E0019]: constant function contains unimplemented expression type LL | self.state = x; | ^^^^^^^^^^^^^^ -error[E0017]: references in constants may only refer to immutable values +error[E0658]: references in constants may only refer to immutable values --> $DIR/const_let_assign3.rs:16:5 | LL | s.foo(3); | ^ constants require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable -error[E0017]: references in constants may only refer to immutable values +error[E0658]: references in constants may only refer to immutable values --> $DIR/const_let_assign3.rs:22:13 | LL | let y = &mut x; | ^^^^^^ constants require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0019]: constant contains unimplemented expression type --> $DIR/const_let_assign3.rs:24:5 @@ -24,5 +30,5 @@ LL | *y = 42; error: aborting due to 4 previous errors -Some errors have detailed explanations: E0017, E0019. -For more information about an error, try `rustc --explain E0017`. +Some errors have detailed explanations: E0019, E0658. +For more information about an error, try `rustc --explain E0019`. diff --git a/src/test/ui/consts/miri_unleashed/mutable_const.rs b/src/test/ui/consts/miri_unleashed/mutable_const.rs index 44b40849467..972f59549ea 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_const.rs +++ b/src/test/ui/consts/miri_unleashed/mutable_const.rs @@ -1,6 +1,7 @@ // compile-flags: -Zunleash-the-miri-inside-of-you #![feature(const_raw_ptr_deref)] +#![feature(const_mut_refs)] #![deny(const_err)] use std::cell::UnsafeCell; @@ -12,9 +13,7 @@ const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; const MUTATING_BEHIND_RAW: () = { // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time. unsafe { - *MUTABLE_BEHIND_RAW = 99 //~ WARN skipping const checks - //~^ ERROR any use of this value will cause an error - //~^^ tried to modify constant memory + *MUTABLE_BEHIND_RAW = 99 //~ ERROR any use of this value will cause an error } }; diff --git a/src/test/ui/consts/miri_unleashed/mutable_const.stderr b/src/test/ui/consts/miri_unleashed/mutable_const.stderr index 757f0ffb59f..9daca765c7c 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_const.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_const.stderr @@ -1,30 +1,23 @@ warning: skipping const checks - --> $DIR/mutable_const.rs:9:38 + --> $DIR/mutable_const.rs:10:38 | LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; | ^^^^^^^^^^^^^^^^^^^^ -warning: skipping const checks - --> $DIR/mutable_const.rs:15:9 - | -LL | *MUTABLE_BEHIND_RAW = 99 - | ^^^^^^^^^^^^^^^^^^^^^^^^ - error: any use of this value will cause an error - --> $DIR/mutable_const.rs:15:9 + --> $DIR/mutable_const.rs:16:9 | LL | / const MUTATING_BEHIND_RAW: () = { LL | | // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time. LL | | unsafe { LL | | *MUTABLE_BEHIND_RAW = 99 | | ^^^^^^^^^^^^^^^^^^^^^^^^ tried to modify constant memory -... | LL | | } LL | | }; | |__- | note: lint level defined here - --> $DIR/mutable_const.rs:4:9 + --> $DIR/mutable_const.rs:5:9 | LL | #![deny(const_err)] | ^^^^^^^^^ diff --git a/src/test/ui/consts/miri_unleashed/mutable_references.rs b/src/test/ui/consts/miri_unleashed/mutable_references.rs index 59dafcbf4d5..fe3c4ee70f2 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_references.rs +++ b/src/test/ui/consts/miri_unleashed/mutable_references.rs @@ -1,20 +1,22 @@ // compile-flags: -Zunleash-the-miri-inside-of-you +#![feature(const_mut_refs)] #![allow(const_err)] use std::cell::UnsafeCell; // a test demonstrating what things we could allow with a smarter const qualification +// this is fine because is not possible to mutate through an immutable reference. static FOO: &&mut u32 = &&mut 42; -//~^ WARN: skipping const checks +// this is fine because accessing an immutable static `BAR` is equivalent to accessing `*&BAR` +// which puts the mutable reference behind an immutable one. static BAR: &mut () = &mut (); -//~^ WARN: skipping const checks struct Foo<T>(T); +// this is fine for the same reason as `BAR`. static BOO: &mut Foo<()> = &mut Foo(()); -//~^ WARN: skipping const checks struct Meh { x: &'static UnsafeCell<i32>, @@ -27,8 +29,8 @@ static MEH: Meh = Meh { //~^ WARN: skipping const checks }; +// this is fine for the same reason as `BAR`. static OH_YES: &mut i32 = &mut 42; -//~^ WARN: skipping const checks fn main() { unsafe { diff --git a/src/test/ui/consts/miri_unleashed/mutable_references.stderr b/src/test/ui/consts/miri_unleashed/mutable_references.stderr index b9c0af33c39..3e1300c63c1 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_references.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_references.stderr @@ -1,35 +1,11 @@ warning: skipping const checks - --> $DIR/mutable_references.rs:8:26 - | -LL | static FOO: &&mut u32 = &&mut 42; - | ^^^^^^^ - -warning: skipping const checks - --> $DIR/mutable_references.rs:11:23 - | -LL | static BAR: &mut () = &mut (); - | ^^^^^^^ - -warning: skipping const checks - --> $DIR/mutable_references.rs:16:28 - | -LL | static BOO: &mut Foo<()> = &mut Foo(()); - | ^^^^^^^^^^^^ - -warning: skipping const checks - --> $DIR/mutable_references.rs:26:8 + --> $DIR/mutable_references.rs:28:8 | LL | x: &UnsafeCell::new(42), | ^^^^^^^^^^^^^^^^^^^^ -warning: skipping const checks - --> $DIR/mutable_references.rs:30:27 - | -LL | static OH_YES: &mut i32 = &mut 42; - | ^^^^^^^ - error[E0594]: cannot assign to `*OH_YES`, as `OH_YES` is an immutable static item - --> $DIR/mutable_references.rs:37:5 + --> $DIR/mutable_references.rs:39:5 | LL | *OH_YES = 99; | ^^^^^^^^^^^^ cannot assign diff --git a/src/test/ui/consts/miri_unleashed/read_from_static.rs b/src/test/ui/consts/miri_unleashed/read_from_static.rs new file mode 100644 index 00000000000..821c501c9fc --- /dev/null +++ b/src/test/ui/consts/miri_unleashed/read_from_static.rs @@ -0,0 +1,11 @@ +// run-pass +// compile-flags: -Zunleash-the-miri-inside-of-you +#![feature(const_mut_refs)] +#![allow(const_err)] + +static OH_YES: &mut i32 = &mut 42; + +fn main() { + // Make sure `OH_YES` can be read. + assert_eq!(*OH_YES, 42); +} diff --git a/src/test/ui/consts/projection_qualif.mut_refs.stderr b/src/test/ui/consts/projection_qualif.mut_refs.stderr new file mode 100644 index 00000000000..23538777c9d --- /dev/null +++ b/src/test/ui/consts/projection_qualif.mut_refs.stderr @@ -0,0 +1,12 @@ +error[E0658]: dereferencing raw pointers in constants is unstable + --> $DIR/projection_qualif.rs:11:18 + | +LL | unsafe { *b = 5; } + | ^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/51911 + = help: add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/projection_qualif.rs b/src/test/ui/consts/projection_qualif.rs index dedb7db5920..cfe8e7f03d5 100644 --- a/src/test/ui/consts/projection_qualif.rs +++ b/src/test/ui/consts/projection_qualif.rs @@ -1,11 +1,15 @@ +// revisions: stock mut_refs + +#![cfg_attr(mut_refs, feature(const_mut_refs))] + use std::cell::Cell; const FOO: &u32 = { let mut a = 42; { - let b: *mut u32 = &mut a; //~ ERROR may only refer to immutable values + let b: *mut u32 = &mut a; //[stock]~ ERROR may only refer to immutable values unsafe { *b = 5; } //~ ERROR dereferencing raw pointers in constants - //~^ contains unimplemented expression + //[stock]~^ contains unimplemented expression } &{a} }; diff --git a/src/test/ui/consts/projection_qualif.stderr b/src/test/ui/consts/projection_qualif.stock.stderr index 0efb6bfd10a..472d2607453 100644 --- a/src/test/ui/consts/projection_qualif.stderr +++ b/src/test/ui/consts/projection_qualif.stock.stderr @@ -1,11 +1,14 @@ -error[E0017]: references in constants may only refer to immutable values - --> $DIR/projection_qualif.rs:6:27 +error[E0658]: references in constants may only refer to immutable values + --> $DIR/projection_qualif.rs:10:27 | LL | let b: *mut u32 = &mut a; | ^^^^^^ constants require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0658]: dereferencing raw pointers in constants is unstable - --> $DIR/projection_qualif.rs:7:18 + --> $DIR/projection_qualif.rs:11:18 | LL | unsafe { *b = 5; } | ^^^^^^ @@ -14,12 +17,12 @@ LL | unsafe { *b = 5; } = help: add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable error[E0019]: constant contains unimplemented expression type - --> $DIR/projection_qualif.rs:7:18 + --> $DIR/projection_qualif.rs:11:18 | LL | unsafe { *b = 5; } | ^^^^^^ error: aborting due to 3 previous errors -Some errors have detailed explanations: E0017, E0019, E0658. -For more information about an error, try `rustc --explain E0017`. +Some errors have detailed explanations: E0019, E0658. +For more information about an error, try `rustc --explain E0019`. diff --git a/src/test/ui/consts/static_mut_containing_mut_ref2.mut_refs.stderr b/src/test/ui/consts/static_mut_containing_mut_ref2.mut_refs.stderr new file mode 100644 index 00000000000..b43fbc86f99 --- /dev/null +++ b/src/test/ui/consts/static_mut_containing_mut_ref2.mut_refs.stderr @@ -0,0 +1,9 @@ +error[E0080]: could not evaluate static initializer + --> $DIR/static_mut_containing_mut_ref2.rs:7:45 + | +LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ tried to modify a static's initial value from another static's initializer + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/static_mut_containing_mut_ref2.rs b/src/test/ui/consts/static_mut_containing_mut_ref2.rs index ef378fa8451..74162fbd54b 100644 --- a/src/test/ui/consts/static_mut_containing_mut_ref2.rs +++ b/src/test/ui/consts/static_mut_containing_mut_ref2.rs @@ -1,7 +1,12 @@ +// revisions: stock mut_refs + +#![cfg_attr(mut_refs, feature(const_mut_refs))] + static mut STDERR_BUFFER_SPACE: u8 = 0; pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; -//~^ ERROR references in statics may only refer to immutable values -//~| ERROR static contains unimplemented expression type +//[mut_refs]~^ ERROR could not evaluate static initializer +//[stock]~^^ ERROR references in statics may only refer to immutable values +//[stock]~| ERROR static contains unimplemented expression type fn main() {} diff --git a/src/test/ui/consts/static_mut_containing_mut_ref2.stderr b/src/test/ui/consts/static_mut_containing_mut_ref2.stock.stderr index ca691b07be0..430cef94dc3 100644 --- a/src/test/ui/consts/static_mut_containing_mut_ref2.stderr +++ b/src/test/ui/consts/static_mut_containing_mut_ref2.stock.stderr @@ -1,16 +1,19 @@ -error[E0017]: references in statics may only refer to immutable values - --> $DIR/static_mut_containing_mut_ref2.rs:3:46 +error[E0658]: references in statics may only refer to immutable values + --> $DIR/static_mut_containing_mut_ref2.rs:7:46 | LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ statics require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0019]: static contains unimplemented expression type - --> $DIR/static_mut_containing_mut_ref2.rs:3:45 + --> $DIR/static_mut_containing_mut_ref2.rs:7:45 | LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors -Some errors have detailed explanations: E0017, E0019. -For more information about an error, try `rustc --explain E0017`. +Some errors have detailed explanations: E0019, E0658. +For more information about an error, try `rustc --explain E0019`. diff --git a/src/test/ui/consts/unstable-const-fn-in-libcore.rs b/src/test/ui/consts/unstable-const-fn-in-libcore.rs new file mode 100644 index 00000000000..cad1516fc78 --- /dev/null +++ b/src/test/ui/consts/unstable-const-fn-in-libcore.rs @@ -0,0 +1,29 @@ +// This is a non-regression test for const-qualification of unstable items in libcore +// as explained in issue #67053. +// const-qualification could miss some `const fn`s if they were unstable and the feature +// gate was not enabled in libcore. + +#![stable(feature = "core", since = "1.6.0")] +#![feature(const_if_match)] +#![feature(rustc_const_unstable)] +#![feature(staged_api)] + +enum Opt<T> { + Some(T), + None, +} + +impl<T> Opt<T> { + #[rustc_const_unstable(feature = "foo")] + #[stable(feature = "rust1", since = "1.0.0")] + const fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T { + //~^ ERROR destructors cannot be evaluated at compile-time + //~| ERROR destructors cannot be evaluated at compile-time + match self { + Opt::Some(t) => t, + Opt::None => f(), //~ ERROR E0015 + } + } +} + +fn main() {} diff --git a/src/test/ui/consts/unstable-const-fn-in-libcore.stderr b/src/test/ui/consts/unstable-const-fn-in-libcore.stderr new file mode 100644 index 00000000000..a8455cefd01 --- /dev/null +++ b/src/test/ui/consts/unstable-const-fn-in-libcore.stderr @@ -0,0 +1,22 @@ +error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants + --> $DIR/unstable-const-fn-in-libcore.rs:24:26 + | +LL | Opt::None => f(), + | ^^^ + +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/unstable-const-fn-in-libcore.rs:19:53 + | +LL | const fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T { + | ^ constant functions cannot evaluate destructors + +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/unstable-const-fn-in-libcore.rs:19:47 + | +LL | const fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T { + | ^^^^ constant functions cannot evaluate destructors + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0015, E0493. +For more information about an error, try `rustc --explain E0015`. diff --git a/src/test/ui/enum/union-in-enum.rs b/src/test/ui/enum/union-in-enum.rs new file mode 100644 index 00000000000..048913e25cd --- /dev/null +++ b/src/test/ui/enum/union-in-enum.rs @@ -0,0 +1,13 @@ +// This test checks that the union keyword +// is accepted as the name of an enum variant +// when not followed by an identifier +// This special case exists because `union` is a contextual keyword. + +#![allow(warnings)] + +// check-pass + +enum A { union } +enum B { union {} } +enum C { union() } +fn main(){} diff --git a/src/test/ui/error-codes/E0017.rs b/src/test/ui/error-codes/E0017.rs index 3bc518c2c2b..64be41170d0 100644 --- a/src/test/ui/error-codes/E0017.rs +++ b/src/test/ui/error-codes/E0017.rs @@ -2,10 +2,10 @@ static X: i32 = 1; const C: i32 = 2; static mut M: i32 = 3; -const CR: &'static mut i32 = &mut C; //~ ERROR E0017 -static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +const CR: &'static mut i32 = &mut C; //~ ERROR E0658 +static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0658 //~| ERROR E0019 //~| ERROR cannot borrow -static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 -static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; //~ ERROR E0017 +static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0658 +static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; //~ ERROR E0658 fn main() {} diff --git a/src/test/ui/error-codes/E0017.stderr b/src/test/ui/error-codes/E0017.stderr index 8c8660adceb..9a87195a9d0 100644 --- a/src/test/ui/error-codes/E0017.stderr +++ b/src/test/ui/error-codes/E0017.stderr @@ -1,8 +1,11 @@ -error[E0017]: references in constants may only refer to immutable values +error[E0658]: references in constants may only refer to immutable values --> $DIR/E0017.rs:5:30 | LL | const CR: &'static mut i32 = &mut C; | ^^^^^^ constants require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0019]: static contains unimplemented expression type --> $DIR/E0017.rs:6:39 @@ -10,11 +13,14 @@ error[E0019]: static contains unimplemented expression type LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ -error[E0017]: references in statics may only refer to immutable values +error[E0658]: references in statics may only refer to immutable values --> $DIR/E0017.rs:6:39 | LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ statics require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0596]: cannot borrow immutable static item `X` as mutable --> $DIR/E0017.rs:6:39 @@ -22,19 +28,25 @@ error[E0596]: cannot borrow immutable static item `X` as mutable LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ cannot borrow as mutable -error[E0017]: references in statics may only refer to immutable values +error[E0658]: references in statics may only refer to immutable values --> $DIR/E0017.rs:9:38 | LL | static CONST_REF: &'static mut i32 = &mut C; | ^^^^^^ statics require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable -error[E0017]: references in statics may only refer to immutable values +error[E0658]: references in statics may only refer to immutable values --> $DIR/E0017.rs:10:52 | LL | static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; | ^^^^^^ statics require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error: aborting due to 6 previous errors -Some errors have detailed explanations: E0017, E0019, E0596. -For more information about an error, try `rustc --explain E0017`. +Some errors have detailed explanations: E0019, E0596, E0658. +For more information about an error, try `rustc --explain E0019`. diff --git a/src/test/ui/error-codes/E0388.rs b/src/test/ui/error-codes/E0388.rs new file mode 100644 index 00000000000..5954e3490b0 --- /dev/null +++ b/src/test/ui/error-codes/E0388.rs @@ -0,0 +1,10 @@ +static X: i32 = 1; +const C: i32 = 2; + +const CR: &'static mut i32 = &mut C; //~ ERROR E0658 +static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0658 + //~| ERROR cannot borrow + //~| ERROR E0019 +static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0658 + +fn main() {} diff --git a/src/test/ui/error-codes/E0388.stderr b/src/test/ui/error-codes/E0388.stderr new file mode 100644 index 00000000000..986307d3f12 --- /dev/null +++ b/src/test/ui/error-codes/E0388.stderr @@ -0,0 +1,43 @@ +error[E0658]: references in constants may only refer to immutable values + --> $DIR/E0388.rs:4:30 + | +LL | const CR: &'static mut i32 = &mut C; + | ^^^^^^ constants require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0019]: static contains unimplemented expression type + --> $DIR/E0388.rs:5:39 + | +LL | static STATIC_REF: &'static mut i32 = &mut X; + | ^^^^^^ + +error[E0658]: references in statics may only refer to immutable values + --> $DIR/E0388.rs:5:39 + | +LL | static STATIC_REF: &'static mut i32 = &mut X; + | ^^^^^^ statics require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0596]: cannot borrow immutable static item `X` as mutable + --> $DIR/E0388.rs:5:39 + | +LL | static STATIC_REF: &'static mut i32 = &mut X; + | ^^^^^^ cannot borrow as mutable + +error[E0658]: references in statics may only refer to immutable values + --> $DIR/E0388.rs:8:38 + | +LL | static CONST_REF: &'static mut i32 = &mut C; + | ^^^^^^ statics require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0019, E0596, E0658. +For more information about an error, try `rustc --explain E0019`. diff --git a/src/test/ui/feature-gates/feature-gate-const_transmute.rs b/src/test/ui/feature-gates/feature-gate-const_transmute.rs index 6a5bbec77fd..da532643d94 100644 --- a/src/test/ui/feature-gates/feature-gate-const_transmute.rs +++ b/src/test/ui/feature-gates/feature-gate-const_transmute.rs @@ -4,6 +4,6 @@ use std::mem; struct Foo(u32); const TRANSMUTED_U32: u32 = unsafe { mem::transmute(Foo(3)) }; -//~^ ERROR The use of std::mem::transmute() is gated in constants +//~^ ERROR `std::intrinsics::transmute` is not yet stable as a const fn fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-const_transmute.stderr b/src/test/ui/feature-gates/feature-gate-const_transmute.stderr index 41b653d98dc..772e8d29478 100644 --- a/src/test/ui/feature-gates/feature-gate-const_transmute.stderr +++ b/src/test/ui/feature-gates/feature-gate-const_transmute.stderr @@ -1,12 +1,10 @@ -error[E0658]: The use of std::mem::transmute() is gated in constants +error: `std::intrinsics::transmute` is not yet stable as a const fn --> $DIR/feature-gate-const_transmute.rs:6:38 | LL | const TRANSMUTED_U32: u32 = unsafe { mem::transmute(Foo(3)) }; | ^^^^^^^^^^^^^^^^^^^^^^ | - = note: for more information, see https://github.com/rust-lang/rust/issues/53605 = help: add `#![feature(const_transmute)]` to the crate attributes to enable error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/for-loop-while/label_break_value.rs b/src/test/ui/for-loop-while/label_break_value.rs index eb5be7742e0..18930ac811e 100644 --- a/src/test/ui/for-loop-while/label_break_value.rs +++ b/src/test/ui/for-loop-while/label_break_value.rs @@ -77,7 +77,7 @@ fn label_break_mixed(v: u32) -> u32 { } // Labeled breaking an outer loop still works 'd: loop { - 'e: { + { if v == r { break 'b; } diff --git a/src/test/ui/for-loop-while/loop-label-shadowing.rs b/src/test/ui/for-loop-while/loop-label-shadowing.rs index acb53e254bb..9bedde67b78 100644 --- a/src/test/ui/for-loop-while/loop-label-shadowing.rs +++ b/src/test/ui/for-loop-while/loop-label-shadowing.rs @@ -5,6 +5,7 @@ fn main() { let mut foo = Vec::new(); + #[allow(unused_labels)] 'foo: for i in &[1, 2, 3] { foo.push(*i); } diff --git a/src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr b/src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr index b388f38a7fa..ca61fb0c171 100644 --- a/src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr +++ b/src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr @@ -4,7 +4,10 @@ error[E0308]: mismatched types LL | fn bar(x: usize) -> Option<usize> { | ------------- expected `std::option::Option<usize>` because of return type LL | return x; - | ^ expected enum `std::option::Option`, found `usize` + | ^ + | | + | expected enum `std::option::Option`, found `usize` + | help: try using a variant of the expected enum: `Some(x)` | = note: expected enum `std::option::Option<usize>` found type `usize` diff --git a/src/test/ui/hygiene/hygienic-labels-in-let.rs b/src/test/ui/hygiene/hygienic-labels-in-let.rs index 5d22cf857b7..491855d7bec 100644 --- a/src/test/ui/hygiene/hygienic-labels-in-let.rs +++ b/src/test/ui/hygiene/hygienic-labels-in-let.rs @@ -1,5 +1,6 @@ // run-pass #![allow(unreachable_code)] +#![allow(unused_labels)] // Test that labels injected by macros do not break hygiene. This // checks cases where the macros invocations are under the rhs of a diff --git a/src/test/ui/hygiene/hygienic-labels-in-let.stderr b/src/test/ui/hygiene/hygienic-labels-in-let.stderr index d88470f32a3..4acb34f2dce 100644 --- a/src/test/ui/hygiene/hygienic-labels-in-let.stderr +++ b/src/test/ui/hygiene/hygienic-labels-in-let.stderr @@ -1,5 +1,5 @@ warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:15:9 + --> $DIR/hygienic-labels-in-let.rs:16:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -11,7 +11,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:63:9 + --> $DIR/hygienic-labels-in-let.rs:64:9 | LL | 'x: loop { | -- first declared here @@ -20,7 +20,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:63:9 + --> $DIR/hygienic-labels-in-let.rs:64:9 | LL | 'x: loop { $e } | -- first declared here @@ -29,7 +29,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:15:9 + --> $DIR/hygienic-labels-in-let.rs:16:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -41,7 +41,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:15:9 + --> $DIR/hygienic-labels-in-let.rs:16:9 | LL | 'x: loop { $e } | ^^ @@ -53,7 +53,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:15:9 + --> $DIR/hygienic-labels-in-let.rs:16:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -65,7 +65,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:75:9 + --> $DIR/hygienic-labels-in-let.rs:76:9 | LL | 'x: loop { | -- first declared here @@ -74,7 +74,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:75:9 + --> $DIR/hygienic-labels-in-let.rs:76:9 | LL | 'x: loop { $e } | -- first declared here @@ -83,7 +83,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:75:9 + --> $DIR/hygienic-labels-in-let.rs:76:9 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -92,7 +92,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:75:9 + --> $DIR/hygienic-labels-in-let.rs:76:9 | LL | 'x: loop { $e } | -- first declared here @@ -101,7 +101,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:26:9 + --> $DIR/hygienic-labels-in-let.rs:27:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -113,7 +113,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:26:9 + --> $DIR/hygienic-labels-in-let.rs:27:9 | LL | 'x: loop { $e } | -- first declared here @@ -125,7 +125,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:26:9 + --> $DIR/hygienic-labels-in-let.rs:27:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -137,7 +137,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:26:9 + --> $DIR/hygienic-labels-in-let.rs:27:9 | LL | 'x: loop { $e } | -- first declared here @@ -149,7 +149,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:26:9 + --> $DIR/hygienic-labels-in-let.rs:27:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -161,7 +161,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:89:9 + --> $DIR/hygienic-labels-in-let.rs:90:9 | LL | 'x: loop { | -- first declared here @@ -170,7 +170,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:89:9 + --> $DIR/hygienic-labels-in-let.rs:90:9 | LL | 'x: loop { $e } | -- first declared here @@ -179,7 +179,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:89:9 + --> $DIR/hygienic-labels-in-let.rs:90:9 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -188,7 +188,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:89:9 + --> $DIR/hygienic-labels-in-let.rs:90:9 | LL | 'x: loop { $e } | -- first declared here @@ -197,7 +197,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:89:9 + --> $DIR/hygienic-labels-in-let.rs:90:9 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -206,7 +206,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:89:9 + --> $DIR/hygienic-labels-in-let.rs:90:9 | LL | 'x: while 1 + 1 == 2 { $e } | -- first declared here @@ -215,7 +215,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:38:9 + --> $DIR/hygienic-labels-in-let.rs:39:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -227,7 +227,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:38:9 + --> $DIR/hygienic-labels-in-let.rs:39:9 | LL | 'x: loop { $e } | -- first declared here @@ -239,7 +239,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:38:9 + --> $DIR/hygienic-labels-in-let.rs:39:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -251,7 +251,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:38:9 + --> $DIR/hygienic-labels-in-let.rs:39:9 | LL | 'x: loop { $e } | -- first declared here @@ -263,7 +263,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:38:9 + --> $DIR/hygienic-labels-in-let.rs:39:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -275,7 +275,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:38:9 + --> $DIR/hygienic-labels-in-let.rs:39:9 | LL | 'x: while 1 + 1 == 2 { $e } | -- first declared here @@ -287,7 +287,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:38:9 + --> $DIR/hygienic-labels-in-let.rs:39:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope diff --git a/src/test/ui/hygiene/hygienic-labels.rs b/src/test/ui/hygiene/hygienic-labels.rs index 8eafb4c8d21..c9f494b68b4 100644 --- a/src/test/ui/hygiene/hygienic-labels.rs +++ b/src/test/ui/hygiene/hygienic-labels.rs @@ -1,5 +1,6 @@ // run-pass #![allow(unreachable_code)] +#![allow(unused_labels)] // Test that labels injected by macros do not break hygiene. // Issue #24278: The label/lifetime shadowing checker from #24162 diff --git a/src/test/ui/hygiene/hygienic-labels.stderr b/src/test/ui/hygiene/hygienic-labels.stderr index 285e9037e97..0833825940a 100644 --- a/src/test/ui/hygiene/hygienic-labels.stderr +++ b/src/test/ui/hygiene/hygienic-labels.stderr @@ -1,5 +1,5 @@ warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:12:9 + --> $DIR/hygienic-labels.rs:13:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -11,7 +11,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:53:5 + --> $DIR/hygienic-labels.rs:54:5 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -20,7 +20,7 @@ LL | 'x: loop { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:53:5 + --> $DIR/hygienic-labels.rs:54:5 | LL | 'x: loop { $e } | -- first declared here @@ -29,7 +29,7 @@ LL | 'x: loop { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:12:9 + --> $DIR/hygienic-labels.rs:13:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -41,7 +41,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:12:9 + --> $DIR/hygienic-labels.rs:13:9 | LL | 'x: loop { $e } | ^^ @@ -53,7 +53,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:12:9 + --> $DIR/hygienic-labels.rs:13:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -65,7 +65,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:62:5 + --> $DIR/hygienic-labels.rs:63:5 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -74,7 +74,7 @@ LL | 'x: while 1 + 1 == 2 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:62:5 + --> $DIR/hygienic-labels.rs:63:5 | LL | 'x: loop { $e } | -- first declared here @@ -83,7 +83,7 @@ LL | 'x: while 1 + 1 == 2 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:62:5 + --> $DIR/hygienic-labels.rs:63:5 | LL | 'x: loop { | -- first declared here @@ -92,7 +92,7 @@ LL | 'x: while 1 + 1 == 2 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:62:5 + --> $DIR/hygienic-labels.rs:63:5 | LL | 'x: loop { $e } | -- first declared here @@ -101,7 +101,7 @@ LL | 'x: while 1 + 1 == 2 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:37:9 + --> $DIR/hygienic-labels.rs:38:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -113,7 +113,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:37:9 + --> $DIR/hygienic-labels.rs:38:9 | LL | 'x: loop { $e } | -- first declared here @@ -125,7 +125,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:37:9 + --> $DIR/hygienic-labels.rs:38:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -137,7 +137,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:37:9 + --> $DIR/hygienic-labels.rs:38:9 | LL | 'x: loop { $e } | -- first declared here @@ -149,7 +149,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:37:9 + --> $DIR/hygienic-labels.rs:38:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -161,7 +161,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:72:5 + --> $DIR/hygienic-labels.rs:73:5 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -170,7 +170,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:72:5 + --> $DIR/hygienic-labels.rs:73:5 | LL | 'x: loop { $e } | -- first declared here @@ -179,7 +179,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:72:5 + --> $DIR/hygienic-labels.rs:73:5 | LL | 'x: loop { | -- first declared here @@ -188,7 +188,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:72:5 + --> $DIR/hygienic-labels.rs:73:5 | LL | 'x: loop { $e } | -- first declared here @@ -197,7 +197,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:72:5 + --> $DIR/hygienic-labels.rs:73:5 | LL | 'x: while 1 + 1 == 2 { | -- first declared here @@ -206,7 +206,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:72:5 + --> $DIR/hygienic-labels.rs:73:5 | LL | 'x: while 1 + 1 == 2 { $e } | -- first declared here @@ -215,7 +215,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:23:9 + --> $DIR/hygienic-labels.rs:24:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -227,7 +227,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:23:9 + --> $DIR/hygienic-labels.rs:24:9 | LL | 'x: loop { $e } | -- first declared here @@ -239,7 +239,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:23:9 + --> $DIR/hygienic-labels.rs:24:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -251,7 +251,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:23:9 + --> $DIR/hygienic-labels.rs:24:9 | LL | 'x: loop { $e } | -- first declared here @@ -263,7 +263,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:23:9 + --> $DIR/hygienic-labels.rs:24:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -275,7 +275,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:23:9 + --> $DIR/hygienic-labels.rs:24:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -287,7 +287,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:23:9 + --> $DIR/hygienic-labels.rs:24:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr index 5e80c673258..3300293bb36 100644 --- a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr +++ b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr @@ -9,13 +9,21 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the fun | LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) { | ^^ - = note: ...so that the expression is assignable: - expected std::boxed::Box<dyn std::fmt::Debug> - found std::boxed::Box<(dyn std::fmt::Debug + 'a)> +note: ...so that the expression is assignable + --> $DIR/dyn-trait.rs:20:16 + | +LL | static_val(x); + | ^ + = note: expected `std::boxed::Box<dyn std::fmt::Debug>` + found `std::boxed::Box<(dyn std::fmt::Debug + 'a)>` = note: but, the lifetime must be valid for the static lifetime... - = note: ...so that the types are compatible: - expected StaticTrait - found StaticTrait +note: ...so that the types are compatible + --> $DIR/dyn-trait.rs:20:5 + | +LL | static_val(x); + | ^^^^^^^^^^ + = note: expected `StaticTrait` + found `StaticTrait` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-16683.stderr b/src/test/ui/issues/issue-16683.stderr index b663e213ed0..99700f2084e 100644 --- a/src/test/ui/issues/issue-16683.stderr +++ b/src/test/ui/issues/issue-16683.stderr @@ -21,9 +21,13 @@ note: but, the lifetime must be valid for the lifetime `'a` as defined on the tr | LL | trait T<'a> { | ^^ - = note: ...so that the types are compatible: - expected &'a Self - found &Self +note: ...so that the types are compatible + --> $DIR/issue-16683.rs:4:14 + | +LL | self.a(); + | ^ + = note: expected `&'a Self` + found `&Self` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17718-const-bad-values.stderr b/src/test/ui/issues/issue-17718-const-bad-values.stderr index 8d875d37d85..7e4a62ac969 100644 --- a/src/test/ui/issues/issue-17718-const-bad-values.stderr +++ b/src/test/ui/issues/issue-17718-const-bad-values.stderr @@ -1,8 +1,11 @@ -error[E0017]: references in constants may only refer to immutable values +error[E0658]: references in constants may only refer to immutable values --> $DIR/issue-17718-const-bad-values.rs:1:34 | LL | const C1: &'static mut [usize] = &mut []; | ^^^^^^^ constants require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0013]: constants cannot refer to statics, use a constant instead --> $DIR/issue-17718-const-bad-values.rs:5:46 @@ -10,13 +13,16 @@ error[E0013]: constants cannot refer to statics, use a constant instead LL | const C2: &'static mut usize = unsafe { &mut S }; | ^ -error[E0017]: references in constants may only refer to immutable values +error[E0658]: references in constants may only refer to immutable values --> $DIR/issue-17718-const-bad-values.rs:5:41 | LL | const C2: &'static mut usize = unsafe { &mut S }; | ^^^^^^ constants require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error: aborting due to 3 previous errors -Some errors have detailed explanations: E0013, E0017. +Some errors have detailed explanations: E0013, E0658. For more information about an error, try `rustc --explain E0013`. diff --git a/src/test/ui/issues/issue-17758.stderr b/src/test/ui/issues/issue-17758.stderr index adcbb62e3d5..adfc3f50858 100644 --- a/src/test/ui/issues/issue-17758.stderr +++ b/src/test/ui/issues/issue-17758.stderr @@ -22,9 +22,13 @@ note: but, the lifetime must be valid for the lifetime `'a` as defined on the tr | LL | trait Foo<'a> { | ^^ - = note: ...so that the types are compatible: - expected &'a Self - found &Self +note: ...so that the types are compatible + --> $DIR/issue-17758.rs:7:14 + | +LL | self.foo(); + | ^^^ + = note: expected `&'a Self` + found `&Self` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20831-debruijn.stderr b/src/test/ui/issues/issue-20831-debruijn.stderr index 13c9c09461e..c7fd134a129 100644 --- a/src/test/ui/issues/issue-20831-debruijn.stderr +++ b/src/test/ui/issues/issue-20831-debruijn.stderr @@ -88,9 +88,19 @@ note: ...but the lifetime must also be valid for the lifetime `'a` as defined on | LL | impl<'a> Publisher<'a> for MyStruct<'a> { | ^^ - = note: ...so that the types are compatible: - expected Publisher<'_> - found Publisher<'_> +note: ...so that the types are compatible + --> $DIR/issue-20831-debruijn.rs:28:5 + | +LL | / fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) { +LL | | // Not obvious, but there is an implicit lifetime here -------^ +LL | | +LL | | +... | +LL | | self.sub = t; +LL | | } + | |_____^ + = note: expected `Publisher<'_>` + found `Publisher<'_>` error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-2216.rs b/src/test/ui/issues/issue-2216.rs index fa712edcd1b..ad54107423d 100644 --- a/src/test/ui/issues/issue-2216.rs +++ b/src/test/ui/issues/issue-2216.rs @@ -5,7 +5,7 @@ pub fn main() { 'foo: loop { 'bar: loop { - 'quux: loop { + loop { if 1 == 2 { break 'foo; } diff --git a/src/test/ui/issues/issue-43623.stderr b/src/test/ui/issues/issue-43623.stderr index 2c57b8585d9..d90eb53f900 100644 --- a/src/test/ui/issues/issue-43623.stderr +++ b/src/test/ui/issues/issue-43623.stderr @@ -25,4 +25,5 @@ LL | break_me::<Type, fn(_)>; error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0271`. +Some errors have detailed explanations: E0271, E0631. +For more information about an error, try `rustc --explain E0271`. diff --git a/src/test/ui/issues/issue-46604.rs b/src/test/ui/issues/issue-46604.rs index 4f1ad38dbdd..e1967eb7655 100644 --- a/src/test/ui/issues/issue-46604.rs +++ b/src/test/ui/issues/issue-46604.rs @@ -1,4 +1,4 @@ -static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //~ ERROR E0017 +static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //~ ERROR E0658 fn write<T: AsRef<[u8]>>(buffer: T) { } fn main() { diff --git a/src/test/ui/issues/issue-46604.stderr b/src/test/ui/issues/issue-46604.stderr index c72f580f243..32c7ecbf72e 100644 --- a/src/test/ui/issues/issue-46604.stderr +++ b/src/test/ui/issues/issue-46604.stderr @@ -1,8 +1,11 @@ -error[E0017]: references in statics may only refer to immutable values +error[E0658]: references in statics may only refer to immutable values --> $DIR/issue-46604.rs:1:25 | LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; | ^^^^^^^^^^^^^^^^^^^^ statics require immutable values + | + = note: for more information, see https://github.com/rust-lang/rust/issues/57349 + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0594]: cannot assign to `buf[_]`, as `buf` is an immutable static item --> $DIR/issue-46604.rs:6:5 @@ -12,5 +15,5 @@ LL | buf[0]=2; error: aborting due to 2 previous errors -Some errors have detailed explanations: E0017, E0594. -For more information about an error, try `rustc --explain E0017`. +Some errors have detailed explanations: E0594, E0658. +For more information about an error, try `rustc --explain E0594`. diff --git a/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr index aef6dc54747..9ca983df30a 100644 --- a/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr +++ b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr @@ -2,13 +2,18 @@ error[E0308]: try expression alternatives have incompatible types --> $DIR/issue-51632-try-desugar-incompatible-types.rs:8:5 | LL | missing_discourses()? - | ^^^^^^^^^^^^^^^^^^^^- - | | | - | | help: try removing this `?` - | expected enum `std::result::Result`, found `isize` + | ^^^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found `isize` | = note: expected enum `std::result::Result<isize, ()>` found type `isize` +help: try removing this `?` + | +LL | missing_discourses() + | -- +help: try using a variant of the expected enum + | +LL | Ok(missing_discourses()?) + | error: aborting due to previous error diff --git a/src/test/ui/issues/issue-52213.stderr b/src/test/ui/issues/issue-52213.stderr index b79a5ddf3e1..a8960f77563 100644 --- a/src/test/ui/issues/issue-52213.stderr +++ b/src/test/ui/issues/issue-52213.stderr @@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the fun | LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { | ^^ - = note: ...so that the types are compatible: - expected (&&(T,),) - found (&&'a (T,),) +note: ...so that the types are compatible + --> $DIR/issue-52213.rs:2:11 + | +LL | match (&t,) { + | ^^^^^ + = note: expected `(&&(T,),)` + found `(&&'a (T,),)` note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 1:27... --> $DIR/issue-52213.rs:1:27 | diff --git a/src/test/ui/issues/issue-54348.rs b/src/test/ui/issues/issue-54348.rs index e7221e2cbb1..68d83805477 100644 --- a/src/test/ui/issues/issue-54348.rs +++ b/src/test/ui/issues/issue-54348.rs @@ -1,7 +1,5 @@ fn main() { [1][0u64 as usize]; [1][1.5 as usize]; //~ ERROR index out of bounds - //~| ERROR this expression will panic at runtime [1][1u64 as usize]; //~ ERROR index out of bounds - //~| ERROR this expression will panic at runtime } diff --git a/src/test/ui/issues/issue-54348.stderr b/src/test/ui/issues/issue-54348.stderr index 79320ef4f31..fa77bd6fd77 100644 --- a/src/test/ui/issues/issue-54348.stderr +++ b/src/test/ui/issues/issue-54348.stderr @@ -6,23 +6,11 @@ LL | [1][1.5 as usize]; | = note: `#[deny(const_err)]` on by default -error: this expression will panic at runtime - --> $DIR/issue-54348.rs:3:5 - | -LL | [1][1.5 as usize]; - | ^^^^^^^^^^^^^^^^^ index out of bounds: the len is 1 but the index is 1 - error: index out of bounds: the len is 1 but the index is 1 - --> $DIR/issue-54348.rs:5:5 + --> $DIR/issue-54348.rs:4:5 | LL | [1][1u64 as usize]; | ^^^^^^^^^^^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-54348.rs:5:5 - | -LL | [1][1u64 as usize]; - | ^^^^^^^^^^^^^^^^^^ index out of bounds: the len is 1 but the index is 1 - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-55796.stderr b/src/test/ui/issues/issue-55796.stderr index 7b910f5e3e5..b8cafdc5c14 100644 --- a/src/test/ui/issues/issue-55796.stderr +++ b/src/test/ui/issues/issue-55796.stderr @@ -15,9 +15,13 @@ note: ...so that the type `std::iter::Map<<Self as Graph<'a>>::EdgesIter, [closu LL | Box::new(self.out_edges(u).map(|e| e.target())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: but, the lifetime must be valid for the static lifetime... - = note: ...so that the expression is assignable: - expected std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)> - found std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>> +note: ...so that the expression is assignable + --> $DIR/issue-55796.rs:16:9 + | +LL | Box::new(self.out_edges(u).map(|e| e.target())) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)>` + found `std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>>` error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/issue-55796.rs:21:9 @@ -36,9 +40,13 @@ note: ...so that the type `std::iter::Map<<Self as Graph<'a>>::EdgesIter, [closu LL | Box::new(self.in_edges(u).map(|e| e.target())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: but, the lifetime must be valid for the static lifetime... - = note: ...so that the expression is assignable: - expected std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)> - found std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>> +note: ...so that the expression is assignable + --> $DIR/issue-55796.rs:21:9 + | +LL | Box::new(self.in_edges(u).map(|e| e.target())) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node> + 'static)>` + found `std::boxed::Box<dyn std::iter::Iterator<Item = <Self as Graph<'a>>::Node>>` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-59756.rs b/src/test/ui/issues/issue-59756.rs index cccae396b72..d6df0592be3 100644 --- a/src/test/ui/issues/issue-59756.rs +++ b/src/test/ui/issues/issue-59756.rs @@ -1,4 +1,8 @@ // run-rustfix +// ignore-test +// +// FIXME: Re-enable this test once we support choosing +// between multiple mutually exclusive suggestions for the same span #![allow(warnings)] diff --git a/src/test/ui/issues/issue-59756.stderr b/src/test/ui/issues/issue-59756.stderr index 150916c0366..9066e57aabf 100644 --- a/src/test/ui/issues/issue-59756.stderr +++ b/src/test/ui/issues/issue-59756.stderr @@ -2,13 +2,18 @@ error[E0308]: try expression alternatives have incompatible types --> $DIR/issue-59756.rs:13:5 | LL | foo()? - | ^^^^^- - | | | - | | help: try removing this `?` - | expected enum `std::result::Result`, found struct `A` + | ^^^^^^ expected enum `std::result::Result`, found struct `A` | = note: expected enum `std::result::Result<A, B>` found struct `A` +help: try removing this `?` + | +LL | foo() + | -- +help: try using a variant of the expected enum + | +LL | Ok(foo()?) + | error: aborting due to previous error diff --git a/src/test/ui/issues/issue-60283.stderr b/src/test/ui/issues/issue-60283.stderr index 69c1d85e4e1..d13dcd54a47 100644 --- a/src/test/ui/issues/issue-60283.stderr +++ b/src/test/ui/issues/issue-60283.stderr @@ -27,4 +27,5 @@ LL | foo((), drop) error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0271`. +Some errors have detailed explanations: E0271, E0631. +For more information about an error, try `rustc --explain E0271`. diff --git a/src/test/ui/issues/issue-65634-raw-ident-suggestion.rs b/src/test/ui/issues/issue-65634-raw-ident-suggestion.rs new file mode 100644 index 00000000000..b928510258b --- /dev/null +++ b/src/test/ui/issues/issue-65634-raw-ident-suggestion.rs @@ -0,0 +1,22 @@ +#![allow(non_camel_case_types)] + +trait r#async { + fn r#struct(&self) { + println!("async"); + } +} + +trait r#await { + fn r#struct(&self) { + println!("await"); + } +} + +struct r#fn {} + +impl r#async for r#fn {} +impl r#await for r#fn {} + +fn main() { + r#fn {}.r#struct(); //~ ERROR multiple applicable items in scope +} diff --git a/src/test/ui/issues/issue-65634-raw-ident-suggestion.stderr b/src/test/ui/issues/issue-65634-raw-ident-suggestion.stderr new file mode 100644 index 00000000000..c7bb653dc1f --- /dev/null +++ b/src/test/ui/issues/issue-65634-raw-ident-suggestion.stderr @@ -0,0 +1,22 @@ +error[E0034]: multiple applicable items in scope + --> $DIR/issue-65634-raw-ident-suggestion.rs:21:13 + | +LL | r#fn {}.r#struct(); + | ^^^^^^^^ multiple `r#struct` found + | +note: candidate #1 is defined in an impl of the trait `async` for the type `r#fn` + --> $DIR/issue-65634-raw-ident-suggestion.rs:4:5 + | +LL | fn r#struct(&self) { + | ^^^^^^^^^^^^^^^^^^ + = help: to disambiguate the method call, write `async::r#struct(r#fn {})` instead +note: candidate #2 is defined in an impl of the trait `await` for the type `r#fn` + --> $DIR/issue-65634-raw-ident-suggestion.rs:10:5 + | +LL | fn r#struct(&self) { + | ^^^^^^^^^^^^^^^^^^ + = help: to disambiguate the method call, write `await::r#struct(r#fn {})` instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0034`. diff --git a/src/test/ui/issues/issue-66702-break-outside-loop-val.rs b/src/test/ui/issues/issue-66702-break-outside-loop-val.rs new file mode 100644 index 00000000000..bd3c00d2621 --- /dev/null +++ b/src/test/ui/issues/issue-66702-break-outside-loop-val.rs @@ -0,0 +1,7 @@ +// Breaks with values inside closures used to ICE (#66863) + +fn main() { + 'some_label: loop { + || break 'some_label (); //~ ERROR: `break` inside of a closure + } +} diff --git a/src/test/ui/issues/issue-66702-break-outside-loop-val.stderr b/src/test/ui/issues/issue-66702-break-outside-loop-val.stderr new file mode 100644 index 00000000000..83bde9775b2 --- /dev/null +++ b/src/test/ui/issues/issue-66702-break-outside-loop-val.stderr @@ -0,0 +1,11 @@ +error[E0267]: `break` inside of a closure + --> $DIR/issue-66702-break-outside-loop-val.rs:5:12 + | +LL | || break 'some_label (); + | -- ^^^^^^^^^^^^^^^^^^^^ cannot `break` inside of a closure + | | + | enclosing closure + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0267`. diff --git a/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.rs b/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.rs new file mode 100644 index 00000000000..44bd645598a --- /dev/null +++ b/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.rs @@ -0,0 +1,21 @@ +// Regression test for #67037. +// +// In type checking patterns, E0023 occurs when the tuple pattern and the expected +// tuple pattern have different number of fields. For example, as below, `P()`, +// the tuple struct pattern, has 0 fields, but requires 1 field. +// +// In emitting E0023, we try to see if this is a case of e.g., `Some(a, b, c)` but where +// the scrutinee was of type `Some((a, b, c))`, and suggest that parenthesis be added. +// +// However, we did not account for the expected type being different than the tuple pattern type. +// This caused an issue when the tuple pattern type (`P<T>`) was generic. +// Specifically, we tried deriving the 0th field's type using the `substs` of the expected type. +// When attempting to substitute `T`, there was no such substitution, so "out of range" occured. + +struct U {} // 0 type parameters offered +struct P<T>(T); // 1 type parameter wanted + +fn main() { + let P() = U {}; //~ ERROR mismatched types + //~^ ERROR this pattern has 0 fields, but the corresponding tuple struct has 1 field +} diff --git a/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr b/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr new file mode 100644 index 00000000000..521dd0256f7 --- /dev/null +++ b/src/test/ui/issues/issue-67037-pat-tup-scrut-ty-diff-less-fields.stderr @@ -0,0 +1,22 @@ +error[E0308]: mismatched types + --> $DIR/issue-67037-pat-tup-scrut-ty-diff-less-fields.rs:19:9 + | +LL | let P() = U {}; + | ^^^ expected struct `U`, found struct `P` + | + = note: expected struct `U` + found struct `P<_>` + +error[E0023]: this pattern has 0 fields, but the corresponding tuple struct has 1 field + --> $DIR/issue-67037-pat-tup-scrut-ty-diff-less-fields.rs:19:9 + | +LL | struct P<T>(T); // 1 type parameter wanted + | --------------- tuple struct defined here +... +LL | let P() = U {}; + | ^^^ expected 1 field, found 0 + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0023, E0308. +For more information about an error, try `rustc --explain E0023`. diff --git a/src/test/ui/issues/issue-8460-const.rs b/src/test/ui/issues/issue-8460-const.rs index 4637814b277..71e2b58031c 100644 --- a/src/test/ui/issues/issue-8460-const.rs +++ b/src/test/ui/issues/issue-8460-const.rs @@ -23,19 +23,14 @@ fn main() { //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); //~^ ERROR attempt to divide by zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); //~^ ERROR attempt to divide by zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); //~^ ERROR attempt to divide by zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); //~^ ERROR attempt to divide by zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); //~^ ERROR attempt to divide by zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); //~^ ERROR attempt to calculate the remainder with overflow //~| ERROR this expression will panic at runtime @@ -53,17 +48,12 @@ fn main() { //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); //~^ ERROR attempt to calculate the remainder with a divisor of zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); //~^ ERROR attempt to calculate the remainder with a divisor of zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); //~^ ERROR attempt to calculate the remainder with a divisor of zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); //~^ ERROR attempt to calculate the remainder with a divisor of zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); //~^ ERROR attempt to calculate the remainder with a divisor of zero - //~| ERROR this expression will panic at runtime } diff --git a/src/test/ui/issues/issue-8460-const.stderr b/src/test/ui/issues/issue-8460-const.stderr index 7e5a22e651e..c6750e653d7 100644 --- a/src/test/ui/issues/issue-8460-const.stderr +++ b/src/test/ui/issues/issue-8460-const.stderr @@ -70,179 +70,119 @@ error: attempt to divide by zero LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); | ^^^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:24:36 - | -LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to divide by zero - error: attempt to divide by zero - --> $DIR/issue-8460-const.rs:27:36 + --> $DIR/issue-8460-const.rs:26:36 | LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); | ^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:27:36 - | -LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); - | ^^^^^^^ attempt to divide by zero - error: attempt to divide by zero - --> $DIR/issue-8460-const.rs:30:36 + --> $DIR/issue-8460-const.rs:28:36 | LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); | ^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:30:36 - | -LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide by zero - error: attempt to divide by zero - --> $DIR/issue-8460-const.rs:33:36 + --> $DIR/issue-8460-const.rs:30:36 | LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); | ^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:33:36 - | -LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide by zero - error: attempt to divide by zero - --> $DIR/issue-8460-const.rs:36:36 + --> $DIR/issue-8460-const.rs:32:36 | LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); | ^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:36:36 - | -LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide by zero - error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const.rs:39:36 + --> $DIR/issue-8460-const.rs:34:36 | LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:39:36 + --> $DIR/issue-8460-const.rs:34:36 | LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ attempt to calculate the remainder with overflow error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const.rs:42:36 + --> $DIR/issue-8460-const.rs:37:36 | LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:42:36 + --> $DIR/issue-8460-const.rs:37:36 | LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^ attempt to calculate the remainder with overflow error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const.rs:45:36 + --> $DIR/issue-8460-const.rs:40:36 | LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:45:36 + --> $DIR/issue-8460-const.rs:40:36 | LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const.rs:48:36 + --> $DIR/issue-8460-const.rs:43:36 | LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:48:36 + --> $DIR/issue-8460-const.rs:43:36 | LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const.rs:51:36 + --> $DIR/issue-8460-const.rs:46:36 | LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:51:36 + --> $DIR/issue-8460-const.rs:46:36 | LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const.rs:54:36 + --> $DIR/issue-8460-const.rs:49:36 | LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); | ^^^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:54:36 - | -LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to calculate the remainder with a divisor of zero - error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const.rs:57:36 + --> $DIR/issue-8460-const.rs:51:36 | LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); | ^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:57:36 - | -LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); - | ^^^^^^^ attempt to calculate the remainder with a divisor of zero - error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const.rs:60:36 + --> $DIR/issue-8460-const.rs:53:36 | LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); | ^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:60:36 - | -LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder with a divisor of zero - error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const.rs:63:36 + --> $DIR/issue-8460-const.rs:55:36 | LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); | ^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:63:36 - | -LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder with a divisor of zero - error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const.rs:66:36 + --> $DIR/issue-8460-const.rs:57:36 | LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); | ^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:66:36 - | -LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder with a divisor of zero - -error: aborting due to 40 previous errors +error: aborting due to 30 previous errors diff --git a/src/test/ui/issues/issue-8460-const2.rs b/src/test/ui/issues/issue-8460-const2.rs index c3f53e3298b..723a17940a3 100644 --- a/src/test/ui/issues/issue-8460-const2.rs +++ b/src/test/ui/issues/issue-8460-const2.rs @@ -18,19 +18,14 @@ fn main() { //~^ ERROR attempt to divide with overflow assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); //~^ ERROR attempt to divide by zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); //~^ ERROR attempt to divide by zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); //~^ ERROR attempt to divide by zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); //~^ ERROR attempt to divide by zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); //~^ ERROR attempt to divide by zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); //~^ ERROR attempt to calculate the remainder with overflow assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); @@ -43,17 +38,12 @@ fn main() { //~^ ERROR attempt to calculate the remainder with overflow assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); //~^ ERROR attempt to calculate the remainder with a divisor of zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); //~^ ERROR attempt to calculate the remainder with a divisor of zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); //~^ ERROR attempt to calculate the remainder with a divisor of zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); //~^ ERROR attempt to calculate the remainder with a divisor of zero - //~| ERROR this expression will panic at runtime assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); //~^ ERROR attempt to calculate the remainder with a divisor of zero - //~| ERROR this expression will panic at runtime } diff --git a/src/test/ui/issues/issue-8460-const2.stderr b/src/test/ui/issues/issue-8460-const2.stderr index b688ec13677..87b9b2daa6f 100644 --- a/src/test/ui/issues/issue-8460-const2.stderr +++ b/src/test/ui/issues/issue-8460-const2.stderr @@ -40,149 +40,89 @@ error: attempt to divide by zero LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); | ^^^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const2.rs:19:36 - | -LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to divide by zero - error: attempt to divide by zero - --> $DIR/issue-8460-const2.rs:22:36 + --> $DIR/issue-8460-const2.rs:21:36 | LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); | ^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const2.rs:22:36 - | -LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); - | ^^^^^^^ attempt to divide by zero - error: attempt to divide by zero - --> $DIR/issue-8460-const2.rs:25:36 + --> $DIR/issue-8460-const2.rs:23:36 | LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); | ^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const2.rs:25:36 - | -LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide by zero - error: attempt to divide by zero - --> $DIR/issue-8460-const2.rs:28:36 + --> $DIR/issue-8460-const2.rs:25:36 | LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); | ^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const2.rs:28:36 - | -LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide by zero - error: attempt to divide by zero - --> $DIR/issue-8460-const2.rs:31:36 + --> $DIR/issue-8460-const2.rs:27:36 | LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); | ^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const2.rs:31:36 - | -LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide by zero - error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const2.rs:34:36 + --> $DIR/issue-8460-const2.rs:29:36 | LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const2.rs:36:36 + --> $DIR/issue-8460-const2.rs:31:36 | LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^ error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const2.rs:38:36 + --> $DIR/issue-8460-const2.rs:33:36 | LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const2.rs:40:36 + --> $DIR/issue-8460-const2.rs:35:36 | LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const2.rs:42:36 + --> $DIR/issue-8460-const2.rs:37:36 | LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const2.rs:44:36 + --> $DIR/issue-8460-const2.rs:39:36 | LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); | ^^^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const2.rs:44:36 - | -LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to calculate the remainder with a divisor of zero - error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const2.rs:47:36 + --> $DIR/issue-8460-const2.rs:41:36 | LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); | ^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const2.rs:47:36 - | -LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); - | ^^^^^^^ attempt to calculate the remainder with a divisor of zero - error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const2.rs:50:36 + --> $DIR/issue-8460-const2.rs:43:36 | LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); | ^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const2.rs:50:36 - | -LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder with a divisor of zero - error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const2.rs:53:36 + --> $DIR/issue-8460-const2.rs:45:36 | LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); | ^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const2.rs:53:36 - | -LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder with a divisor of zero - error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const2.rs:56:36 + --> $DIR/issue-8460-const2.rs:47:36 | LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); | ^^^^^^^^ -error: this expression will panic at runtime - --> $DIR/issue-8460-const2.rs:56:36 - | -LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder with a divisor of zero - -error: aborting due to 30 previous errors +error: aborting due to 20 previous errors diff --git a/src/test/ui/macros/macro-lifetime-used-with-labels.rs b/src/test/ui/macros/macro-lifetime-used-with-labels.rs index 86a3e9f44c3..2e9da6f9dc8 100644 --- a/src/test/ui/macros/macro-lifetime-used-with-labels.rs +++ b/src/test/ui/macros/macro-lifetime-used-with-labels.rs @@ -1,6 +1,6 @@ // run-pass #![allow(stable_features)] - +#![allow(unused_labels)] #![allow(unreachable_code)] macro_rules! x { diff --git a/src/test/ui/malformed/malformed-derive-entry.rs b/src/test/ui/malformed/malformed-derive-entry.rs index a6d886318e8..77fa2f566a8 100644 --- a/src/test/ui/malformed/malformed-derive-entry.rs +++ b/src/test/ui/malformed/malformed-derive-entry.rs @@ -1,7 +1,11 @@ -#[derive(Copy(Bad))] //~ ERROR expected one of `)`, `,`, or `::`, found `(` +#[derive(Copy(Bad))] +//~^ ERROR traits in `#[derive(...)]` don't accept arguments +//~| ERROR the trait bound struct Test1; -#[derive(Copy="bad")] //~ ERROR expected one of `)`, `,`, or `::`, found `=` +#[derive(Copy="bad")] +//~^ ERROR traits in `#[derive(...)]` don't accept values +//~| ERROR the trait bound struct Test2; #[derive] //~ ERROR malformed `derive` attribute input diff --git a/src/test/ui/malformed/malformed-derive-entry.stderr b/src/test/ui/malformed/malformed-derive-entry.stderr index 8d750b66838..1f1ee39b049 100644 --- a/src/test/ui/malformed/malformed-derive-entry.stderr +++ b/src/test/ui/malformed/malformed-derive-entry.stderr @@ -1,20 +1,33 @@ -error: expected one of `)`, `,`, or `::`, found `(` +error: traits in `#[derive(...)]` don't accept arguments --> $DIR/malformed-derive-entry.rs:1:14 | LL | #[derive(Copy(Bad))] - | ^ expected one of `)`, `,`, or `::` + | ^^^^^ help: remove the arguments -error: expected one of `)`, `,`, or `::`, found `=` - --> $DIR/malformed-derive-entry.rs:4:14 +error: traits in `#[derive(...)]` don't accept values + --> $DIR/malformed-derive-entry.rs:6:14 | LL | #[derive(Copy="bad")] - | ^ expected one of `)`, `,`, or `::` + | ^^^^^^ help: remove the value error: malformed `derive` attribute input - --> $DIR/malformed-derive-entry.rs:7:1 + --> $DIR/malformed-derive-entry.rs:11:1 | LL | #[derive] | ^^^^^^^^^ help: missing traits to be derived: `#[derive(Trait1, Trait2, ...)]` -error: aborting due to 3 previous errors +error[E0277]: the trait bound `Test1: std::clone::Clone` is not satisfied + --> $DIR/malformed-derive-entry.rs:1:10 + | +LL | #[derive(Copy(Bad))] + | ^^^^ the trait `std::clone::Clone` is not implemented for `Test1` + +error[E0277]: the trait bound `Test2: std::clone::Clone` is not satisfied + --> $DIR/malformed-derive-entry.rs:6:10 + | +LL | #[derive(Copy="bad")] + | ^^^^ the trait `std::clone::Clone` is not implemented for `Test2` + +error: aborting due to 5 previous errors +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/malformed/malformed-meta-delim.rs b/src/test/ui/malformed/malformed-meta-delim.rs new file mode 100644 index 00000000000..5b1614b69a9 --- /dev/null +++ b/src/test/ui/malformed/malformed-meta-delim.rs @@ -0,0 +1,11 @@ +fn main() {} + +#[allow { foo_lint } ] +//~^ ERROR wrong meta list delimiters +//~| HELP the delimiters should be `(` and `)` +fn delim_brace() {} + +#[allow [ foo_lint ] ] +//~^ ERROR wrong meta list delimiters +//~| HELP the delimiters should be `(` and `)` +fn delim_bracket() {} diff --git a/src/test/ui/malformed/malformed-meta-delim.stderr b/src/test/ui/malformed/malformed-meta-delim.stderr new file mode 100644 index 00000000000..407193d4ade --- /dev/null +++ b/src/test/ui/malformed/malformed-meta-delim.stderr @@ -0,0 +1,24 @@ +error: wrong meta list delimiters + --> $DIR/malformed-meta-delim.rs:3:9 + | +LL | #[allow { foo_lint } ] + | ^^^^^^^^^^^^ + | +help: the delimiters should be `(` and `)` + | +LL | #[allow ( foo_lint ) ] + | ^ ^ + +error: wrong meta list delimiters + --> $DIR/malformed-meta-delim.rs:8:9 + | +LL | #[allow [ foo_lint ] ] + | ^^^^^^^^^^^^ + | +help: the delimiters should be `(` and `)` + | +LL | #[allow ( foo_lint ) ] + | ^ ^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/malformed/malformed-special-attrs.rs b/src/test/ui/malformed/malformed-special-attrs.rs index e67fbdd5ddd..05b7ebe4666 100644 --- a/src/test/ui/malformed/malformed-special-attrs.rs +++ b/src/test/ui/malformed/malformed-special-attrs.rs @@ -1,7 +1,7 @@ #[cfg_attr] //~ ERROR malformed `cfg_attr` attribute struct S1; -#[cfg_attr = ""] //~ ERROR expected `(`, found `=` +#[cfg_attr = ""] //~ ERROR malformed `cfg_attr` attribute struct S2; #[derive] //~ ERROR malformed `derive` attribute diff --git a/src/test/ui/malformed/malformed-special-attrs.stderr b/src/test/ui/malformed/malformed-special-attrs.stderr index 319c05eadbf..6f535e03e6a 100644 --- a/src/test/ui/malformed/malformed-special-attrs.stderr +++ b/src/test/ui/malformed/malformed-special-attrs.stderr @@ -6,11 +6,13 @@ LL | #[cfg_attr] | = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> -error: expected `(`, found `=` - --> $DIR/malformed-special-attrs.rs:4:12 +error: malformed `cfg_attr` attribute input + --> $DIR/malformed-special-attrs.rs:4:1 | LL | #[cfg_attr = ""] - | ^ expected `(` + | ^^^^^^^^^^^^^^^^ help: missing condition and attribute: `#[cfg_attr(condition, attribute, other_attribute, ...)]` + | + = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> error: malformed `derive` attribute input --> $DIR/malformed-special-attrs.rs:7:1 diff --git a/src/test/ui/mismatched_types/E0631.stderr b/src/test/ui/mismatched_types/E0631.stderr index 88c1efdbb90..06f5c058f81 100644 --- a/src/test/ui/mismatched_types/E0631.stderr +++ b/src/test/ui/mismatched_types/E0631.stderr @@ -46,3 +46,4 @@ LL | bar(f); error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0631`. diff --git a/src/test/ui/mismatched_types/abridged.stderr b/src/test/ui/mismatched_types/abridged.stderr index c2081878629..c73130643db 100644 --- a/src/test/ui/mismatched_types/abridged.stderr +++ b/src/test/ui/mismatched_types/abridged.stderr @@ -26,7 +26,10 @@ error[E0308]: mismatched types LL | fn b() -> Option<Foo> { | ----------- expected `std::option::Option<Foo>` because of return type LL | Foo { bar: 1 } - | ^^^^^^^^^^^^^^ expected enum `std::option::Option`, found struct `Foo` + | ^^^^^^^^^^^^^^ + | | + | expected enum `std::option::Option`, found struct `Foo` + | help: try using a variant of the expected enum: `Some(Foo { bar: 1 })` | = note: expected enum `std::option::Option<Foo>` found struct `Foo` @@ -37,7 +40,10 @@ error[E0308]: mismatched types LL | fn c() -> Result<Foo, Bar> { | ---------------- expected `std::result::Result<Foo, Bar>` because of return type LL | Foo { bar: 1 } - | ^^^^^^^^^^^^^^ expected enum `std::result::Result`, found struct `Foo` + | ^^^^^^^^^^^^^^ + | | + | expected enum `std::result::Result`, found struct `Foo` + | help: try using a variant of the expected enum: `Ok(Foo { bar: 1 })` | = note: expected enum `std::result::Result<Foo, Bar>` found struct `Foo` diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr index 85cad61210e..ed502824712 100644 --- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -45,4 +45,5 @@ LL | baz(f); error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0271`. +Some errors have detailed explanations: E0271, E0631. +For more information about an error, try `rustc --explain E0271`. diff --git a/src/test/ui/mismatched_types/closure-mismatch.stderr b/src/test/ui/mismatched_types/closure-mismatch.stderr index fd2b9f3c66b..f3874c0907b 100644 --- a/src/test/ui/mismatched_types/closure-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-mismatch.stderr @@ -24,4 +24,5 @@ LL | baz(|_| ()); error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0271`. +Some errors have detailed explanations: E0271, E0631. +For more information about an error, try `rustc --explain E0271`. diff --git a/src/test/ui/mismatched_types/fn-variance-1.stderr b/src/test/ui/mismatched_types/fn-variance-1.stderr index 1a82dd53edc..88c92661994 100644 --- a/src/test/ui/mismatched_types/fn-variance-1.stderr +++ b/src/test/ui/mismatched_types/fn-variance-1.stderr @@ -24,3 +24,4 @@ LL | apply(&mut 3, takes_imm); error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0631`. diff --git a/src/test/ui/mismatched_types/issue-36053-2.stderr b/src/test/ui/mismatched_types/issue-36053-2.stderr index 72f3220cc1a..da018aa8948 100644 --- a/src/test/ui/mismatched_types/issue-36053-2.stderr +++ b/src/test/ui/mismatched_types/issue-36053-2.stderr @@ -18,4 +18,5 @@ LL | once::<&str>("str").fuse().filter(|a: &str| true).count(); error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0599`. +Some errors have detailed explanations: E0599, E0631. +For more information about an error, try `rustc --explain E0599`. diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr index 2daf4781c7e..3c999f200d9 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr @@ -12,3 +12,4 @@ LL | let z = call_it(3, f); error: aborting due to previous error +For more information about this error, try `rustc --explain E0631`. diff --git a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr index abeffee4d3f..3d79ff0b706 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr +++ b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr @@ -4,7 +4,7 @@ note: No external requirements LL | let mut closure = expect_sig(|p, y| *p = y); | ^^^^^^^^^^^^^ | - = note: defining type: DefId(0:4 ~ escape_argument_callee[317d]::test[0]::{{closure}}[0]) with closure substs [ + = note: defining type: test::{{closure}}#0 with closure substs [ i16, for<'r, 's, 't0> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) mut &ReLateBound(DebruijnIndex(0), BrNamed('s)) i32, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) i32)), ] @@ -30,7 +30,7 @@ LL | | deref(p); LL | | } | |_^ | - = note: defining type: DefId(0:3 ~ escape_argument_callee[317d]::test[0]) with substs [] + = note: defining type: test error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/escape-argument.stderr b/src/test/ui/nll/closure-requirements/escape-argument.stderr index f750d15533b..37f04af6378 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument.stderr +++ b/src/test/ui/nll/closure-requirements/escape-argument.stderr @@ -4,7 +4,7 @@ note: No external requirements LL | let mut closure = expect_sig(|p, y| *p = y); | ^^^^^^^^^^^^^ | - = note: defining type: DefId(0:4 ~ escape_argument[317d]::test[0]::{{closure}}[0]) with closure substs [ + = note: defining type: test::{{closure}}#0 with closure substs [ i16, for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) mut &ReLateBound(DebruijnIndex(0), BrNamed('s)) i32, &ReLateBound(DebruijnIndex(0), BrNamed('s)) i32)), ] @@ -21,7 +21,7 @@ LL | | deref(p); LL | | } | |_^ | - = note: defining type: DefId(0:3 ~ escape_argument[317d]::test[0]) with substs [] + = note: defining type: test error[E0597]: `y` does not live long enough --> $DIR/escape-argument.rs:27:25 diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr index 7c4d48cdf9f..810c0286cf2 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr +++ b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr @@ -4,7 +4,7 @@ note: External requirements LL | let mut closure1 = || p = &y; | ^^^^^^^^^ | - = note: defining type: DefId(0:5 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]::{{closure}}[0]) with closure substs [ + = note: defining type: test::{{closure}}#0::{{closure}}#0 with closure substs [ i16, extern "rust-call" fn(()), &'_#1r i32, @@ -23,7 +23,7 @@ LL | | closure1(); LL | | }; | |_________^ | - = note: defining type: DefId(0:4 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]) with closure substs [ + = note: defining type: test::{{closure}}#0 with closure substs [ i16, extern "rust-call" fn(()), &'_#1r i32, @@ -44,7 +44,7 @@ LL | | deref(p); LL | | } | |_^ | - = note: defining type: DefId(0:3 ~ escape_upvar_nested[317d]::test[0]) with substs [] + = note: defining type: test error[E0597]: `y` does not live long enough --> $DIR/escape-upvar-nested.rs:21:40 diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr index 4446486808b..bf042769a00 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr +++ b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr @@ -4,7 +4,7 @@ note: External requirements LL | let mut closure = || p = &y; | ^^^^^^^^^ | - = note: defining type: DefId(0:4 ~ escape_upvar_ref[317d]::test[0]::{{closure}}[0]) with closure substs [ + = note: defining type: test::{{closure}}#0 with closure substs [ i16, extern "rust-call" fn(()), &'_#1r i32, @@ -25,7 +25,7 @@ LL | | deref(p); LL | | } | |_^ | - = note: defining type: DefId(0:3 ~ escape_upvar_ref[317d]::test[0]) with substs [] + = note: defining type: test error[E0597]: `y` does not live long enough --> $DIR/escape-upvar-ref.rs:23:35 diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr index 92f30d400f2..4e3aa352fff 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr @@ -8,7 +8,7 @@ LL | | demand_y(x, y, p) LL | | }, | |_________^ | - = note: defining type: DefId(0:18 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]::{{closure}}[0]) with closure substs [ + = note: defining type: supply::{{closure}}#0 with closure substs [ i16, for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) &'_#3r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>)), ] @@ -39,7 +39,7 @@ LL | | ); LL | | } | |_^ | - = note: defining type: DefId(0:14 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]) with substs [] + = note: defining type: supply error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr index 00bb66afbe5..cd61b8b5e55 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -9,7 +9,7 @@ LL | | LL | | }); | |_____^ | - = note: defining type: DefId(0:16 ~ propagate_approximated_ref[317d]::supply[0]::{{closure}}[0]) with closure substs [ + = note: defining type: supply::{{closure}}#0 with closure substs [ i16, for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) u32>)), ] @@ -30,7 +30,7 @@ LL | | }); LL | | } | |_^ | - = note: defining type: DefId(0:13 ~ propagate_approximated_ref[317d]::supply[0]) with substs [] + = note: defining type: supply error: lifetime may not live long enough --> $DIR/propagate-approximated-ref.rs:45:9 diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr index 2b05503b58d..259140c2e5a 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr @@ -8,7 +8,7 @@ LL | | LL | | }) | |_____^ | - = note: defining type: DefId(0:9 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]) with closure substs [ + = note: defining type: case1::{{closure}}#0 with closure substs [ i32, for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>)), ] @@ -35,7 +35,7 @@ LL | | }) LL | | } | |_^ | - = note: defining type: DefId(0:8 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]) with substs [] + = note: defining type: case1 note: External requirements --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:35:15 @@ -46,7 +46,7 @@ LL | | cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static LL | | }) | |_____^ | - = note: defining type: DefId(0:11 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]::{{closure}}[0]) with closure substs [ + = note: defining type: case2::{{closure}}#0 with closure substs [ i32, for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>)), ] @@ -65,7 +65,7 @@ LL | | }) LL | | } | |_^ | - = note: defining type: DefId(0:10 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]) with substs [] + = note: defining type: case2 error[E0597]: `a` does not live long enough --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26 diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr index ee0f0b7e65d..b3dd682e4f0 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr @@ -10,7 +10,7 @@ LL | | demand_y(x, y, x.get()) LL | | }); | |_____^ | - = note: defining type: DefId(0:16 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [ + = note: defining type: supply::{{closure}}#0 with closure substs [ i16, for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t1)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t2)) u32>)), ] @@ -31,7 +31,7 @@ LL | | }); LL | | } | |_^ | - = note: defining type: DefId(0:13 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]) with substs [] + = note: defining type: supply error[E0521]: borrowed data escapes outside of function --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:32:5 diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr index 611a129e00c..ab12d08f7b7 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr @@ -10,7 +10,7 @@ LL | | demand_y(x, y, x.get()) LL | | }); | |_____^ | - = note: defining type: DefId(0:16 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [ + = note: defining type: supply::{{closure}}#0 with closure substs [ i16, for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BrNamed('t1)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) u32>)), ] @@ -31,7 +31,7 @@ LL | | }); LL | | } | |_^ | - = note: defining type: DefId(0:13 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]) with substs [] + = note: defining type: supply error[E0521]: borrowed data escapes outside of function --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:35:5 diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr index 9328d05518c..b2209e9cab0 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr @@ -9,7 +9,7 @@ LL | | LL | | }); | |_____^ | - = note: defining type: DefId(0:16 ~ propagate_approximated_val[317d]::test[0]::{{closure}}[0]) with closure substs [ + = note: defining type: test::{{closure}}#0 with closure substs [ i16, for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>)), ] @@ -30,7 +30,7 @@ LL | | }); LL | | } | |_^ | - = note: defining type: DefId(0:13 ~ propagate_approximated_val[317d]::test[0]) with substs [] + = note: defining type: test error: lifetime may not live long enough --> $DIR/propagate-approximated-val.rs:38:9 diff --git a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr index afac5267c48..55ee515a3a8 100644 --- a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr @@ -8,7 +8,7 @@ LL | | demand_y(x, y, p) LL | | }, | |_________^ | - = note: defining type: DefId(0:14 ~ propagate_despite_same_free_region[317d]::supply[0]::{{closure}}[0]) with closure substs [ + = note: defining type: supply::{{closure}}#0 with closure substs [ i16, for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>)), ] @@ -28,5 +28,5 @@ LL | | ); LL | | } | |_^ | - = note: defining type: DefId(0:12 ~ propagate_despite_same_free_region[317d]::supply[0]) with substs [] + = note: defining type: supply diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr index 9699e8fbdf8..1c29af8c422 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr @@ -9,7 +9,7 @@ LL | | LL | | }); | |_____^ | - = note: defining type: DefId(0:16 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [ + = note: defining type: supply::{{closure}}#0 with closure substs [ i16, for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>)), ] @@ -39,7 +39,7 @@ LL | | }); LL | | } | |_^ | - = note: defining type: DefId(0:13 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]) with substs [] + = note: defining type: supply error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr index 2a18079cdc3..afa0e9f619d 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr @@ -9,7 +9,7 @@ LL | | LL | | }); | |_____^ | - = note: defining type: DefId(0:16 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [ + = note: defining type: supply::{{closure}}#0 with closure substs [ i16, for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) u32>)), ] @@ -39,7 +39,7 @@ LL | | }); LL | | } | |_^ | - = note: defining type: DefId(0:13 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]) with substs [] + = note: defining type: supply error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr index 0d622654c52..0dbb530e698 100644 --- a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr @@ -11,9 +11,7 @@ LL | | require(value); LL | | }); | |_____^ | - = note: defining type: DefId(0:14 ~ propagate_from_trait_match[317d]::supply[0]::{{closure}}[0]) with closure substs [ - '_#1r, - T, + = note: defining type: supply::<'_#1r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((T,)), ] @@ -32,10 +30,7 @@ LL | | }); LL | | } | |_^ | - = note: defining type: DefId(0:11 ~ propagate_from_trait_match[317d]::supply[0]) with substs [ - '_#1r, - T, - ] + = note: defining type: supply::<'_#1r, T> error[E0309]: the parameter type `T` may not live long enough --> $DIR/propagate-from-trait-match.rs:32:36 diff --git a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr index 8ce0b7758b0..ca794d92666 100644 --- a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr +++ b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr @@ -4,7 +4,7 @@ note: No external requirements LL | expect_sig(|a, b| b); // ought to return `a` | ^^^^^^^^ | - = note: defining type: DefId(0:4 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]) with closure substs [ + = note: defining type: test::{{closure}}#0 with closure substs [ i16, for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) i32, &ReLateBound(DebruijnIndex(0), BrNamed('s)) i32)) -> &ReLateBound(DebruijnIndex(0), BrNamed('r)) i32, ] @@ -27,7 +27,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0:3 ~ return_wrong_bound_region[317d]::test[0]) with substs [] + = note: defining type: test error: aborting due to previous error diff --git a/src/test/ui/nll/issue-55394.stderr b/src/test/ui/nll/issue-55394.stderr index 714a63b670c..69a6ab004fd 100644 --- a/src/test/ui/nll/issue-55394.stderr +++ b/src/test/ui/nll/issue-55394.stderr @@ -21,9 +21,13 @@ note: but, the lifetime must be valid for the lifetime `'_` as defined on the im | LL | impl Foo<'_> { | ^^ - = note: ...so that the expression is assignable: - expected Foo<'_> - found Foo<'_> +note: ...so that the expression is assignable + --> $DIR/issue-55394.rs:9:9 + | +LL | Foo { bar } + | ^^^^^^^^^^^ + = note: expected `Foo<'_>` + found `Foo<'_>` error: aborting due to previous error diff --git a/src/test/ui/nll/normalization-bounds-error.stderr b/src/test/ui/nll/normalization-bounds-error.stderr index 3a152fbc6fc..58f206742f4 100644 --- a/src/test/ui/nll/normalization-bounds-error.stderr +++ b/src/test/ui/nll/normalization-bounds-error.stderr @@ -14,9 +14,13 @@ note: ...but the lifetime must also be valid for the lifetime `'a` as defined on | LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} | ^^ - = note: ...so that the types are compatible: - expected Visitor<'d> - found Visitor<'_> +note: ...so that the types are compatible + --> $DIR/normalization-bounds-error.rs:12:1 + | +LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected `Visitor<'d>` + found `Visitor<'_>` error: aborting due to previous error diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr index dd61023a15b..c825227cdad 100644 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -4,9 +4,7 @@ note: External requirements LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:13 ~ projection_no_regions_closure[317d]::no_region[0]::{{closure}}[0]) with closure substs [ - '_#1r, - T, + = note: defining type: no_region::<'_#1r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#2r)>, ] @@ -25,10 +23,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0:10 ~ projection_no_regions_closure[317d]::no_region[0]) with substs [ - '_#1r, - T, - ] + = note: defining type: no_region::<'_#1r, T> error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough --> $DIR/projection-no-regions-closure.rs:25:23 @@ -44,9 +39,7 @@ note: External requirements LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:17 ~ projection_no_regions_closure[317d]::correct_region[0]::{{closure}}[0]) with closure substs [ - '_#1r, - T, + = note: defining type: correct_region::<'_#1r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#2r)>, ] @@ -64,10 +57,7 @@ LL | | with_signature(x, |mut y| Box::new(y.next())) LL | | } | |_^ | - = note: defining type: DefId(0:14 ~ projection_no_regions_closure[317d]::correct_region[0]) with substs [ - '_#1r, - T, - ] + = note: defining type: correct_region::<'_#1r, T> note: External requirements --> $DIR/projection-no-regions-closure.rs:42:23 @@ -75,10 +65,7 @@ note: External requirements LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:22 ~ projection_no_regions_closure[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - T, + = note: defining type: wrong_region::<'_#1r, '_#2r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#3r)>, ] @@ -97,11 +84,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0:18 ~ projection_no_regions_closure[317d]::wrong_region[0]) with substs [ - '_#1r, - '_#2r, - T, - ] + = note: defining type: wrong_region::<'_#1r, '_#2r, T> error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough --> $DIR/projection-no-regions-closure.rs:42:23 @@ -117,10 +100,7 @@ note: External requirements LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:27 ~ projection_no_regions_closure[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - T, + = note: defining type: outlives_region::<'_#1r, '_#2r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#3r)>, ] @@ -139,11 +119,7 @@ LL | | with_signature(x, |mut y| Box::new(y.next())) LL | | } | |_^ | - = note: defining type: DefId(0:23 ~ projection_no_regions_closure[317d]::outlives_region[0]) with substs [ - '_#1r, - '_#2r, - T, - ] + = note: defining type: outlives_region::<'_#1r, '_#2r, T> error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr index d9cbc71f954..7226c520bf1 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr @@ -4,9 +4,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:19 ~ projection_one_region_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [ - '_#1r, - T, + = note: defining type: no_relationships_late::<'_#1r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), ] @@ -27,10 +25,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0:15 ~ projection_one_region_closure[317d]::no_relationships_late[0]) with substs [ - '_#1r, - T, - ] + = note: defining type: no_relationships_late::<'_#1r, T> error[E0309]: the parameter type `T` may not live long enough --> $DIR/projection-one-region-closure.rs:45:29 @@ -59,10 +54,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:24 ~ projection_one_region_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - T, + = note: defining type: no_relationships_early::<'_#1r, '_#2r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), ] @@ -82,11 +74,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0:20 ~ projection_one_region_closure[317d]::no_relationships_early[0]) with substs [ - '_#1r, - '_#2r, - T, - ] + = note: defining type: no_relationships_early::<'_#1r, '_#2r, T> error[E0309]: the parameter type `T` may not live long enough --> $DIR/projection-one-region-closure.rs:56:29 @@ -115,10 +103,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:29 ~ projection_one_region_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - T, + = note: defining type: projection_outlives::<'_#1r, '_#2r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), ] @@ -137,11 +122,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0:25 ~ projection_one_region_closure[317d]::projection_outlives[0]) with substs [ - '_#1r, - '_#2r, - T, - ] + = note: defining type: projection_outlives::<'_#1r, '_#2r, T> note: External requirements --> $DIR/projection-one-region-closure.rs:80:29 @@ -149,10 +130,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:34 ~ projection_one_region_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - T, + = note: defining type: elements_outlive::<'_#1r, '_#2r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), ] @@ -172,11 +150,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0:30 ~ projection_one_region_closure[317d]::elements_outlive[0]) with substs [ - '_#1r, - '_#2r, - T, - ] + = note: defining type: elements_outlive::<'_#1r, '_#2r, T> error: aborting due to 4 previous errors diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr index 0be25de72f3..655995c1b80 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr @@ -4,9 +4,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:19 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [ - '_#1r, - T, + = note: defining type: no_relationships_late::<'_#1r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), ] @@ -26,10 +24,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0:15 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [ - '_#1r, - T, - ] + = note: defining type: no_relationships_late::<'_#1r, T> error: lifetime may not live long enough --> $DIR/projection-one-region-trait-bound-closure.rs:37:39 @@ -50,10 +45,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:24 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - T, + = note: defining type: no_relationships_early::<'_#1r, '_#2r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), ] @@ -72,11 +64,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0:20 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [ - '_#1r, - '_#2r, - T, - ] + = note: defining type: no_relationships_early::<'_#1r, '_#2r, T> error: lifetime may not live long enough --> $DIR/projection-one-region-trait-bound-closure.rs:47:39 @@ -97,10 +85,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:29 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - T, + = note: defining type: projection_outlives::<'_#1r, '_#2r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), ] @@ -119,11 +104,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0:25 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [ - '_#1r, - '_#2r, - T, - ] + = note: defining type: projection_outlives::<'_#1r, '_#2r, T> note: External requirements --> $DIR/projection-one-region-trait-bound-closure.rs:69:29 @@ -131,10 +112,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:34 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - T, + = note: defining type: elements_outlive::<'_#1r, '_#2r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), ] @@ -153,11 +131,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0:30 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]) with substs [ - '_#1r, - '_#2r, - T, - ] + = note: defining type: elements_outlive::<'_#1r, '_#2r, T> note: External requirements --> $DIR/projection-one-region-trait-bound-closure.rs:81:29 @@ -165,9 +139,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:38 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [ - '_#1r, - T, + = note: defining type: one_region::<'_#1r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), ] @@ -186,10 +158,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0:35 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]) with substs [ - '_#1r, - T, - ] + = note: defining type: one_region::<'_#1r, T> error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr index 9cc2e504e10..2fb07b9279a 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr @@ -4,9 +4,7 @@ note: No external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:19 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [ - '_#1r, - T, + = note: defining type: no_relationships_late::<'_#1r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), ] @@ -23,10 +21,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0:15 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]) with substs [ - '_#1r, - T, - ] + = note: defining type: no_relationships_late::<'_#1r, T> note: No external requirements --> $DIR/projection-one-region-trait-bound-static-closure.rs:45:29 @@ -34,10 +29,7 @@ note: No external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:24 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - T, + = note: defining type: no_relationships_early::<'_#1r, '_#2r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), ] @@ -54,11 +46,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0:20 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]) with substs [ - '_#1r, - '_#2r, - T, - ] + = note: defining type: no_relationships_early::<'_#1r, '_#2r, T> note: No external requirements --> $DIR/projection-one-region-trait-bound-static-closure.rs:64:29 @@ -66,10 +54,7 @@ note: No external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:29 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - T, + = note: defining type: projection_outlives::<'_#1r, '_#2r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), ] @@ -86,11 +71,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0:25 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]) with substs [ - '_#1r, - '_#2r, - T, - ] + = note: defining type: projection_outlives::<'_#1r, '_#2r, T> note: No external requirements --> $DIR/projection-one-region-trait-bound-static-closure.rs:73:29 @@ -98,10 +79,7 @@ note: No external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:34 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - T, + = note: defining type: elements_outlive::<'_#1r, '_#2r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), ] @@ -118,11 +96,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0:30 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]) with substs [ - '_#1r, - '_#2r, - T, - ] + = note: defining type: elements_outlive::<'_#1r, '_#2r, T> note: No external requirements --> $DIR/projection-one-region-trait-bound-static-closure.rs:85:29 @@ -130,9 +104,7 @@ note: No external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:38 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [ - '_#1r, - T, + = note: defining type: one_region::<'_#1r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), ] @@ -149,8 +121,5 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0:35 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]) with substs [ - '_#1r, - T, - ] + = note: defining type: one_region::<'_#1r, T> diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index ed53ce91133..501a55e3105 100644 --- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -4,10 +4,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:22 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - T, + = note: defining type: no_relationships_late::<'_#1r, '_#2r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), ] @@ -27,11 +24,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0:17 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [ - '_#1r, - '_#2r, - T, - ] + = note: defining type: no_relationships_late::<'_#1r, '_#2r, T> error[E0309]: the associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may not live long enough --> $DIR/projection-two-region-trait-bound-closure.rs:38:29 @@ -47,11 +40,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:28 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - '_#3r, - T, + = note: defining type: no_relationships_early::<'_#1r, '_#2r, '_#3r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#4r ()>, T)), ] @@ -70,12 +59,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0:23 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [ - '_#1r, - '_#2r, - '_#3r, - T, - ] + = note: defining type: no_relationships_early::<'_#1r, '_#2r, '_#3r, T> error[E0309]: the associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough --> $DIR/projection-two-region-trait-bound-closure.rs:48:29 @@ -91,11 +75,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:34 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - '_#3r, - T, + = note: defining type: projection_outlives::<'_#1r, '_#2r, '_#3r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#4r ()>, T)), ] @@ -114,12 +94,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0:29 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [ - '_#1r, - '_#2r, - '_#3r, - T, - ] + = note: defining type: projection_outlives::<'_#1r, '_#2r, '_#3r, T> note: External requirements --> $DIR/projection-two-region-trait-bound-closure.rs:70:29 @@ -127,11 +102,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:40 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - '_#3r, - T, + = note: defining type: elements_outlive1::<'_#1r, '_#2r, '_#3r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#4r ()>, T)), ] @@ -150,12 +121,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0:35 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]) with substs [ - '_#1r, - '_#2r, - '_#3r, - T, - ] + = note: defining type: elements_outlive1::<'_#1r, '_#2r, '_#3r, T> note: External requirements --> $DIR/projection-two-region-trait-bound-closure.rs:79:29 @@ -163,11 +129,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:46 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - '_#3r, - T, + = note: defining type: elements_outlive2::<'_#1r, '_#2r, '_#3r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#4r ()>, T)), ] @@ -186,12 +148,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0:41 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]) with substs [ - '_#1r, - '_#2r, - '_#3r, - T, - ] + = note: defining type: elements_outlive2::<'_#1r, '_#2r, '_#3r, T> note: External requirements --> $DIR/projection-two-region-trait-bound-closure.rs:87:29 @@ -199,9 +156,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:51 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]::{{closure}}[0]) with closure substs [ - '_#1r, - T, + = note: defining type: two_regions::<'_#1r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), ] @@ -221,10 +176,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0:47 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]) with substs [ - '_#1r, - T, - ] + = note: defining type: two_regions::<'_#1r, T> error: lifetime may not live long enough --> $DIR/projection-two-region-trait-bound-closure.rs:87:29 @@ -245,10 +197,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:56 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - T, + = note: defining type: two_regions_outlive::<'_#1r, '_#2r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), ] @@ -267,11 +216,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0:52 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]) with substs [ - '_#1r, - '_#2r, - T, - ] + = note: defining type: two_regions_outlive::<'_#1r, '_#2r, T> note: External requirements --> $DIR/projection-two-region-trait-bound-closure.rs:109:29 @@ -279,9 +224,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:60 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [ - '_#1r, - T, + = note: defining type: one_region::<'_#1r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), ] @@ -300,10 +243,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0:57 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]) with substs [ - '_#1r, - T, - ] + = note: defining type: one_region::<'_#1r, T> error: aborting due to 3 previous errors diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr index e2a9bd7e3cd..db0bca1dec6 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr @@ -4,8 +4,7 @@ note: External requirements LL | twice(cell, value, |a, b| invoke(a, b)); | ^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:11 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]::{{closure}}[0]) with closure substs [ - T, + = note: defining type: generic::<T>::{{closure}}#0 with closure substs [ i16, for<'r, 's> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('r)) ()>>, &ReLateBound(DebruijnIndex(0), BrNamed('s)) T)), ] @@ -21,9 +20,7 @@ LL | | twice(cell, value, |a, b| invoke(a, b)); LL | | } | |_^ | - = note: defining type: DefId(0:9 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]) with substs [ - T, - ] + = note: defining type: generic::<T> note: External requirements --> $DIR/ty-param-closure-approximate-lower-bound.rs:29:24 @@ -31,8 +28,7 @@ note: External requirements LL | twice(cell, value, |a, b| invoke(a, b)); | ^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0:15 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]::{{closure}}[0]) with closure substs [ - T, + = note: defining type: generic_fail::<T>::{{closure}}#0 with closure substs [ i16, for<'r, 's> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('r)) ()>>, &ReLateBound(DebruijnIndex(0), BrNamed('s)) T)), ] @@ -49,9 +45,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0:12 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]) with substs [ - T, - ] + = note: defining type: generic_fail::<T> error[E0309]: the parameter type `T` may not live long enough --> $DIR/ty-param-closure-approximate-lower-bound.rs:29:24 diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr index 7c8dc94eda9..0021d730f85 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr @@ -4,9 +4,7 @@ note: External requirements LL | with_signature(x, |y| y) | ^^^^^ | - = note: defining type: DefId(0:11 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]::{{closure}}[0]) with closure substs [ - '_#1r, - T, + = note: defining type: no_region::<'_#1r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn std::fmt::Debug + '_#2r)>, ] @@ -25,10 +23,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0:8 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]) with substs [ - '_#1r, - T, - ] + = note: defining type: no_region::<'_#1r, T> error[E0309]: the parameter type `T` may not live long enough --> $DIR/ty-param-closure-outlives-from-return-type.rs:26:23 diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr index ffd936b58be..46fef8ee506 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr @@ -11,8 +11,7 @@ LL | | require(&x, &y) LL | | }) | |_____^ | - = note: defining type: DefId(0:14 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]::{{closure}}[0]) with closure substs [ - T, + = note: defining type: no_region::<T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#1r ()>, T)), ] @@ -32,9 +31,7 @@ LL | | }) LL | | } | |_^ | - = note: defining type: DefId(0:11 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]) with substs [ - T, - ] + = note: defining type: no_region::<T> error[E0309]: the parameter type `T` may not live long enough --> $DIR/ty-param-closure-outlives-from-where-clause.rs:27:26 @@ -64,9 +61,7 @@ LL | | require(&x, &y) LL | | }) | |_____^ | - = note: defining type: DefId(0:18 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]::{{closure}}[0]) with closure substs [ - '_#1r, - T, + = note: defining type: correct_region::<'_#1r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), ] @@ -85,10 +80,7 @@ LL | | }) LL | | } | |_^ | - = note: defining type: DefId(0:15 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]) with substs [ - '_#1r, - T, - ] + = note: defining type: correct_region::<'_#1r, T> note: External requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:64:26 @@ -101,9 +93,7 @@ LL | | require(&x, &y) LL | | }) | |_____^ | - = note: defining type: DefId(0:23 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [ - '_#1r, - T, + = note: defining type: wrong_region::<'_#1r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), ] @@ -123,10 +113,7 @@ LL | | }) LL | | } | |_^ | - = note: defining type: DefId(0:19 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]) with substs [ - '_#1r, - T, - ] + = note: defining type: wrong_region::<'_#1r, T> error[E0309]: the parameter type `T` may not live long enough --> $DIR/ty-param-closure-outlives-from-where-clause.rs:64:26 @@ -151,10 +138,7 @@ LL | | require(&x, &y) LL | | }) | |_____^ | - = note: defining type: DefId(0:28 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [ - '_#1r, - '_#2r, - T, + = note: defining type: outlives_region::<'_#1r, '_#2r, T>::{{closure}}#0 with closure substs [ i32, extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), ] @@ -173,11 +157,7 @@ LL | | }) LL | | } | |_^ | - = note: defining type: DefId(0:24 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]) with substs [ - '_#1r, - '_#2r, - T, - ] + = note: defining type: outlives_region::<'_#1r, '_#2r, T> error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/type-alias-free-regions.stderr b/src/test/ui/nll/type-alias-free-regions.stderr index 6986389af88..5191deca281 100644 --- a/src/test/ui/nll/type-alias-free-regions.stderr +++ b/src/test/ui/nll/type-alias-free-regions.stderr @@ -11,17 +11,25 @@ LL | / fn from_box(b: Box<B>) -> Self { LL | | C { f: b } LL | | } | |_____^ - = note: ...so that the expression is assignable: - expected std::boxed::Box<std::boxed::Box<&isize>> - found std::boxed::Box<std::boxed::Box<&isize>> +note: ...so that the expression is assignable + --> $DIR/type-alias-free-regions.rs:17:16 + | +LL | C { f: b } + | ^ + = note: expected `std::boxed::Box<std::boxed::Box<&isize>>` + found `std::boxed::Box<std::boxed::Box<&isize>>` note: but, the lifetime must be valid for the lifetime `'a` as defined on the impl at 15:6... --> $DIR/type-alias-free-regions.rs:15:6 | LL | impl<'a> FromBox<'a> for C<'a> { | ^^ - = note: ...so that the expression is assignable: - expected C<'a> - found C<'_> +note: ...so that the expression is assignable + --> $DIR/type-alias-free-regions.rs:17:9 + | +LL | C { f: b } + | ^^^^^^^^^^ + = note: expected `C<'a>` + found `C<'_>` error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/type-alias-free-regions.rs:27:16 @@ -36,17 +44,25 @@ LL | / fn from_tuple(b: (B,)) -> Self { LL | | C { f: Box::new(b.0) } LL | | } | |_____^ - = note: ...so that the expression is assignable: - expected std::boxed::Box<&isize> - found std::boxed::Box<&isize> +note: ...so that the expression is assignable + --> $DIR/type-alias-free-regions.rs:27:25 + | +LL | C { f: Box::new(b.0) } + | ^^^ + = note: expected `std::boxed::Box<&isize>` + found `std::boxed::Box<&isize>` note: but, the lifetime must be valid for the lifetime `'a` as defined on the impl at 25:6... --> $DIR/type-alias-free-regions.rs:25:6 | LL | impl<'a> FromTuple<'a> for C<'a> { | ^^ - = note: ...so that the expression is assignable: - expected C<'a> - found C<'_> +note: ...so that the expression is assignable + --> $DIR/type-alias-free-regions.rs:27:9 + | +LL | C { f: Box::new(b.0) } + | ^^^^^^^^^^^^^^^^^^^^^^ + = note: expected `C<'a>` + found `C<'_>` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr index 4ebd9910788..37be450fd0a 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr @@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the fun | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | ^^ - = note: ...so that the types are compatible: - expected Foo<'_> - found Foo<'a> +note: ...so that the types are compatible + --> $DIR/constant-in-expr-inherent-1.rs:8:5 + | +LL | <Foo<'a>>::C + | ^^^^^^^^^^^^ + = note: expected `Foo<'_>` + found `Foo<'a>` = note: but, the lifetime must be valid for the static lifetime... note: ...so that reference does not outlive borrowed content --> $DIR/constant-in-expr-inherent-1.rs:8:5 diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr index d61659e7e9a..4ee32847c5e 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr @@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the fun | LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { | ^^ - = note: ...so that the types are compatible: - expected Foo<'_> - found Foo<'a> +note: ...so that the types are compatible + --> $DIR/constant-in-expr-trait-item-3.rs:10:5 + | +LL | T::C + | ^^^^ + = note: expected `Foo<'_>` + found `Foo<'a>` = note: but, the lifetime must be valid for the static lifetime... note: ...so that reference does not outlive borrowed content --> $DIR/constant-in-expr-trait-item-3.rs:10:5 diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr b/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr index d66322c48ec..1952ee8269d 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr @@ -19,9 +19,13 @@ note: but, the lifetime must be valid for the lifetime `'b` as defined on the fu | LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { | ^^ - = note: ...so that the expression is assignable: - expected &'b (dyn SomeTrait + 'b) - found &dyn SomeTrait +note: ...so that the expression is assignable + --> $DIR/object-lifetime-default-elision.rs:71:5 + | +LL | ss + | ^^ + = note: expected `&'b (dyn SomeTrait + 'b)` + found `&dyn SomeTrait` error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/object-lifetime-default-elision.rs:71:5 @@ -44,9 +48,13 @@ note: but, the lifetime must be valid for the lifetime `'b` as defined on the fu | LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { | ^^ - = note: ...so that the expression is assignable: - expected &'b (dyn SomeTrait + 'b) - found &dyn SomeTrait +note: ...so that the expression is assignable + --> $DIR/object-lifetime-default-elision.rs:71:5 + | +LL | ss + | ^^ + = note: expected `&'b (dyn SomeTrait + 'b)` + found `&dyn SomeTrait` error: aborting due to 2 previous errors diff --git a/src/test/ui/on-unimplemented/expected-comma-found-token.rs b/src/test/ui/on-unimplemented/expected-comma-found-token.rs index 77c0ea17269..8fb34f21152 100644 --- a/src/test/ui/on-unimplemented/expected-comma-found-token.rs +++ b/src/test/ui/on-unimplemented/expected-comma-found-token.rs @@ -6,7 +6,7 @@ #[rustc_on_unimplemented( message="the message" - label="the label" //~ ERROR expected one of `)` or `,`, found `label` + label="the label" //~ ERROR expected `,`, found `label` )] trait T {} diff --git a/src/test/ui/on-unimplemented/expected-comma-found-token.stderr b/src/test/ui/on-unimplemented/expected-comma-found-token.stderr index 2e1d484e05a..048b72ee3bc 100644 --- a/src/test/ui/on-unimplemented/expected-comma-found-token.stderr +++ b/src/test/ui/on-unimplemented/expected-comma-found-token.stderr @@ -1,11 +1,8 @@ -error: expected one of `)` or `,`, found `label` +error: expected `,`, found `label` --> $DIR/expected-comma-found-token.rs:9:5 | LL | message="the message" - | - - | | - | expected one of `)` or `,` - | help: missing `,` + | - expected `,` LL | label="the label" | ^^^^^ unexpected token diff --git a/src/test/ui/parser/raw/raw-literal-keywords.rs b/src/test/ui/parser/raw/raw-literal-keywords.rs index bf9cbcdab2e..a986980fab9 100644 --- a/src/test/ui/parser/raw/raw-literal-keywords.rs +++ b/src/test/ui/parser/raw/raw-literal-keywords.rs @@ -11,11 +11,11 @@ fn test_union() { } fn test_if_2() { - let _ = r#if; //~ ERROR cannot find value `if` in this scope + let _ = r#if; //~ ERROR cannot find value `r#if` in this scope } fn test_struct_2() { - let _ = r#struct; //~ ERROR cannot find value `struct` in this scope + let _ = r#struct; //~ ERROR cannot find value `r#struct` in this scope } fn test_union_2() { diff --git a/src/test/ui/parser/raw/raw-literal-keywords.stderr b/src/test/ui/parser/raw/raw-literal-keywords.stderr index fd8eda3770d..f7b6c894a90 100644 --- a/src/test/ui/parser/raw/raw-literal-keywords.stderr +++ b/src/test/ui/parser/raw/raw-literal-keywords.stderr @@ -16,13 +16,13 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found LL | r#union Test; | ^^^^ expected one of 8 possible tokens -error[E0425]: cannot find value `if` in this scope +error[E0425]: cannot find value `r#if` in this scope --> $DIR/raw-literal-keywords.rs:14:13 | LL | let _ = r#if; | ^^^^ not found in this scope -error[E0425]: cannot find value `struct` in this scope +error[E0425]: cannot find value `r#struct` in this scope --> $DIR/raw-literal-keywords.rs:18:13 | LL | let _ = r#struct; diff --git a/src/test/ui/proc-macro/span-preservation.stderr b/src/test/ui/proc-macro/span-preservation.stderr index cd6f0ea10ea..a77e92022e2 100644 --- a/src/test/ui/proc-macro/span-preservation.stderr +++ b/src/test/ui/proc-macro/span-preservation.stderr @@ -14,6 +14,11 @@ LL | fn b(x: Option<isize>) -> usize { LL | match x { LL | Some(x) => { return x }, | ^ expected `usize`, found `isize` + | +help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit + | +LL | Some(x) => { return x.try_into().unwrap() }, + | ^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/span-preservation.rs:33:22 diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr index 14934d6fa48..e8896516470 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr @@ -34,17 +34,25 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the fun | LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> { | ^^ - = note: ...so that the expression is assignable: - expected &[u8] - found &'a [u8] +note: ...so that the expression is assignable + --> $DIR/region-object-lifetime-in-coercion.rs:26:14 + | +LL | Box::new(v) + | ^ + = note: expected `&[u8]` + found `&'a [u8]` note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 25:9... --> $DIR/region-object-lifetime-in-coercion.rs:25:9 | LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> { | ^^ - = note: ...so that the expression is assignable: - expected std::boxed::Box<(dyn Foo + 'b)> - found std::boxed::Box<dyn Foo> +note: ...so that the expression is assignable + --> $DIR/region-object-lifetime-in-coercion.rs:26:5 + | +LL | Box::new(v) + | ^^^^^^^^^^^ + = note: expected `std::boxed::Box<(dyn Foo + 'b)>` + found `std::boxed::Box<dyn Foo>` error: aborting due to 4 previous errors diff --git a/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr b/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr index a636c9ef22c..865e967fba3 100644 --- a/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr +++ b/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr @@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the imp | LL | impl<'a> Foo<'static> for &'a i32 { | ^^ - = note: ...so that the types are compatible: - expected Foo<'static> - found Foo<'static> +note: ...so that the types are compatible + --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:14:10 + | +LL | impl<'a> Foo<'static> for &'a i32 { + | ^^^^^^^^^^^^ + = note: expected `Foo<'static>` + found `Foo<'static>` = note: but, the lifetime must be valid for the static lifetime... note: ...so that the type `&i32` will meet its required lifetime bounds --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:14:10 @@ -30,9 +34,13 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the imp | LL | impl<'a,'b> Foo<'b> for &'a i64 { | ^^ - = note: ...so that the types are compatible: - expected Foo<'b> - found Foo<'_> +note: ...so that the types are compatible + --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:13 + | +LL | impl<'a,'b> Foo<'b> for &'a i64 { + | ^^^^^^^ + = note: expected `Foo<'b>` + found `Foo<'_>` note: but, the lifetime must be valid for the lifetime `'b` as defined on the impl at 19:9... --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:9 | diff --git a/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr b/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr index 81256e3b46c..6a34871c07e 100644 --- a/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr +++ b/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr @@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the imp | LL | impl<'a> Foo for &'a i32 { | ^^ - = note: ...so that the types are compatible: - expected Foo - found Foo +note: ...so that the types are compatible + --> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:9:10 + | +LL | impl<'a> Foo for &'a i32 { + | ^^^ + = note: expected `Foo` + found `Foo` = note: but, the lifetime must be valid for the static lifetime... note: ...so that the type `&i32` will meet its required lifetime bounds --> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:9:10 diff --git a/src/test/ui/regions/regions-close-object-into-object-2.stderr b/src/test/ui/regions/regions-close-object-into-object-2.stderr index 8e473dad693..28873ab807f 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.stderr @@ -15,9 +15,13 @@ note: ...so that the type `(dyn A<T> + 'a)` is not borrowed for too long LL | box B(&*v) as Box<dyn X> | ^^^ = note: but, the lifetime must be valid for the static lifetime... - = note: ...so that the expression is assignable: - expected std::boxed::Box<(dyn X + 'static)> - found std::boxed::Box<dyn X> +note: ...so that the expression is assignable + --> $DIR/regions-close-object-into-object-2.rs:10:5 + | +LL | box B(&*v) as Box<dyn X> + | ^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected `std::boxed::Box<(dyn X + 'static)>` + found `std::boxed::Box<dyn X>` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-close-object-into-object-4.stderr b/src/test/ui/regions/regions-close-object-into-object-4.stderr index c80d13e15b1..449a5b5fdd4 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.stderr @@ -15,9 +15,13 @@ note: ...so that the type `(dyn A<U> + 'a)` is not borrowed for too long LL | box B(&*v) as Box<dyn X> | ^^^ = note: but, the lifetime must be valid for the static lifetime... - = note: ...so that the expression is assignable: - expected std::boxed::Box<(dyn X + 'static)> - found std::boxed::Box<dyn X> +note: ...so that the expression is assignable + --> $DIR/regions-close-object-into-object-4.rs:10:5 + | +LL | box B(&*v) as Box<dyn X> + | ^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected `std::boxed::Box<(dyn X + 'static)>` + found `std::boxed::Box<dyn X>` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr index ef21316ea83..b2a7afaf1b4 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr @@ -19,9 +19,13 @@ note: but, the lifetime must be valid for the lifetime `'c` as defined on the fu | LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box<dyn SomeTrait + 'c> { | ^^ - = note: ...so that the expression is assignable: - expected std::boxed::Box<(dyn SomeTrait + 'c)> - found std::boxed::Box<dyn SomeTrait> +note: ...so that the expression is assignable + --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 + | +LL | box v as Box<dyn SomeTrait + 'a> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected `std::boxed::Box<(dyn SomeTrait + 'c)>` + found `std::boxed::Box<dyn SomeTrait>` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-creating-enums4.stderr b/src/test/ui/regions/regions-creating-enums4.stderr index 12b89787d5f..58f74e4ee14 100644 --- a/src/test/ui/regions/regions-creating-enums4.stderr +++ b/src/test/ui/regions/regions-creating-enums4.stderr @@ -9,17 +9,25 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined on the fun | LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { | ^^ - = note: ...so that the expression is assignable: - expected &Ast<'_> - found &Ast<'a> +note: ...so that the expression is assignable + --> $DIR/regions-creating-enums4.rs:7:14 + | +LL | Ast::Add(x, y) + | ^ + = note: expected `&Ast<'_>` + found `&Ast<'a>` note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 6:19... --> $DIR/regions-creating-enums4.rs:6:19 | LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { | ^^ - = note: ...so that the expression is assignable: - expected Ast<'b> - found Ast<'_> +note: ...so that the expression is assignable + --> $DIR/regions-creating-enums4.rs:7:5 + | +LL | Ast::Add(x, y) + | ^^^^^^^^^^^^^^ + = note: expected `Ast<'b>` + found `Ast<'_>` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-escape-method.stderr b/src/test/ui/regions/regions-escape-method.stderr index b93dd0d4c57..ffc2a259485 100644 --- a/src/test/ui/regions/regions-escape-method.stderr +++ b/src/test/ui/regions/regions-escape-method.stderr @@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on th | LL | s.f(|p| p) | ^^^^^ - = note: ...so that the expression is assignable: - expected &i32 - found &i32 +note: ...so that the expression is assignable + --> $DIR/regions-escape-method.rs:15:13 + | +LL | s.f(|p| p) + | ^ + = note: expected `&i32` + found `&i32` note: but, the lifetime must be valid for the method call at 15:5... --> $DIR/regions-escape-method.rs:15:5 | diff --git a/src/test/ui/regions/regions-escape-via-trait-or-not.stderr b/src/test/ui/regions/regions-escape-via-trait-or-not.stderr index a6b165e2d44..90823464c56 100644 --- a/src/test/ui/regions/regions-escape-via-trait-or-not.stderr +++ b/src/test/ui/regions/regions-escape-via-trait-or-not.stderr @@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on th | LL | with(|o| o) | ^^^^^ - = note: ...so that the expression is assignable: - expected &isize - found &isize +note: ...so that the expression is assignable + --> $DIR/regions-escape-via-trait-or-not.rs:18:14 + | +LL | with(|o| o) + | ^ + = note: expected `&isize` + found `&isize` note: but, the lifetime must be valid for the expression at 18:5... --> $DIR/regions-escape-via-trait-or-not.rs:18:5 | diff --git a/src/test/ui/regions/regions-nested-fns.stderr b/src/test/ui/regions/regions-nested-fns.stderr index f4eb5c8644f..8fce1609d78 100644 --- a/src/test/ui/regions/regions-nested-fns.stderr +++ b/src/test/ui/regions/regions-nested-fns.stderr @@ -29,9 +29,18 @@ LL | | if false { return ay; } LL | | return z; LL | | })); | |_____^ - = note: ...so that the types are compatible: - expected &isize - found &isize +note: ...so that the types are compatible + --> $DIR/regions-nested-fns.rs:13:76 + | +LL | ignore::< Box<dyn for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { + | ____________________________________________________________________________^ +LL | | if false { return x; } +LL | | if false { return ay; } +LL | | return z; +LL | | })); + | |_____^ + = note: expected `&isize` + found `&isize` error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/regions-nested-fns.rs:14:27 diff --git a/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr b/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr index d29fd80943f..8a600d2a1e6 100644 --- a/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr +++ b/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr @@ -17,9 +17,16 @@ note: ...but the lifetime must also be valid for the lifetime `'b` as defined on | LL | fn bar<'a, 'b>() | ^^ - = note: ...so that the types are compatible: - expected Project<'a, 'b> - found Project<'_, '_> +note: ...so that the types are compatible + --> $DIR/regions-normalize-in-where-clause-list.rs:22:1 + | +LL | / fn bar<'a, 'b>() +LL | | where <() as Project<'a, 'b>>::Item : Eq +LL | | { +LL | | } + | |_^ + = note: expected `Project<'a, 'b>` + found `Project<'_, '_>` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-ret-borrowed-1.stderr b/src/test/ui/regions/regions-ret-borrowed-1.stderr index 49076673ad3..2895a0ccdee 100644 --- a/src/test/ui/regions/regions-ret-borrowed-1.stderr +++ b/src/test/ui/regions/regions-ret-borrowed-1.stderr @@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on th | LL | with(|o| o) | ^^^^^ - = note: ...so that the expression is assignable: - expected &isize - found &isize +note: ...so that the expression is assignable + --> $DIR/regions-ret-borrowed-1.rs:10:14 + | +LL | with(|o| o) + | ^ + = note: expected `&isize` + found `&isize` note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 9:14... --> $DIR/regions-ret-borrowed-1.rs:9:14 | diff --git a/src/test/ui/regions/regions-ret-borrowed.stderr b/src/test/ui/regions/regions-ret-borrowed.stderr index eb1ade27ace..b74f10f5075 100644 --- a/src/test/ui/regions/regions-ret-borrowed.stderr +++ b/src/test/ui/regions/regions-ret-borrowed.stderr @@ -9,9 +9,13 @@ note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on th | LL | with(|o| o) | ^^^^^ - = note: ...so that the expression is assignable: - expected &isize - found &isize +note: ...so that the expression is assignable + --> $DIR/regions-ret-borrowed.rs:13:14 + | +LL | with(|o| o) + | ^ + = note: expected `&isize` + found `&isize` note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 12:14... --> $DIR/regions-ret-borrowed.rs:12:14 | diff --git a/src/test/ui/regions/regions-trait-object-subtyping.stderr b/src/test/ui/regions/regions-trait-object-subtyping.stderr index ef69f2535dc..58b79d21270 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.stderr +++ b/src/test/ui/regions/regions-trait-object-subtyping.stderr @@ -36,9 +36,13 @@ note: but, the lifetime must be valid for the lifetime `'b` as defined on the fu | LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ - = note: ...so that the expression is assignable: - expected &'b mut (dyn Dummy + 'b) - found &mut (dyn Dummy + 'b) +note: ...so that the expression is assignable + --> $DIR/regions-trait-object-subtyping.rs:15:5 + | +LL | x + | ^ + = note: expected `&'b mut (dyn Dummy + 'b)` + found `&mut (dyn Dummy + 'b)` error[E0308]: mismatched types --> $DIR/regions-trait-object-subtyping.rs:22:5 diff --git a/src/test/ui/reject-specialized-drops-8142.stderr b/src/test/ui/reject-specialized-drops-8142.stderr index e55f0232ff9..527babb0120 100644 --- a/src/test/ui/reject-specialized-drops-8142.stderr +++ b/src/test/ui/reject-specialized-drops-8142.stderr @@ -105,9 +105,13 @@ note: ...but the lifetime must also be valid for the lifetime `'l2` as defined o | LL | struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 } | ^^^ - = note: ...so that the types are compatible: - expected W<'l1, 'l2> - found W<'_, '_> +note: ...so that the types are compatible + --> $DIR/reject-specialized-drops-8142.rs:54:1 + | +LL | impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected `W<'l1, 'l2>` + found `W<'_, '_>` error: aborting due to 8 previous errors diff --git a/src/test/ui/rfc-2091-track-caller/caller-location-intrinsic.rs b/src/test/ui/rfc-2091-track-caller/caller-location-intrinsic.rs index 1c4d4666fa1..0a79aea376f 100644 --- a/src/test/ui/rfc-2091-track-caller/caller-location-intrinsic.rs +++ b/src/test/ui/rfc-2091-track-caller/caller-location-intrinsic.rs @@ -1,21 +1,27 @@ // run-pass -#![feature(core_intrinsics)] +#![feature(track_caller)] + +#[inline(never)] +#[track_caller] +fn defeat_const_prop() -> &'static core::panic::Location<'static> { + core::panic::Location::caller() +} macro_rules! caller_location_from_macro { - () => (core::intrinsics::caller_location()); + () => (defeat_const_prop()); } fn main() { - let loc = core::intrinsics::caller_location(); + let loc = defeat_const_prop(); assert_eq!(loc.file(), file!()); - assert_eq!(loc.line(), 10); + assert_eq!(loc.line(), 16); assert_eq!(loc.column(), 15); - // `caller_location()` in a macro should behave similarly to `file!` and `line!`, + // `Location::caller()` in a macro should behave similarly to `file!` and `line!`, // i.e. point to where the macro was invoked, instead of the macro itself. let loc2 = caller_location_from_macro!(); assert_eq!(loc2.file(), file!()); - assert_eq!(loc2.line(), 17); + assert_eq!(loc2.line(), 23); assert_eq!(loc2.column(), 16); } diff --git a/src/test/ui/rfc-2091-track-caller/const-caller-location.rs b/src/test/ui/rfc-2091-track-caller/const-caller-location.rs new file mode 100644 index 00000000000..0614c52c660 --- /dev/null +++ b/src/test/ui/rfc-2091-track-caller/const-caller-location.rs @@ -0,0 +1,41 @@ +// run-pass + +#![feature(const_fn, track_caller)] + +use std::panic::Location; + +const LOCATION: &Location = Location::caller(); + +const TRACKED: &Location = tracked(); +#[track_caller] +const fn tracked() -> &'static Location <'static> { + Location::caller() +} + +const NESTED: &Location = nested_location(); +const fn nested_location() -> &'static Location<'static> { + Location::caller() +} + +const CONTAINED: &Location = contained(); +const fn contained() -> &'static Location<'static> { + tracked() +} + +fn main() { + assert_eq!(LOCATION.file(), file!()); + assert_eq!(LOCATION.line(), 7); + assert_eq!(LOCATION.column(), 29); + + assert_eq!(TRACKED.file(), file!()); + assert_eq!(TRACKED.line(), 9); + assert_eq!(TRACKED.column(), 28); + + assert_eq!(NESTED.file(), file!()); + assert_eq!(NESTED.line(), 17); + assert_eq!(NESTED.column(), 5); + + assert_eq!(CONTAINED.file(), file!()); + assert_eq!(CONTAINED.line(), 22); + assert_eq!(CONTAINED.column(), 5); +} diff --git a/src/test/ui/rfc-2091-track-caller/error-odd-syntax.rs b/src/test/ui/rfc-2091-track-caller/error-odd-syntax.rs index d400db8575e..d6560231871 100644 --- a/src/test/ui/rfc-2091-track-caller/error-odd-syntax.rs +++ b/src/test/ui/rfc-2091-track-caller/error-odd-syntax.rs @@ -1,4 +1,4 @@ -#![feature(track_caller)] //~ WARN the feature `track_caller` is incomplete +#![feature(track_caller)] #[track_caller(1)] fn f() {} diff --git a/src/test/ui/rfc-2091-track-caller/error-odd-syntax.stderr b/src/test/ui/rfc-2091-track-caller/error-odd-syntax.stderr index a53a8ee2bed..8906fa59506 100644 --- a/src/test/ui/rfc-2091-track-caller/error-odd-syntax.stderr +++ b/src/test/ui/rfc-2091-track-caller/error-odd-syntax.stderr @@ -4,13 +4,5 @@ error: malformed `track_caller` attribute input LL | #[track_caller(1)] | ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[track_caller]` -warning: the feature `track_caller` is incomplete and may cause the compiler to crash - --> $DIR/error-odd-syntax.rs:1:12 - | -LL | #![feature(track_caller)] - | ^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - error: aborting due to previous error diff --git a/src/test/ui/rfc-2091-track-caller/error-with-invalid-abi.rs b/src/test/ui/rfc-2091-track-caller/error-with-invalid-abi.rs index 162c6387088..20d29619ba4 100644 --- a/src/test/ui/rfc-2091-track-caller/error-with-invalid-abi.rs +++ b/src/test/ui/rfc-2091-track-caller/error-with-invalid-abi.rs @@ -1,6 +1,7 @@ -#![feature(track_caller)] //~ WARN the feature `track_caller` is incomplete +#![feature(track_caller)] -#[track_caller] //~ ERROR Rust ABI is required to use `#[track_caller]` +#[track_caller] extern "C" fn f() {} +//~^^ ERROR `#[track_caller]` requires Rust ABI fn main() {} diff --git a/src/test/ui/rfc-2091-track-caller/error-with-invalid-abi.stderr b/src/test/ui/rfc-2091-track-caller/error-with-invalid-abi.stderr index ad89b142f0e..2a3a4385c8b 100644 --- a/src/test/ui/rfc-2091-track-caller/error-with-invalid-abi.stderr +++ b/src/test/ui/rfc-2091-track-caller/error-with-invalid-abi.stderr @@ -1,12 +1,4 @@ -warning: the feature `track_caller` is incomplete and may cause the compiler to crash - --> $DIR/error-with-invalid-abi.rs:1:12 - | -LL | #![feature(track_caller)] - | ^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - -error[E0737]: Rust ABI is required to use `#[track_caller]` +error[E0737]: `#[track_caller]` requires Rust ABI --> $DIR/error-with-invalid-abi.rs:3:1 | LL | #[track_caller] diff --git a/src/test/ui/rfc-2091-track-caller/error-with-naked.rs b/src/test/ui/rfc-2091-track-caller/error-with-naked.rs index bbbcec30e8d..dd9e5d04135 100644 --- a/src/test/ui/rfc-2091-track-caller/error-with-naked.rs +++ b/src/test/ui/rfc-2091-track-caller/error-with-naked.rs @@ -1,4 +1,4 @@ -#![feature(naked_functions, track_caller)] //~ WARN the feature `track_caller` is incomplete +#![feature(naked_functions, track_caller)] #[track_caller] #[naked] diff --git a/src/test/ui/rfc-2091-track-caller/error-with-naked.stderr b/src/test/ui/rfc-2091-track-caller/error-with-naked.stderr index 93e6f7a4cd3..2f5003cfdb7 100644 --- a/src/test/ui/rfc-2091-track-caller/error-with-naked.stderr +++ b/src/test/ui/rfc-2091-track-caller/error-with-naked.stderr @@ -1,11 +1,3 @@ -warning: the feature `track_caller` is incomplete and may cause the compiler to crash - --> $DIR/error-with-naked.rs:1:29 - | -LL | #![feature(naked_functions, track_caller)] - | ^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - error[E0736]: cannot use `#[track_caller]` with `#[naked]` --> $DIR/error-with-naked.rs:3:1 | diff --git a/src/test/ui/rfc-2091-track-caller/error-with-trait-decl.rs b/src/test/ui/rfc-2091-track-caller/error-with-trait-decl.rs index 4fd768d640a..ef037ab62aa 100644 --- a/src/test/ui/rfc-2091-track-caller/error-with-trait-decl.rs +++ b/src/test/ui/rfc-2091-track-caller/error-with-trait-decl.rs @@ -1,4 +1,4 @@ -#![feature(track_caller)] //~ WARN the feature `track_caller` is incomplete +#![feature(track_caller)] trait Trait { #[track_caller] //~ ERROR: `#[track_caller]` may not be used on trait methods diff --git a/src/test/ui/rfc-2091-track-caller/error-with-trait-decl.stderr b/src/test/ui/rfc-2091-track-caller/error-with-trait-decl.stderr index 72ed6f89faa..ded721d2782 100644 --- a/src/test/ui/rfc-2091-track-caller/error-with-trait-decl.stderr +++ b/src/test/ui/rfc-2091-track-caller/error-with-trait-decl.stderr @@ -1,11 +1,3 @@ -warning: the feature `track_caller` is incomplete and may cause the compiler to crash - --> $DIR/error-with-trait-decl.rs:1:12 - | -LL | #![feature(track_caller)] - | ^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - error[E0738]: `#[track_caller]` may not be used on trait methods --> $DIR/error-with-trait-decl.rs:4:5 | diff --git a/src/test/ui/rfc-2091-track-caller/error-with-trait-default-impl.rs b/src/test/ui/rfc-2091-track-caller/error-with-trait-default-impl.rs index 2139ba5de10..17e4bf41ddb 100644 --- a/src/test/ui/rfc-2091-track-caller/error-with-trait-default-impl.rs +++ b/src/test/ui/rfc-2091-track-caller/error-with-trait-default-impl.rs @@ -1,4 +1,4 @@ -#![feature(track_caller)] //~ WARN the feature `track_caller` is incomplete +#![feature(track_caller)] trait Trait { #[track_caller] //~ ERROR: `#[track_caller]` may not be used on trait methods diff --git a/src/test/ui/rfc-2091-track-caller/error-with-trait-default-impl.stderr b/src/test/ui/rfc-2091-track-caller/error-with-trait-default-impl.stderr index 05689c9468b..867eb918b6e 100644 --- a/src/test/ui/rfc-2091-track-caller/error-with-trait-default-impl.stderr +++ b/src/test/ui/rfc-2091-track-caller/error-with-trait-default-impl.stderr @@ -1,11 +1,3 @@ -warning: the feature `track_caller` is incomplete and may cause the compiler to crash - --> $DIR/error-with-trait-default-impl.rs:1:12 - | -LL | #![feature(track_caller)] - | ^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - error[E0738]: `#[track_caller]` may not be used on trait methods --> $DIR/error-with-trait-default-impl.rs:4:5 | diff --git a/src/test/ui/rfc-2091-track-caller/error-with-trait-fn-impl.rs b/src/test/ui/rfc-2091-track-caller/error-with-trait-fn-impl.rs index b565e11f55b..75f20f76e66 100644 --- a/src/test/ui/rfc-2091-track-caller/error-with-trait-fn-impl.rs +++ b/src/test/ui/rfc-2091-track-caller/error-with-trait-fn-impl.rs @@ -1,6 +1,6 @@ // check-fail -#![feature(track_caller)] //~ WARN the feature `track_caller` is incomplete +#![feature(track_caller)] trait Trait { fn unwrap(&self); diff --git a/src/test/ui/rfc-2091-track-caller/error-with-trait-fn-impl.stderr b/src/test/ui/rfc-2091-track-caller/error-with-trait-fn-impl.stderr index 707b367484c..fafceefbfd8 100644 --- a/src/test/ui/rfc-2091-track-caller/error-with-trait-fn-impl.stderr +++ b/src/test/ui/rfc-2091-track-caller/error-with-trait-fn-impl.stderr @@ -1,11 +1,3 @@ -warning: the feature `track_caller` is incomplete and may cause the compiler to crash - --> $DIR/error-with-trait-fn-impl.rs:3:12 - | -LL | #![feature(track_caller)] - | ^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - error[E0738]: `#[track_caller]` may not be used on trait methods --> $DIR/error-with-trait-fn-impl.rs:10:5 | diff --git a/src/test/ui/rfc-2091-track-caller/intrinsic-wrapper.rs b/src/test/ui/rfc-2091-track-caller/intrinsic-wrapper.rs new file mode 100644 index 00000000000..76e62b89ab8 --- /dev/null +++ b/src/test/ui/rfc-2091-track-caller/intrinsic-wrapper.rs @@ -0,0 +1,21 @@ +// run-pass + +#![feature(track_caller)] + +macro_rules! caller_location_from_macro { + () => (core::panic::Location::caller()); +} + +fn main() { + let loc = core::panic::Location::caller(); + assert_eq!(loc.file(), file!()); + assert_eq!(loc.line(), 10); + assert_eq!(loc.column(), 15); + + // `Location::caller()` in a macro should behave similarly to `file!` and `line!`, + // i.e. point to where the macro was invoked, instead of the macro itself. + let loc2 = caller_location_from_macro!(); + assert_eq!(loc2.file(), file!()); + assert_eq!(loc2.line(), 17); + assert_eq!(loc2.column(), 16); +} diff --git a/src/test/ui/rfc-2091-track-caller/only-for-fns.rs b/src/test/ui/rfc-2091-track-caller/only-for-fns.rs index 01ebf13b521..0fd59b4bf49 100644 --- a/src/test/ui/rfc-2091-track-caller/only-for-fns.rs +++ b/src/test/ui/rfc-2091-track-caller/only-for-fns.rs @@ -1,4 +1,4 @@ -#![feature(track_caller)] //~ WARN the feature `track_caller` is incomplete +#![feature(track_caller)] #[track_caller] struct S; diff --git a/src/test/ui/rfc-2091-track-caller/only-for-fns.stderr b/src/test/ui/rfc-2091-track-caller/only-for-fns.stderr index 3301da7ff47..7becb9c5b60 100644 --- a/src/test/ui/rfc-2091-track-caller/only-for-fns.stderr +++ b/src/test/ui/rfc-2091-track-caller/only-for-fns.stderr @@ -1,11 +1,3 @@ -warning: the feature `track_caller` is incomplete and may cause the compiler to crash - --> $DIR/only-for-fns.rs:1:12 - | -LL | #![feature(track_caller)] - | ^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - error[E0739]: attribute should be applied to function --> $DIR/only-for-fns.rs:3:1 | diff --git a/src/test/ui/rfc-2091-track-caller/pass.rs b/src/test/ui/rfc-2091-track-caller/pass.rs index f2c3f0dc59e..eef83b3d68f 100644 --- a/src/test/ui/rfc-2091-track-caller/pass.rs +++ b/src/test/ui/rfc-2091-track-caller/pass.rs @@ -1,5 +1,5 @@ // run-pass -#![feature(track_caller)] //~ WARN the feature `track_caller` is incomplete +#![feature(track_caller)] #[track_caller] fn f() {} diff --git a/src/test/ui/rfc-2091-track-caller/pass.stderr b/src/test/ui/rfc-2091-track-caller/pass.stderr deleted file mode 100644 index b1fd23a6a9d..00000000000 --- a/src/test/ui/rfc-2091-track-caller/pass.stderr +++ /dev/null @@ -1,8 +0,0 @@ -warning: the feature `track_caller` is incomplete and may cause the compiler to crash - --> $DIR/pass.rs:2:12 - | -LL | #![feature(track_caller)] - | ^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - diff --git a/src/test/ui/rfc-2091-track-caller/track-caller-attribute.rs b/src/test/ui/rfc-2091-track-caller/track-caller-attribute.rs new file mode 100644 index 00000000000..8436ee510a5 --- /dev/null +++ b/src/test/ui/rfc-2091-track-caller/track-caller-attribute.rs @@ -0,0 +1,40 @@ +// run-pass + +#![feature(const_fn, track_caller)] + +use std::panic::Location; + +#[track_caller] +fn tracked() -> &'static Location<'static> { + Location::caller() +} + +fn nested_intrinsic() -> &'static Location<'static> { + Location::caller() +} + +fn nested_tracked() -> &'static Location<'static> { + tracked() +} + +fn main() { + let location = Location::caller(); + assert_eq!(location.file(), file!()); + assert_eq!(location.line(), 21); + assert_eq!(location.column(), 20); + + let tracked = tracked(); + assert_eq!(tracked.file(), file!()); + assert_eq!(tracked.line(), 26); + assert_eq!(tracked.column(), 19); + + let nested = nested_intrinsic(); + assert_eq!(nested.file(), file!()); + assert_eq!(nested.line(), 13); + assert_eq!(nested.column(), 5); + + let contained = nested_tracked(); + assert_eq!(contained.file(), file!()); + assert_eq!(contained.line(), 17); + assert_eq!(contained.column(), 5); +} diff --git a/src/test/ui/span/macro-ty-params.rs b/src/test/ui/span/macro-ty-params.rs index b077d590915..713b9eb542c 100644 --- a/src/test/ui/span/macro-ty-params.rs +++ b/src/test/ui/span/macro-ty-params.rs @@ -10,5 +10,4 @@ fn main() { foo::<T>!(); //~ ERROR generic arguments in macro path foo::<>!(); //~ ERROR generic arguments in macro path m!(Default<>); //~ ERROR generic arguments in macro path - //~^ ERROR unexpected generic arguments in path } diff --git a/src/test/ui/span/macro-ty-params.stderr b/src/test/ui/span/macro-ty-params.stderr index 39b3edc6703..21683b2fb86 100644 --- a/src/test/ui/span/macro-ty-params.stderr +++ b/src/test/ui/span/macro-ty-params.stderr @@ -10,17 +10,11 @@ error: generic arguments in macro path LL | foo::<>!(); | ^^ -error: unexpected generic arguments in path - --> $DIR/macro-ty-params.rs:12:8 - | -LL | m!(Default<>); - | ^^^^^^^^^ - error: generic arguments in macro path --> $DIR/macro-ty-params.rs:12:15 | LL | m!(Default<>); | ^^ -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors diff --git a/src/test/ui/suggestions/raw-name-use-suggestion.rs b/src/test/ui/suggestions/raw-name-use-suggestion.rs index 6c01383d961..0a8073c0be2 100644 --- a/src/test/ui/suggestions/raw-name-use-suggestion.rs +++ b/src/test/ui/suggestions/raw-name-use-suggestion.rs @@ -5,5 +5,5 @@ mod foo { fn main() { foo::let(); //~ ERROR expected identifier, found keyword `let` - r#break(); //~ ERROR cannot find function `break` in this scope + r#break(); //~ ERROR cannot find function `r#break` in this scope } diff --git a/src/test/ui/suggestions/raw-name-use-suggestion.stderr b/src/test/ui/suggestions/raw-name-use-suggestion.stderr index 58eb87c00a4..62b76318e09 100644 --- a/src/test/ui/suggestions/raw-name-use-suggestion.stderr +++ b/src/test/ui/suggestions/raw-name-use-suggestion.stderr @@ -20,7 +20,7 @@ help: you can escape reserved keywords to use them as identifiers LL | foo::r#let(); | ^^^^^ -error[E0425]: cannot find function `break` in this scope +error[E0425]: cannot find function `r#break` in this scope --> $DIR/raw-name-use-suggestion.rs:8:5 | LL | r#break(); diff --git a/src/test/ui/tail-typeck.stderr b/src/test/ui/tail-typeck.stderr index eeeb258da21..69f8ffa581b 100644 --- a/src/test/ui/tail-typeck.stderr +++ b/src/test/ui/tail-typeck.stderr @@ -5,6 +5,11 @@ LL | fn f() -> isize { return g(); } | ----- ^^^ expected `isize`, found `usize` | | | expected `isize` because of return type + | +help: you can convert an `usize` to `isize` and panic if the converted value wouldn't fit + | +LL | fn f() -> isize { return g().try_into().unwrap(); } + | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/traits/cycle-cache-err-60010.stderr b/src/test/ui/traits/cycle-cache-err-60010.stderr index f439de88261..295845b1146 100644 --- a/src/test/ui/traits/cycle-cache-err-60010.stderr +++ b/src/test/ui/traits/cycle-cache-err-60010.stderr @@ -6,7 +6,7 @@ LL | _parse: <ParseQuery as Query<RootDatabase>>::Data, | = note: required because of the requirements on the impl of `Query<RootDatabase>` for `ParseQuery` -error[E0275]: overflow evaluating the requirement `RootDatabase: SourceDatabase` +error[E0275]: overflow evaluating the requirement `Runtime<RootDatabase>: std::panic::RefUnwindSafe` --> $DIR/cycle-cache-err-60010.rs:31:5 | LL | type Storage; @@ -17,6 +17,8 @@ LL | impl Database for RootDatabase { LL | type Storage = SalsaStorage; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: required because it appears within the type `RootDatabase` + = note: required because of the requirements on the impl of `SourceDatabase` for `RootDatabase` = note: required because of the requirements on the impl of `Query<RootDatabase>` for `ParseQuery` = note: required because it appears within the type `SalsaStorage` diff --git a/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr b/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr index 88c9c473eb0..9fdcd4de495 100644 --- a/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr +++ b/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr @@ -14,9 +14,13 @@ note: ...but the lifetime must also be valid for the lifetime `'b` as defined on | LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { | ^^ - = note: ...so that the types are compatible: - expected T1<'a> - found T1<'_> +note: ...so that the types are compatible + --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:13 + | +LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { + | ^^^^^^^^^^ + = note: expected `T1<'a>` + found `T1<'_>` error: aborting due to previous error diff --git a/src/test/ui/type/type-check-defaults.rs b/src/test/ui/type/type-check-defaults.rs index 5748c9bcff8..5380fae5417 100644 --- a/src/test/ui/type/type-check-defaults.rs +++ b/src/test/ui/type/type-check-defaults.rs @@ -4,9 +4,9 @@ use std::ops::Add; struct Foo<T, U: FromIterator<T>>(T, U); struct WellFormed<Z = Foo<i32, i32>>(Z); -//~^ ERROR a collection of type `i32` cannot be built from an iterator over elements of type `i32` +//~^ ERROR a value of type `i32` cannot be built from an iterator over elements of type `i32` struct WellFormedNoBounds<Z:?Sized = Foo<i32, i32>>(Z); -//~^ ERROR a collection of type `i32` cannot be built from an iterator over elements of type `i32` +//~^ ERROR a value of type `i32` cannot be built from an iterator over elements of type `i32` struct Bounds<T:Copy=String>(T); //~^ ERROR the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277] diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr index 6802bc38b89..6f84b37d612 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -1,21 +1,21 @@ -error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` +error[E0277]: a value of type `i32` cannot be built from an iterator over elements of type `i32` --> $DIR/type-check-defaults.rs:6:19 | LL | struct Foo<T, U: FromIterator<T>>(T, U); | ---------------------------------------- required by `Foo` LL | struct WellFormed<Z = Foo<i32, i32>>(Z); - | ^ a collection of type `i32` cannot be built from `std::iter::Iterator<Item=i32>` + | ^ value of type `i32` cannot be built from `std::iter::Iterator<Item=i32>` | = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32` -error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` +error[E0277]: a value of type `i32` cannot be built from an iterator over elements of type `i32` --> $DIR/type-check-defaults.rs:8:27 | LL | struct Foo<T, U: FromIterator<T>>(T, U); | ---------------------------------------- required by `Foo` ... LL | struct WellFormedNoBounds<Z:?Sized = Foo<i32, i32>>(Z); - | ^ a collection of type `i32` cannot be built from `std::iter::Iterator<Item=i32>` + | ^ value of type `i32` cannot be built from `std::iter::Iterator<Item=i32>` | = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32` diff --git a/src/test/ui/type/type-dependent-def-issue-49241.rs b/src/test/ui/type/type-dependent-def-issue-49241.rs index 5ad50ffcbc3..a25e3ba5fa8 100644 --- a/src/test/ui/type/type-dependent-def-issue-49241.rs +++ b/src/test/ui/type/type-dependent-def-issue-49241.rs @@ -3,5 +3,5 @@ fn main() { const l: usize = v.count(); //~ ERROR attempt to use a non-constant value in a constant let s: [u32; l] = v.into_iter().collect(); //~^ ERROR evaluation of constant value failed - //~^^ ERROR a collection of type + //~^^ ERROR a value of type } diff --git a/src/test/ui/type/type-dependent-def-issue-49241.stderr b/src/test/ui/type/type-dependent-def-issue-49241.stderr index 851004d1058..18a69c50ebd 100644 --- a/src/test/ui/type/type-dependent-def-issue-49241.stderr +++ b/src/test/ui/type/type-dependent-def-issue-49241.stderr @@ -10,11 +10,11 @@ error[E0080]: evaluation of constant value failed LL | let s: [u32; l] = v.into_iter().collect(); | ^ referenced constant has errors -error[E0277]: a collection of type `[u32; _]` cannot be built from an iterator over elements of type `{integer}` +error[E0277]: a value of type `[u32; _]` cannot be built from an iterator over elements of type `{integer}` --> $DIR/type-dependent-def-issue-49241.rs:4:37 | LL | let s: [u32; l] = v.into_iter().collect(); - | ^^^^^^^ a collection of type `[u32; _]` cannot be built from `std::iter::Iterator<Item={integer}>` + | ^^^^^^^ value of type `[u32; _]` cannot be built from `std::iter::Iterator<Item={integer}>` | = help: the trait `std::iter::FromIterator<{integer}>` is not implemented for `[u32; _]` diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr index d0475bf08c3..e6029e0d462 100644 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr @@ -18,9 +18,13 @@ note: ...so that reference does not outlive borrowed content LL | Box::new(items.iter()) | ^^^^^ = note: but, the lifetime must be valid for the static lifetime... - = note: ...so that the expression is assignable: - expected std::boxed::Box<(dyn std::iter::Iterator<Item = &T> + 'static)> - found std::boxed::Box<dyn std::iter::Iterator<Item = &T>> +note: ...so that the expression is assignable + --> $DIR/dyn-trait-underscore.rs:8:5 + | +LL | Box::new(items.iter()) + | ^^^^^^^^^^^^^^^^^^^^^^ + = note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = &T> + 'static)>` + found `std::boxed::Box<dyn std::iter::Iterator<Item = &T>>` error: aborting due to previous error diff --git a/src/test/ui/wrong-ret-type.stderr b/src/test/ui/wrong-ret-type.stderr index 440620f40b1..c1274bd0ea6 100644 --- a/src/test/ui/wrong-ret-type.stderr +++ b/src/test/ui/wrong-ret-type.stderr @@ -5,6 +5,11 @@ LL | fn mk_int() -> usize { let i: isize = 3; return i; } | ----- ^ expected `usize`, found `isize` | | | expected `usize` because of return type + | +help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit + | +LL | fn mk_int() -> usize { let i: isize = 3; return i.try_into().unwrap(); } + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error |
