From cf0a7cf361a6461f31714ffb1f47ac38c7fa9a97 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sat, 4 Dec 2021 17:20:12 +0100 Subject: [PATCH] Bless tests. --- .../issues/issue-56445-1.min.stderr | 11 +- .../ui/const-generics/issues/issue-56445-1.rs | 1 + src/test/ui/error-codes/E0261.stderr | 2 - src/test/ui/error-codes/E0263.stderr | 4 +- src/test/ui/error-codes/E0637.stderr | 6 +- src/test/ui/error-codes/E0771.stderr | 16 +- .../feature-gate-in_band_lifetimes.stderr | 170 +++++----- ...t-in-trait-path-undeclared-lifetime.stderr | 13 +- ...ssociated_type_undeclared_lifetimes.stderr | 6 +- .../generic-associated-types/issue-67510.rs | 8 +- .../issue-67510.stderr | 52 ++- .../generic-associated-types/issue-70304.rs | 14 +- .../issue-70304.stderr | 16 +- .../generic-associated-types/shadowing.stderr | 32 +- .../generics/generic-extern-lifetime.stderr | 22 +- .../ui/hygiene/duplicate_lifetimes.stderr | 8 +- src/test/ui/hygiene/hygienic-labels-in-let.rs | 43 +-- .../ui/hygiene/hygienic-labels-in-let.stderr | 311 +---------------- src/test/ui/hygiene/hygienic-labels.rs | 43 +-- src/test/ui/hygiene/hygienic-labels.stderr | 313 +----------------- .../trait-elided.rs | 3 +- .../trait-elided.stderr | 14 +- .../impl-trait/region-escape-via-bound.stderr | 7 +- src/test/ui/in-band-lifetimes/E0687.rs | 6 +- src/test/ui/in-band-lifetimes/E0687.stderr | 8 +- .../no_introducing_in_band_in_locals.rs | 2 +- .../no_introducing_in_band_in_locals.stderr | 17 +- src/test/ui/issues/issue-10412.rs | 17 +- src/test/ui/issues/issue-10412.stderr | 44 ++- ...ime-used-in-debug-macro-issue-70152.stderr | 6 +- src/test/ui/lint/unused_labels.rs | 1 + src/test/ui/lint/unused_labels.stderr | 33 +- .../macros/macro-lifetime-used-with-labels.rs | 6 +- .../macro-lifetime-used-with-labels.stderr | 15 - .../method-call-lifetime-args-unresolved.rs | 5 +- ...ethod-call-lifetime-args-unresolved.stderr | 17 +- ...location-detail-panic-no-column.run.stderr | 50 ++- .../location-detail-panic-no-file.run.stderr | 50 ++- .../location-detail-panic-no-line.run.stderr | 50 ++- .../location-detail-unwrap-no-file.run.stderr | 57 +++- src/test/ui/regions/regions-in-enums.stderr | 4 - src/test/ui/regions/regions-in-structs.stderr | 4 - .../ui/regions/regions-name-duplicated.rs | 6 +- .../ui/regions/regions-name-duplicated.stderr | 17 +- src/test/ui/regions/regions-name-static.rs | 6 +- .../ui/regions/regions-name-static.stderr | 13 +- .../ui/regions/regions-name-undeclared.stderr | 46 ++- src/test/ui/regions/regions-undeclared.stderr | 4 - .../missing-lifetimes-in-signature.rs | 27 +- .../missing-lifetimes-in-signature.stderr | 101 +++++- ...ssue-69136-inner-lifetime-resolve-error.rs | 4 + ...-69136-inner-lifetime-resolve-error.stderr | 52 ++- src/test/ui/underscore-lifetime/in-binder.rs | 19 +- .../ui/underscore-lifetime/in-binder.stderr | 37 ++- .../underscore-lifetime-binders.stderr | 6 +- .../where-lifetime-resolution.stderr | 34 +- 56 files changed, 864 insertions(+), 1015 deletions(-) delete mode 100644 src/test/ui/macros/macro-lifetime-used-with-labels.stderr diff --git a/src/test/ui/const-generics/issues/issue-56445-1.min.stderr b/src/test/ui/const-generics/issues/issue-56445-1.min.stderr index 179643a755293..43a5df117fdc7 100644 --- a/src/test/ui/const-generics/issues/issue-56445-1.min.stderr +++ b/src/test/ui/const-generics/issues/issue-56445-1.min.stderr @@ -6,6 +6,15 @@ LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); | = note: for more information, see issue #74052 -error: aborting due to previous error +error: `&'static str` is forbidden as the type of a const generic parameter + --> $DIR/issue-56445-1.rs:9:25 + | +LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); + | ^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = help: more complex types are supported with `#![feature(adt_const_params)]` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0771`. diff --git a/src/test/ui/const-generics/issues/issue-56445-1.rs b/src/test/ui/const-generics/issues/issue-56445-1.rs index aeef778991f06..13eb2ea9f69d5 100644 --- a/src/test/ui/const-generics/issues/issue-56445-1.rs +++ b/src/test/ui/const-generics/issues/issue-56445-1.rs @@ -8,5 +8,6 @@ use std::marker::PhantomData; struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); //~^ ERROR: use of non-static lifetime `'a` in const generic +//[min]~| ERROR: `&'static str` is forbidden as the type of a const generic parameter impl Bug<'_, ""> {} diff --git a/src/test/ui/error-codes/E0261.stderr b/src/test/ui/error-codes/E0261.stderr index 33d74feead513..6c9896a7a49d8 100644 --- a/src/test/ui/error-codes/E0261.stderr +++ b/src/test/ui/error-codes/E0261.stderr @@ -15,8 +15,6 @@ LL | struct Foo { | - help: consider introducing lifetime `'a` here: `<'a>` LL | x: &'a str, | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0263.stderr b/src/test/ui/error-codes/E0263.stderr index 4dae02b85c36c..56e4ef023794f 100644 --- a/src/test/ui/error-codes/E0263.stderr +++ b/src/test/ui/error-codes/E0263.stderr @@ -2,9 +2,9 @@ error[E0263]: lifetime name `'a` declared twice in the same scope --> $DIR/E0263.rs:1:16 | LL | fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { - | -- ^^ declared twice + | -- ^^ lifetime `'a` already in scope | | - | previous declaration here + | first declared here error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0637.stderr b/src/test/ui/error-codes/E0637.stderr index 87aaba65a73ad..d763ea65e77b1 100644 --- a/src/test/ui/error-codes/E0637.stderr +++ b/src/test/ui/error-codes/E0637.stderr @@ -17,10 +17,10 @@ LL | fn underscore_lifetime<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str { | ------- ------- ^^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `str1` or `str2` -help: consider introducing a named lifetime parameter +help: consider using the `'_` lifetime | -LL | fn underscore_lifetime<'a, '_>(str1: &'a str, str2: &'a str) -> &'a str { - | +++ ~~ ~~ ~~ +LL | fn underscore_lifetime<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str { + | ~~ error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0771.stderr b/src/test/ui/error-codes/E0771.stderr index 730a7ef1284b6..9fd55abec5e40 100644 --- a/src/test/ui/error-codes/E0771.stderr +++ b/src/test/ui/error-codes/E0771.stderr @@ -1,3 +1,11 @@ +error[E0771]: use of non-static lifetime `'a` in const generic + --> $DIR/E0771.rs:4:41 + | +LL | fn function_with_str<'a, const STRING: &'a str>() {} + | ^^ + | + = note: for more information, see issue #74052 + warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/E0771.rs:1:12 | @@ -7,14 +15,6 @@ LL | #![feature(adt_const_params)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #44580 for more information -error[E0771]: use of non-static lifetime `'a` in const generic - --> $DIR/E0771.rs:4:41 - | -LL | fn function_with_str<'a, const STRING: &'a str>() {} - | ^^ - | - = note: for more information, see issue #74052 - error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0771`. diff --git a/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr b/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr index 20e61303e36aa..be7afa689e593 100644 --- a/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr +++ b/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr @@ -1,87 +1,3 @@ -error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:50:14 - | -LL | impl MyTrait<'a> for Y<&'a u8> { - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `<'a>` - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes - -error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:50:25 - | -LL | impl MyTrait<'a> for Y<&'a u8> { - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `<'a>` - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes - -error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:53:31 - | -LL | fn my_lifetime(&self) -> &'a u8 { self.0 } - | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes -help: consider introducing lifetime `'a` here - | -LL | impl<'a> MyTrait<'a> for Y<&'a u8> { - | ++++ -help: consider introducing lifetime `'a` here - | -LL | fn my_lifetime<'a>(&self) -> &'a u8 { self.0 } - | ++++ - -error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:55:27 - | -LL | fn any_lifetime() -> &'b u8 { &0 } - | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes -help: consider introducing lifetime `'b` here - | -LL | impl<'b> MyTrait<'a> for Y<&'a u8> { - | ++++ -help: consider introducing lifetime `'b` here - | -LL | fn any_lifetime<'b>() -> &'b u8 { &0 } - | ++++ - -error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:57:27 - | -LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } - | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes -help: consider introducing lifetime `'b` here - | -LL | impl<'b> MyTrait<'a> for Y<&'a u8> { - | ++++ -help: consider introducing lifetime `'b` here - | -LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8 { &*self.0 } - | ++++ - -error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:57:40 - | -LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } - | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes -help: consider introducing lifetime `'b` here - | -LL | impl<'b> MyTrait<'a> for Y<&'a u8> { - | ++++ -help: consider introducing lifetime `'b` here - | -LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8 { &*self.0 } - | ++++ - error[E0261]: use of undeclared lifetime name `'x` --> $DIR/feature-gate-in_band_lifetimes.rs:3:12 | @@ -109,6 +25,8 @@ LL | impl<'a> X<'b> { | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'b` here: `'b,` + | + = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'b` --> $DIR/feature-gate-in_band_lifetimes.rs:17:27 @@ -226,6 +144,90 @@ help: consider introducing lifetime `'b` here LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8; | ++++ +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/feature-gate-in_band_lifetimes.rs:50:14 + | +LL | impl MyTrait<'a> for Y<&'a u8> { + | - ^^ undeclared lifetime + | | + | help: consider introducing lifetime `'a` here: `<'a>` + | + = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/feature-gate-in_band_lifetimes.rs:50:25 + | +LL | impl MyTrait<'a> for Y<&'a u8> { + | - ^^ undeclared lifetime + | | + | help: consider introducing lifetime `'a` here: `<'a>` + | + = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/feature-gate-in_band_lifetimes.rs:53:31 + | +LL | fn my_lifetime(&self) -> &'a u8 { self.0 } + | ^^ undeclared lifetime + | + = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes +help: consider introducing lifetime `'a` here + | +LL | impl<'a> MyTrait<'a> for Y<&'a u8> { + | ++++ +help: consider introducing lifetime `'a` here + | +LL | fn my_lifetime<'a>(&self) -> &'a u8 { self.0 } + | ++++ + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/feature-gate-in_band_lifetimes.rs:55:27 + | +LL | fn any_lifetime() -> &'b u8 { &0 } + | ^^ undeclared lifetime + | + = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes +help: consider introducing lifetime `'b` here + | +LL | impl<'b> MyTrait<'a> for Y<&'a u8> { + | ++++ +help: consider introducing lifetime `'b` here + | +LL | fn any_lifetime<'b>() -> &'b u8 { &0 } + | ++++ + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/feature-gate-in_band_lifetimes.rs:57:27 + | +LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } + | ^^ undeclared lifetime + | + = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes +help: consider introducing lifetime `'b` here + | +LL | impl<'b> MyTrait<'a> for Y<&'a u8> { + | ++++ +help: consider introducing lifetime `'b` here + | +LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8 { &*self.0 } + | ++++ + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/feature-gate-in_band_lifetimes.rs:57:40 + | +LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } + | ^^ undeclared lifetime + | + = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes +help: consider introducing lifetime `'b` here + | +LL | impl<'b> MyTrait<'a> for Y<&'a u8> { + | ++++ +help: consider introducing lifetime `'b` here + | +LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8 { &*self.0 } + | ++++ + error: aborting due to 17 previous errors For more information about this error, try `rustc --explain E0261`. diff --git a/src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr b/src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr index ce9df46483d13..75964f30c04dd 100644 --- a/src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr +++ b/src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr @@ -2,11 +2,18 @@ error[E0261]: use of undeclared lifetime name `'x` --> $DIR/gat-in-trait-path-undeclared-lifetime.rs:8:35 | LL | fn _f(arg : Box X = &'a [u32]>>) {} - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'x` here: `<'x>` + | ^^ undeclared lifetime | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes +help: consider introducing lifetime `'x` here + | +LL | fn _f<'x>(arg : Box X = &'a [u32]>>) {} + | ++++ +help: consider making the bound lifetime-generic with a new `'x` lifetime + | +LL | fn _f(arg : Box X = &'a [u32]>>) {} + | +++ error[E0582]: binding for associated type `Y` references lifetime `'a`, which does not appear in the trait input types --> $DIR/gat-in-trait-path-undeclared-lifetime.rs:8:33 diff --git a/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr b/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr index adbd47ac16f45..be299a38c19c2 100644 --- a/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr +++ b/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr @@ -4,7 +4,7 @@ error[E0261]: use of undeclared lifetime name `'b` LL | + Deref>; | ^^ undeclared lifetime | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html help: consider introducing lifetime `'b` here | LL | trait Iterable<'b> { @@ -13,6 +13,10 @@ help: consider introducing lifetime `'b` here | LL | type Iter<'b, 'a>: Iterator> | +++ +help: consider making the bound lifetime-generic with a new `'b` lifetime + | +LL | + for<'b> Deref>; + | +++++++ error[E0261]: use of undeclared lifetime name `'undeclared` --> $DIR/generic_associated_type_undeclared_lifetimes.rs:11:41 diff --git a/src/test/ui/generic-associated-types/issue-67510.rs b/src/test/ui/generic-associated-types/issue-67510.rs index e81a5b231a001..5725b660ab234 100644 --- a/src/test/ui/generic-associated-types/issue-67510.rs +++ b/src/test/ui/generic-associated-types/issue-67510.rs @@ -4,9 +4,9 @@ trait X { type Y<'a>; } -fn f(x: Box=&'a ()>>) {} - //~^ ERROR: use of undeclared lifetime name `'a` - //~| ERROR: use of undeclared lifetime name `'a` - +fn f(x: Box = &'a ()>>) {} +//~^ ERROR: use of undeclared lifetime name `'a` +//~| ERROR: use of undeclared lifetime name `'a` +//~| ERROR: the trait `X` cannot be made into an object [E0038] fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-67510.stderr b/src/test/ui/generic-associated-types/issue-67510.stderr index 8ed2854ed3057..084c14c5b17de 100644 --- a/src/test/ui/generic-associated-types/issue-67510.stderr +++ b/src/test/ui/generic-associated-types/issue-67510.stderr @@ -1,23 +1,53 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/issue-67510.rs:7:21 | -LL | fn f(x: Box=&'a ()>>) {} - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `<'a>` +LL | fn f(x: Box = &'a ()>>) {} + | ^^ undeclared lifetime | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes +help: consider introducing lifetime `'a` here + | +LL | fn f<'a>(x: Box = &'a ()>>) {} + | ++++ +help: consider making the bound lifetime-generic with a new `'a` lifetime + | +LL | fn f(x: Box X = &'a ()>>) {} + | +++++++ error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/issue-67510.rs:7:26 + --> $DIR/issue-67510.rs:7:28 | -LL | fn f(x: Box=&'a ()>>) {} - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `<'a>` +LL | fn f(x: Box = &'a ()>>) {} + | ^^ undeclared lifetime | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes +help: consider introducing lifetime `'a` here + | +LL | fn f<'a>(x: Box = &'a ()>>) {} + | ++++ +help: consider making the bound lifetime-generic with a new `'a` lifetime + | +LL | fn f(x: Box X = &'a ()>>) {} + | +++++++ + +error[E0038]: the trait `X` cannot be made into an object + --> $DIR/issue-67510.rs:7:13 + | +LL | fn f(x: Box = &'a ()>>) {} + | ^^^^^^^^^^^^^^^^^^^^^ `X` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/issue-67510.rs:4:10 + | +LL | trait X { + | - this trait cannot be made into an object... +LL | type Y<'a>; + | ^ ...because it contains the generic associated type `Y` + = help: consider moving `Y` to another trait -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0261`. +Some errors have detailed explanations: E0038, E0261. +For more information about an error, try `rustc --explain E0038`. diff --git a/src/test/ui/generic-associated-types/issue-70304.rs b/src/test/ui/generic-associated-types/issue-70304.rs index ae64f9310d112..1c3d166a1af11 100644 --- a/src/test/ui/generic-associated-types/issue-70304.rs +++ b/src/test/ui/generic-associated-types/issue-70304.rs @@ -12,13 +12,10 @@ impl Document for DocumentImpl { type Cursor<'a> = DocCursorImpl<'a>; fn cursor(&self) -> Self::Cursor<'_> { - DocCursorImpl { - document: &self, - } + DocCursorImpl { document: &self } } } - trait DocCursor<'a> {} struct DocCursorImpl<'a> { @@ -35,7 +32,6 @@ where _phantom: std::marker::PhantomData<&'d ()>, } - impl<'d, Cursor> Lexer<'d, Cursor> where Cursor: DocCursor<'d>, @@ -44,15 +40,13 @@ where where Doc: Document = Cursor>, { - Lexer { - cursor: document.cursor(), - _phantom: std::marker::PhantomData, - } + Lexer { cursor: document.cursor(), _phantom: std::marker::PhantomData } } } fn create_doc() -> impl Document = DocCursorImpl<'_>> { - //~^ ERROR: missing lifetime specifier + //~^ ERROR: missing lifetime specifier + //~| ERROR: missing lifetime specifier DocumentImpl {} } diff --git a/src/test/ui/generic-associated-types/issue-70304.stderr b/src/test/ui/generic-associated-types/issue-70304.stderr index c53dbf63a3c5b..08efc82c88658 100644 --- a/src/test/ui/generic-associated-types/issue-70304.stderr +++ b/src/test/ui/generic-associated-types/issue-70304.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/issue-70304.rs:54:41 + --> $DIR/issue-70304.rs:47:41 | LL | fn create_doc() -> impl Document = DocCursorImpl<'_>> { | ^^ expected named lifetime parameter @@ -10,6 +10,18 @@ help: consider using the `'static` lifetime LL | fn create_doc() -> impl Document = DocCursorImpl<'_>> { | ~~~~~~~ -error: aborting due to previous error +error[E0106]: missing lifetime specifier + --> $DIR/issue-70304.rs:47:61 + | +LL | fn create_doc() -> impl Document = DocCursorImpl<'_>> { + | ^^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from +help: consider using the `'static` lifetime + | +LL | fn create_doc() -> impl Document = DocCursorImpl<'static>> { + | ~~~~~~~ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/generic-associated-types/shadowing.stderr b/src/test/ui/generic-associated-types/shadowing.stderr index 857757f8940dc..be765920975b3 100644 --- a/src/test/ui/generic-associated-types/shadowing.stderr +++ b/src/test/ui/generic-associated-types/shadowing.stderr @@ -1,3 +1,19 @@ +error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope + --> $DIR/shadowing.rs:4:14 + | +LL | trait Shadow<'a> { + | -- first declared here +LL | type Bar<'a>; + | ^^ lifetime `'a` already in scope + +error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope + --> $DIR/shadowing.rs:13:14 + | +LL | impl<'a> NoShadow<'a> for &'a u32 { + | -- first declared here +LL | type Bar<'a> = i32; + | ^^ lifetime `'a` already in scope + error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters --> $DIR/shadowing.rs:18:14 | @@ -14,22 +30,6 @@ LL | impl NoShadowT for Option { LL | type Bar = i32; | ^ already used -error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope - --> $DIR/shadowing.rs:13:14 - | -LL | impl<'a> NoShadow<'a> for &'a u32 { - | -- first declared here -LL | type Bar<'a> = i32; - | ^^ lifetime `'a` already in scope - -error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope - --> $DIR/shadowing.rs:4:14 - | -LL | trait Shadow<'a> { - | -- first declared here -LL | type Bar<'a>; - | ^^ lifetime `'a` already in scope - error: aborting due to 4 previous errors Some errors have detailed explanations: E0403, E0496. diff --git a/src/test/ui/generics/generic-extern-lifetime.stderr b/src/test/ui/generics/generic-extern-lifetime.stderr index 909848604ec8a..34bbb00027719 100644 --- a/src/test/ui/generics/generic-extern-lifetime.stderr +++ b/src/test/ui/generics/generic-extern-lifetime.stderr @@ -2,7 +2,11 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/generic-extern-lifetime.rs:6:26 | LL | pub fn life2<'b>(x: &'a i32, y: &'b i32); - | ^^ undeclared lifetime + | - ^^ undeclared lifetime + | | + | help: consider introducing lifetime `'a` here: `'a,` + | + = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'a` --> $DIR/generic-extern-lifetime.rs:8:37 @@ -11,10 +15,14 @@ LL | pub fn life4<'b>(x: for<'c> fn(&'a i32)); | ^^ undeclared lifetime | = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html +help: consider introducing lifetime `'a` here + | +LL | pub fn life4<'a, 'b>(x: for<'c> fn(&'a i32)); + | +++ help: consider making the type lifetime-generic with a new `'a` lifetime | -LL | pub fn life4<'b>(x: for<'c, 'a> fn(&'a i32)); - | ++++ +LL | pub fn life4<'b>(x: for<'c'a, > fn(&'a i32)); + | +++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/generic-extern-lifetime.rs:11:39 @@ -23,10 +31,14 @@ LL | pub fn life7<'b>() -> for<'c> fn(&'a i32); | ^^ undeclared lifetime | = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html +help: consider introducing lifetime `'a` here + | +LL | pub fn life7<'a, 'b>() -> for<'c> fn(&'a i32); + | +++ help: consider making the type lifetime-generic with a new `'a` lifetime | -LL | pub fn life7<'b>() -> for<'c, 'a> fn(&'a i32); - | ++++ +LL | pub fn life7<'b>() -> for<'c'a, > fn(&'a i32); + | +++ error: aborting due to 3 previous errors diff --git a/src/test/ui/hygiene/duplicate_lifetimes.stderr b/src/test/ui/hygiene/duplicate_lifetimes.stderr index 4d41ebaa43733..ade411a25442b 100644 --- a/src/test/ui/hygiene/duplicate_lifetimes.stderr +++ b/src/test/ui/hygiene/duplicate_lifetimes.stderr @@ -2,12 +2,12 @@ error[E0263]: lifetime name `'a` declared twice in the same scope --> $DIR/duplicate_lifetimes.rs:8:14 | LL | fn g<$a, 'a>() {} - | ^^ declared twice + | ^^ lifetime `'a` already in scope ... LL | m!('a); | ------ | | | - | | previous declaration here + | | first declared here | in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -16,12 +16,12 @@ error[E0263]: lifetime name `'a` declared twice in the same scope --> $DIR/duplicate_lifetimes.rs:13:14 | LL | fn h<$a, 'a>() {} - | ^^ declared twice + | ^^ lifetime `'a` already in scope ... LL | n!('a); | ------ | | | - | | previous declaration here + | | first declared here | in this macro invocation | = note: this error originates in the macro `n` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/hygiene/hygienic-labels-in-let.rs b/src/test/ui/hygiene/hygienic-labels-in-let.rs index 491855d7becd1..19f72f24459b3 100644 --- a/src/test/ui/hygiene/hygienic-labels-in-let.rs +++ b/src/test/ui/hygiene/hygienic-labels-in-let.rs @@ -13,38 +13,28 @@ macro_rules! loop_x { ($e: expr) => { // $e shouldn't be able to interact with this 'x - 'x: loop { $e } - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - } + 'x: loop { + $e + } + }; } macro_rules! while_true { ($e: expr) => { // $e shouldn't be able to interact with this 'x - 'x: while 1 + 1 == 2 { $e } - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - } + 'x: while 1 + 1 == 2 { + $e + } + }; } macro_rules! run_once { ($e: expr) => { // ditto - 'x: for _ in 0..1 { $e } - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - } + 'x: for _ in 0..1 { + $e + } + }; } pub fn main() { @@ -63,7 +53,6 @@ pub fn main() { let k: isize = { 'x: for _ in 0..1 { //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope // ditto loop_x!(break 'x); i += 1; @@ -75,9 +64,6 @@ pub fn main() { let l: isize = { 'x: for _ in 0..1 { //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope // ditto while_true!(break 'x); i += 1; @@ -89,11 +75,6 @@ pub fn main() { let n: isize = { 'x: for _ in 0..1 { //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope // ditto run_once!(continue 'x); i += 1; diff --git a/src/test/ui/hygiene/hygienic-labels-in-let.stderr b/src/test/ui/hygiene/hygienic-labels-in-let.stderr index 519e3c0880ac6..e1c284600ea23 100644 --- a/src/test/ui/hygiene/hygienic-labels-in-let.stderr +++ b/src/test/ui/hygiene/hygienic-labels-in-let.stderr @@ -1,334 +1,29 @@ warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:16:9 + --> $DIR/hygienic-labels-in-let.rs:54:9 | -LL | 'x: loop { $e } - | ^^ label `'x` already in scope -... LL | 'x: loop { | -- first declared here -LL | // this 'x should refer to the outer loop, lexically -LL | loop_x!(break 'x); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:64:9 - | -LL | 'x: loop { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:64:9 - | -LL | 'x: loop { $e } - | -- first declared here ... LL | 'x: for _ in 0..1 { | ^^ label `'x` already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:16:9 + --> $DIR/hygienic-labels-in-let.rs:65:9 | -LL | 'x: loop { $e } - | ^^ label `'x` already in scope -... LL | 'x: loop { | -- first declared here ... -LL | loop_x!(break 'x); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:16:9 - | -LL | 'x: loop { $e } - | ^^ - | | - | first declared here - | label `'x` already in scope -... -LL | loop_x!(break 'x); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:16:9 - | -LL | 'x: loop { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | loop_x!(break 'x); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:76:9 - | -LL | 'x: loop { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:76:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:76:9 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... LL | 'x: for _ in 0..1 { | ^^ label `'x` already in scope warning: label name `'x` shadows a label name that is already in scope --> $DIR/hygienic-labels-in-let.rs:76:9 | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:27:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... LL | 'x: loop { | -- first declared here ... -LL | while_true!(break 'x); - | --------------------- in this macro invocation - | - = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:27:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | while_true!(break 'x); - | --------------------- in this macro invocation - | - = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:27:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | while_true!(break 'x); - | --------------------- in this macro invocation - | - = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:27:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { $e } | ^^ label `'x` already in scope -... -LL | while_true!(break 'x); - | --------------------- in this macro invocation - | - = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:27:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | while_true!(break 'x); - | --------------------- in this macro invocation - | - = note: this warning originates in the macro `while_true` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:90:9 - | -LL | 'x: loop { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:90:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:90:9 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:90:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:90:9 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:90:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: loop { - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) -warning: 28 warnings emitted +warning: 3 warnings emitted diff --git a/src/test/ui/hygiene/hygienic-labels.rs b/src/test/ui/hygiene/hygienic-labels.rs index c9f494b68b4a8..af8f928527347 100644 --- a/src/test/ui/hygiene/hygienic-labels.rs +++ b/src/test/ui/hygiene/hygienic-labels.rs @@ -10,38 +10,28 @@ macro_rules! loop_x { ($e: expr) => { // $e shouldn't be able to interact with this 'x - 'x: loop { $e } - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - } + 'x: loop { + $e + } + }; } macro_rules! run_once { ($e: expr) => { // ditto - 'x: for _ in 0..1 { $e } - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - } + 'x: for _ in 0..1 { + $e + } + }; } macro_rules! while_x { ($e: expr) => { // ditto - 'x: while 1 + 1 == 2 { $e } - //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - } + 'x: while 1 + 1 == 2 { + $e + } + }; } pub fn main() { @@ -53,7 +43,6 @@ pub fn main() { 'x: loop { //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope // ditto loop_x!(break 'x); @@ -62,9 +51,6 @@ pub fn main() { 'x: while 1 + 1 == 2 { //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope while_x!(break 'x); panic!("break doesn't act hygienically inside infinite while loop"); @@ -72,11 +58,6 @@ pub fn main() { 'x: for _ in 0..1 { //~^ WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope - //~| WARNING shadows a label name that is already in scope // ditto run_once!(continue 'x); diff --git a/src/test/ui/hygiene/hygienic-labels.stderr b/src/test/ui/hygiene/hygienic-labels.stderr index f0b891fe34979..df1f3c701904b 100644 --- a/src/test/ui/hygiene/hygienic-labels.stderr +++ b/src/test/ui/hygiene/hygienic-labels.stderr @@ -1,79 +1,14 @@ warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:13:9 + --> $DIR/hygienic-labels.rs:44:5 | -LL | 'x: loop { $e } - | ^^ label `'x` already in scope -... LL | 'x: for _ in 0..1 { | -- first declared here -LL | // this 'x should refer to the outer loop, lexically -LL | loop_x!(break 'x); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:54:5 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | 'x: loop { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:54:5 - | -LL | 'x: loop { $e } - | -- first declared here ... LL | 'x: loop { | ^^ label `'x` already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:13:9 - | -LL | 'x: loop { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | loop_x!(break 'x); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:13:9 - | -LL | 'x: loop { $e } - | ^^ - | | - | first declared here - | label `'x` already in scope -... -LL | loop_x!(break 'x); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:13:9 - | -LL | 'x: loop { $e } - | ^^ label `'x` already in scope -... -LL | 'x: loop { - | -- first declared here -... -LL | loop_x!(break 'x); - | ----------------- in this macro invocation - | - = note: this warning originates in the macro `loop_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:63:5 + --> $DIR/hygienic-labels.rs:52:5 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -82,253 +17,13 @@ LL | 'x: while 1 + 1 == 2 { | ^^ label `'x` already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:63:5 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:63:5 - | -LL | 'x: loop { - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:63:5 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:38:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | while_x!(break 'x); - | ------------------ in this macro invocation - | - = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:38:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | while_x!(break 'x); - | ------------------ in this macro invocation - | - = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:38:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: loop { - | -- first declared here -... -LL | while_x!(break 'x); - | ------------------ in this macro invocation - | - = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:38:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | while_x!(break 'x); - | ------------------ in this macro invocation - | - = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:38:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: while 1 + 1 == 2 { - | -- first declared here -... -LL | while_x!(break 'x); - | ------------------ in this macro invocation - | - = note: this warning originates in the macro `while_x` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:73:5 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:73:5 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:73:5 - | -LL | 'x: loop { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:73:5 + --> $DIR/hygienic-labels.rs:59:5 | -LL | 'x: loop { $e } - | -- first declared here -... LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:73:5 - | -LL | 'x: while 1 + 1 == 2 { | -- first declared here ... LL | 'x: for _ in 0..1 { | ^^ label `'x` already in scope -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:73:5 - | -LL | 'x: while 1 + 1 == 2 { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ label `'x` already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:24:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:24:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:24:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: loop { - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:24:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:24:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: while 1 + 1 == 2 { - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:24:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: while 1 + 1 == 2 { $e } - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:24:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ label `'x` already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | run_once!(continue 'x); - | ---------------------- in this macro invocation - | - = note: this warning originates in the macro `run_once` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: 28 warnings emitted +warning: 3 warnings emitted diff --git a/src/test/ui/impl-header-lifetime-elision/trait-elided.rs b/src/test/ui/impl-header-lifetime-elision/trait-elided.rs index 102d259b0c87a..f827c0573b617 100644 --- a/src/test/ui/impl-header-lifetime-elision/trait-elided.rs +++ b/src/test/ui/impl-header-lifetime-elision/trait-elided.rs @@ -1,9 +1,10 @@ #![allow(warnings)] -trait MyTrait<'a> { } +trait MyTrait<'a> {} impl MyTrait for u32 { //~^ ERROR implicit elided lifetime not allowed here + //~| ERROR missing lifetime specifier [E0106] } fn main() {} diff --git a/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr b/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr index 735f01379f09f..80a6bc2f8aa72 100644 --- a/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr +++ b/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr @@ -6,5 +6,17 @@ LL | impl MyTrait for u32 { | = note: assuming a `'static` lifetime... -error: aborting due to previous error +error[E0106]: missing lifetime specifier + --> $DIR/trait-elided.rs:5:6 + | +LL | impl MyTrait for u32 { + | ^^^^^^^ expected named lifetime parameter + | +help: consider introducing a named lifetime parameter + | +LL | impl<'a> MyTrait<'a> for u32 { + | ++++ ~~~~~~~~~~~ + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/impl-trait/region-escape-via-bound.stderr b/src/test/ui/impl-trait/region-escape-via-bound.stderr index 9dc2ea5bc82a1..e7b60f3bd69ee 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound.stderr +++ b/src/test/ui/impl-trait/region-escape-via-bound.stderr @@ -2,10 +2,9 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea --> $DIR/region-escape-via-bound.rs:15:29 | LL | fn foo(x: Cell<&'x u32>) -> impl Trait<'y> - | ^^^^^^^^^^^^^^ -LL | -LL | where 'x: 'y - | -- hidden type `Cell<&'x u32>` captures the lifetime `'x` as defined here + | -- ^^^^^^^^^^^^^^ + | | + | hidden type `Cell<&'x u32>` captures the lifetime `'x` as defined here | help: to declare that the `impl Trait` captures 'x, you can add an explicit `'x` lifetime bound | diff --git a/src/test/ui/in-band-lifetimes/E0687.rs b/src/test/ui/in-band-lifetimes/E0687.rs index 2e262ddaea3f4..9022ae743b97f 100644 --- a/src/test/ui/in-band-lifetimes/E0687.rs +++ b/src/test/ui/in-band-lifetimes/E0687.rs @@ -7,10 +7,12 @@ fn bar(x: &Fn(&'a u32)) {} //~ ERROR must be explicitly fn baz(x: fn(&'a u32), y: &'a u32) {} //~ ERROR must be explicitly -struct Foo<'a> { x: &'a u32 } +struct Foo<'a> { + x: &'a u32, +} impl Foo<'a> { - fn bar(&self, x: fn(&'a u32)) {} //~ ERROR must be explicitly + fn bar(&self, x: fn(&'a u32)) {} } fn main() {} diff --git a/src/test/ui/in-band-lifetimes/E0687.stderr b/src/test/ui/in-band-lifetimes/E0687.stderr index 7aea2f220466c..3d4fe2e886253 100644 --- a/src/test/ui/in-band-lifetimes/E0687.stderr +++ b/src/test/ui/in-band-lifetimes/E0687.stderr @@ -16,12 +16,6 @@ error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared LL | fn baz(x: fn(&'a u32), y: &'a u32) {} | ^^ in-band lifetime definition -error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders - --> $DIR/E0687.rs:13:26 - | -LL | fn bar(&self, x: fn(&'a u32)) {} - | ^^ in-band lifetime definition - -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0687`. diff --git a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs index c1c40afdbab55..caa7159347b4b 100644 --- a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs +++ b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs @@ -7,7 +7,7 @@ fn foo(x: &u32) { fn foo2(x: &u32) {} fn bar() { - let y: fn(&'test u32) = foo2; //~ ERROR use of undeclared lifetime + let y: fn(&'test u32) = foo2; //~ ERROR lifetimes used in `fn` or `Fn` syntax must be } fn main() {} diff --git a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr index 5f0de61e69d29..066888b9e15ed 100644 --- a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr +++ b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr @@ -6,22 +6,13 @@ LL | fn foo(x: &u32) { LL | let y: &'test u32 = x; | ^^^^^ undeclared lifetime -error[E0261]: use of undeclared lifetime name `'test` +error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders --> $DIR/no_introducing_in_band_in_locals.rs:10:16 | LL | let y: fn(&'test u32) = foo2; - | ^^^^^ undeclared lifetime - | - = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html -help: consider introducing lifetime `'test` here - | -LL | fn bar<'test>() { - | +++++++ -help: consider making the type lifetime-generic with a new `'test` lifetime - | -LL | let y: for<'test> fn(&'test u32) = foo2; - | ++++++++++ + | ^^^^^ in-band lifetime definition error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0261`. +Some errors have detailed explanations: E0261, E0687. +For more information about an error, try `rustc --explain E0261`. diff --git a/src/test/ui/issues/issue-10412.rs b/src/test/ui/issues/issue-10412.rs index 020585136856b..b6c64a61d5548 100644 --- a/src/test/ui/issues/issue-10412.rs +++ b/src/test/ui/issues/issue-10412.rs @@ -1,16 +1,21 @@ -trait Serializable<'self, T> { //~ ERROR lifetimes cannot use keyword names - fn serialize(val : &'self T) -> Vec; //~ ERROR lifetimes cannot use keyword names - fn deserialize(repr : &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names +trait Serializable<'self, T> { + //~^ ERROR lifetimes cannot use keyword names + fn serialize(val: &'self T) -> Vec; //~ ERROR lifetimes cannot use keyword names + fn deserialize(repr: &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names } -impl<'self> Serializable for &'self str { //~ ERROR lifetimes cannot use keyword names +impl<'self> Serializable for &'self str { //~^ ERROR lifetimes cannot use keyword names + //~| ERROR lifetimes cannot use keyword names //~| ERROR implicit elided lifetime not allowed here //~| ERROR the size for values of type `str` cannot be known at compilation time - fn serialize(val : &'self str) -> Vec { //~ ERROR lifetimes cannot use keyword names + //~| ERROR missing lifetime specifier [E0106] + fn serialize(val: &'self str) -> Vec { + //~^ ERROR lifetimes cannot use keyword names vec![1] } - fn deserialize(repr: &[u8]) -> &'self str { //~ ERROR lifetimes cannot use keyword names + fn deserialize(repr: &[u8]) -> &'self str { + //~^ ERROR lifetimes cannot use keyword names "hi" } } diff --git a/src/test/ui/issues/issue-10412.stderr b/src/test/ui/issues/issue-10412.stderr index 053a93e6cd8c7..8b739c6fa5c79 100644 --- a/src/test/ui/issues/issue-10412.stderr +++ b/src/test/ui/issues/issue-10412.stderr @@ -5,51 +5,62 @@ LL | trait Serializable<'self, T> { | ^^^^^ error: lifetimes cannot use keyword names - --> $DIR/issue-10412.rs:2:25 + --> $DIR/issue-10412.rs:3:24 | -LL | fn serialize(val : &'self T) -> Vec; - | ^^^^^ +LL | fn serialize(val: &'self T) -> Vec; + | ^^^^^ error: lifetimes cannot use keyword names - --> $DIR/issue-10412.rs:3:38 + --> $DIR/issue-10412.rs:4:37 | -LL | fn deserialize(repr : &[u8]) -> &'self T; - | ^^^^^ +LL | fn deserialize(repr: &[u8]) -> &'self T; + | ^^^^^ error: lifetimes cannot use keyword names - --> $DIR/issue-10412.rs:6:6 + --> $DIR/issue-10412.rs:7:6 | LL | impl<'self> Serializable for &'self str { | ^^^^^ error: lifetimes cannot use keyword names - --> $DIR/issue-10412.rs:6:36 + --> $DIR/issue-10412.rs:7:36 | LL | impl<'self> Serializable for &'self str { | ^^^^^ error: lifetimes cannot use keyword names - --> $DIR/issue-10412.rs:10:25 + --> $DIR/issue-10412.rs:13:24 | -LL | fn serialize(val : &'self str) -> Vec { - | ^^^^^ +LL | fn serialize(val: &'self str) -> Vec { + | ^^^^^ error: lifetimes cannot use keyword names - --> $DIR/issue-10412.rs:13:37 + --> $DIR/issue-10412.rs:17:37 | LL | fn deserialize(repr: &[u8]) -> &'self str { | ^^^^^ error[E0726]: implicit elided lifetime not allowed here - --> $DIR/issue-10412.rs:6:13 + --> $DIR/issue-10412.rs:7:13 | LL | impl<'self> Serializable for &'self str { | ^^^^^^^^^^^^^^^^^ help: indicate the anonymous lifetime: `Serializable<'_, str>` | = note: assuming a `'static` lifetime... +error[E0106]: missing lifetime specifier + --> $DIR/issue-10412.rs:7:26 + | +LL | impl<'self> Serializable for &'self str { + | ^ expected named lifetime parameter + | +help: consider using the `'self` lifetime + | +LL | impl<'self> Serializable<'self, str> for &'self str { + | ++++++ + error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/issue-10412.rs:6:13 + --> $DIR/issue-10412.rs:7:13 | LL | impl<'self> Serializable for &'self str { | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -65,6 +76,7 @@ help: consider relaxing the implicit `Sized` restriction LL | trait Serializable<'self, T: ?Sized> { | ++++++++ -error: aborting due to 9 previous errors +error: aborting due to 10 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0106, E0277. +For more information about an error, try `rustc --explain E0106`. diff --git a/src/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr b/src/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr index e18d725faefea..0c66a005d4227 100644 --- a/src/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr +++ b/src/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr @@ -5,14 +5,14 @@ LL | struct Test { | - help: consider introducing lifetime `'b` here: `<'b>` LL | a: &'b str, | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'b` --> $DIR/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:3:9 | LL | #[derive(Eq, PartialEq)] - | -- lifetime `'b` is missing in item created through this procedural macro + | --- help: consider introducing lifetime `'b` here: `'b,` + | | + | lifetime `'b` is missing in item created through this procedural macro LL | struct Test { LL | a: &'b str, | ^^ undeclared lifetime diff --git a/src/test/ui/lint/unused_labels.rs b/src/test/ui/lint/unused_labels.rs index 8a3568f65f63e..fb9a9ae2648a6 100644 --- a/src/test/ui/lint/unused_labels.rs +++ b/src/test/ui/lint/unused_labels.rs @@ -61,6 +61,7 @@ fn main() { //~^ WARN unused label 'many_used_shadowed: for _ in 0..10 { //~^ WARN label name `'many_used_shadowed` shadows a label name that is already in scope + //~| WARN label name `'many_used_shadowed` shadows a label name that is already in scope if 1 % 2 == 0 { break 'many_used_shadowed; } else { diff --git a/src/test/ui/lint/unused_labels.stderr b/src/test/ui/lint/unused_labels.stderr index 4bb1a437d2409..ed9287d54a44e 100644 --- a/src/test/ui/lint/unused_labels.stderr +++ b/src/test/ui/lint/unused_labels.stderr @@ -1,3 +1,21 @@ +warning: label name `'many_used_shadowed` shadows a label name that is already in scope + --> $DIR/unused_labels.rs:62:9 + | +LL | 'many_used_shadowed: for _ in 0..10 { + | ------------------- first declared here +LL | +LL | 'many_used_shadowed: for _ in 0..10 { + | ^^^^^^^^^^^^^^^^^^^ label `'many_used_shadowed` already in scope + +warning: label name `'many_used_shadowed` shadows a label name that is already in scope + --> $DIR/unused_labels.rs:62:9 + | +LL | 'many_used_shadowed: for _ in 0..10 { + | ------------------- first declared here +LL | +LL | 'many_used_shadowed: for _ in 0..10 { + | ^^^^^^^^^^^^^^^^^^^ label `'many_used_shadowed` already in scope + warning: unused label --> $DIR/unused_labels.rs:11:5 | @@ -41,25 +59,16 @@ LL | 'many_used_shadowed: for _ in 0..10 { | ^^^^^^^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:72:5 + --> $DIR/unused_labels.rs:73:5 | LL | 'unused_loop_label: loop { | ^^^^^^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:78:5 + --> $DIR/unused_labels.rs:79:5 | LL | 'unused_block_label: { | ^^^^^^^^^^^^^^^^^^^ -warning: label name `'many_used_shadowed` shadows a label name that is already in scope - --> $DIR/unused_labels.rs:62:9 - | -LL | 'many_used_shadowed: for _ in 0..10 { - | ------------------- first declared here -LL | -LL | 'many_used_shadowed: for _ in 0..10 { - | ^^^^^^^^^^^^^^^^^^^ label `'many_used_shadowed` already in scope - -warning: 9 warnings emitted +warning: 10 warnings emitted 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 2e9da6f9dc88c..547135ec4b4c9 100644 --- a/src/test/ui/macros/macro-lifetime-used-with-labels.rs +++ b/src/test/ui/macros/macro-lifetime-used-with-labels.rs @@ -14,14 +14,14 @@ macro_rules! x { macro_rules! br { ($a:lifetime) => { break $a; - } + }; } macro_rules! br2 { ($b:lifetime) => { - 'b: loop { //~ WARNING `'b` shadows a label name that is already in scope + 'b: loop { break $b; // this $b should refer to the outer loop. } - } + }; } fn main() { x!('a); diff --git a/src/test/ui/macros/macro-lifetime-used-with-labels.stderr b/src/test/ui/macros/macro-lifetime-used-with-labels.stderr deleted file mode 100644 index 69334e2119210..0000000000000 --- a/src/test/ui/macros/macro-lifetime-used-with-labels.stderr +++ /dev/null @@ -1,15 +0,0 @@ -warning: label name `'b` shadows a label name that is already in scope - --> $DIR/macro-lifetime-used-with-labels.rs:21:9 - | -LL | 'b: loop { - | ^^ label `'b` already in scope -... -LL | 'b: loop { - | -- first declared here -LL | br2!('b); - | -------- in this macro invocation - | - = note: this warning originates in the macro `br2` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: 1 warning emitted - diff --git a/src/test/ui/methods/method-call-lifetime-args-unresolved.rs b/src/test/ui/methods/method-call-lifetime-args-unresolved.rs index d16ba3df47b63..ba7231070a0f4 100644 --- a/src/test/ui/methods/method-call-lifetime-args-unresolved.rs +++ b/src/test/ui/methods/method-call-lifetime-args-unresolved.rs @@ -1,3 +1,6 @@ fn main() { - 0.clone::<'a>(); //~ ERROR use of undeclared lifetime name `'a` + 0.clone::<'a>(); + //~^ ERROR use of undeclared lifetime name `'a` + //~| WARN cannot specify lifetime arguments explicitly if late bound + //~| WARN this was previously accepted by the compiler } diff --git a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr index 93c0384fcc266..2fa22c9ad995a 100644 --- a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr +++ b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr @@ -8,6 +8,21 @@ LL | 0.clone::<'a>(); | = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes -error: aborting due to previous error +warning: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present + --> $DIR/method-call-lifetime-args-unresolved.rs:2:15 + | +LL | 0.clone::<'a>(); + | ^^ + | + ::: $SRC_DIR/core/src/clone.rs:LL:COL + | +LL | fn clone(&self) -> Self; + | - the late bound lifetime parameter is introduced here + | + = note: `#[warn(late_bound_lifetime_arguments)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #42868 + +error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0261`. diff --git a/src/test/ui/panics/location-detail-panic-no-column.run.stderr b/src/test/ui/panics/location-detail-panic-no-column.run.stderr index 9f35623fba392..56e8cc6320e15 100644 --- a/src/test/ui/panics/location-detail-panic-no-column.run.stderr +++ b/src/test/ui/panics/location-detail-panic-no-column.run.stderr @@ -1,2 +1,50 @@ thread 'main' panicked at 'column-redacted', $DIR/location-detail-panic-no-column.rs:6:0 -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +stack backtrace: + 0: 0x7f8f5098da37 - std::backtrace_rs::backtrace::libunwind::trace::hc13f57558ccbe1c0 + at $SRC_DIR/std/src/../../backtrace/src/backtrace/libunwind.rs:LL:COL + 1: 0x7f8f5098da37 - std::backtrace_rs::backtrace::trace_unsynchronized::h0ba7c9fd2d8df1a7 + at $SRC_DIR/std/src/../../backtrace/src/backtrace/mod.rs:LL:COL + 2: 0x7f8f509c538a - std::sys_common::backtrace::_print_fmt::hfd0b34fa09501b14 + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 3: 0x7f8f509c538a - ::fmt::h16d79d304baa5bf5 + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 4: 0x7f8f50a3f95a - core::fmt::write::hdc6538b0659603cd + at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + 5: 0x7f8f509d2492 - std::io::Write::write_fmt::h178c096e1e554155 + at $SRC_DIR/std/src/io/mod.rs:LL:COL + 6: 0x7f8f509c6b7c - std::sys_common::backtrace::_print::hf53c91d94be1940a + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 7: 0x7f8f509c6b7c - std::sys_common::backtrace::print::h24b2a0fff734f579 + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 8: 0x7f8f509c6b7c - std::panicking::default_hook::{{closure}}::h21047dc7f75070bc + at $SRC_DIR/std/src/panicking.rs:LL:COL + 9: 0x7f8f509c6823 - std::panicking::default_hook::h1e63bdbfa5e08794 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 10: 0x7f8f509c70c5 - std::panicking::rust_panic_with_hook::h6b2517373d106b14 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 11: 0x5584203bed24 - std::panicking::begin_panic::{{closure}}::hc29bd0d27f21ec1f + 12: 0x5584203bec9c - std::sys_common::backtrace::__rust_end_short_backtrace::h0c7f1a3174ad32ca + 13: 0x5584203becf2 - std::panicking::begin_panic::h1593fa75acc3a331 + 14: 0x5584203bedd6 - location_detail_panic_no_column::main::h8d12b8b41240d4df + 15: 0x5584203beca3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1c6789a0e7f989d5 + 16: 0x5584203becb9 - std::rt::lang_start::{{closure}}::h71d79cbafe9b5142 + 17: 0x7f8f5098d285 - std::panicking::try::do_call::hd06046c6ef182bc2 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 18: 0x7f8f5098d285 - std::panicking::try::h0f31985a464394df + at $SRC_DIR/std/src/panicking.rs:LL:COL + 19: 0x7f8f5098d285 - std::panic::catch_unwind::h8b78424877c919fa + at $SRC_DIR/std/src/panic.rs:LL:COL + 20: 0x7f8f5098d285 - std::rt::lang_start_internal::{{closure}}::h1357335e8f30db71 + at $SRC_DIR/std/src/rt.rs:LL:COL + 21: 0x7f8f5098d285 - std::panicking::try::do_call::h8f8f209ec21cb601 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 22: 0x7f8f5098d285 - std::panicking::try::h2a224e3f86719b13 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 23: 0x7f8f5098d285 - std::panic::catch_unwind::ha3afd6710f9ae126 + at $SRC_DIR/std/src/panic.rs:LL:COL + 24: 0x7f8f509a2c4b - std::rt::lang_start_internal::hf422800097c0f41b + at $SRC_DIR/std/src/rt.rs:LL:COL + 25: 0x5584203bee02 - main + 26: 0x7f8f506e8b25 - __libc_start_main + 27: 0x5584203beb9e - _start + 28: 0x0 - diff --git a/src/test/ui/panics/location-detail-panic-no-file.run.stderr b/src/test/ui/panics/location-detail-panic-no-file.run.stderr index 1e07e3a07afd5..fe8b47ce56265 100644 --- a/src/test/ui/panics/location-detail-panic-no-file.run.stderr +++ b/src/test/ui/panics/location-detail-panic-no-file.run.stderr @@ -1,2 +1,50 @@ thread 'main' panicked at 'file-redacted', :6:5 -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +stack backtrace: + 0: 0x7f4340995a37 - std::backtrace_rs::backtrace::libunwind::trace::hc13f57558ccbe1c0 + at $SRC_DIR/std/src/../../backtrace/src/backtrace/libunwind.rs:LL:COL + 1: 0x7f4340995a37 - std::backtrace_rs::backtrace::trace_unsynchronized::h0ba7c9fd2d8df1a7 + at $SRC_DIR/std/src/../../backtrace/src/backtrace/mod.rs:LL:COL + 2: 0x7f43409cd38a - std::sys_common::backtrace::_print_fmt::hfd0b34fa09501b14 + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 3: 0x7f43409cd38a - ::fmt::h16d79d304baa5bf5 + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 4: 0x7f4340a4795a - core::fmt::write::hdc6538b0659603cd + at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + 5: 0x7f43409da492 - std::io::Write::write_fmt::h178c096e1e554155 + at $SRC_DIR/std/src/io/mod.rs:LL:COL + 6: 0x7f43409ceb7c - std::sys_common::backtrace::_print::hf53c91d94be1940a + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 7: 0x7f43409ceb7c - std::sys_common::backtrace::print::h24b2a0fff734f579 + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 8: 0x7f43409ceb7c - std::panicking::default_hook::{{closure}}::h21047dc7f75070bc + at $SRC_DIR/std/src/panicking.rs:LL:COL + 9: 0x7f43409ce823 - std::panicking::default_hook::h1e63bdbfa5e08794 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 10: 0x7f43409cf0c5 - std::panicking::rust_panic_with_hook::h6b2517373d106b14 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 11: 0x55d75d061ce4 - std::panicking::begin_panic::{{closure}}::h0079e56bea5de335 + 12: 0x55d75d061c5c - std::sys_common::backtrace::__rust_end_short_backtrace::h887357ffacd6fc32 + 13: 0x55d75d061cb2 - std::panicking::begin_panic::had5d621a3516066f + 14: 0x55d75d061d96 - location_detail_panic_no_file::main::hd8d5b6195cb2ac54 + 15: 0x55d75d061c63 - std::sys_common::backtrace::__rust_begin_short_backtrace::hd85dfae043b14d7f + 16: 0x55d75d061c79 - std::rt::lang_start::{{closure}}::hacebf79939489295 + 17: 0x7f4340995285 - std::panicking::try::do_call::hd06046c6ef182bc2 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 18: 0x7f4340995285 - std::panicking::try::h0f31985a464394df + at $SRC_DIR/std/src/panicking.rs:LL:COL + 19: 0x7f4340995285 - std::panic::catch_unwind::h8b78424877c919fa + at $SRC_DIR/std/src/panic.rs:LL:COL + 20: 0x7f4340995285 - std::rt::lang_start_internal::{{closure}}::h1357335e8f30db71 + at $SRC_DIR/std/src/rt.rs:LL:COL + 21: 0x7f4340995285 - std::panicking::try::do_call::h8f8f209ec21cb601 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 22: 0x7f4340995285 - std::panicking::try::h2a224e3f86719b13 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 23: 0x7f4340995285 - std::panic::catch_unwind::ha3afd6710f9ae126 + at $SRC_DIR/std/src/panic.rs:LL:COL + 24: 0x7f43409aac4b - std::rt::lang_start_internal::hf422800097c0f41b + at $SRC_DIR/std/src/rt.rs:LL:COL + 25: 0x55d75d061dc2 - main + 26: 0x7f43406f0b25 - __libc_start_main + 27: 0x55d75d061b5e - _start + 28: 0x0 - diff --git a/src/test/ui/panics/location-detail-panic-no-line.run.stderr b/src/test/ui/panics/location-detail-panic-no-line.run.stderr index cc3f1624c49ab..d2b7141753120 100644 --- a/src/test/ui/panics/location-detail-panic-no-line.run.stderr +++ b/src/test/ui/panics/location-detail-panic-no-line.run.stderr @@ -1,2 +1,50 @@ thread 'main' panicked at 'line-redacted', $DIR/location-detail-panic-no-line.rs:0:5 -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +stack backtrace: + 0: 0x7fbbaf479a37 - std::backtrace_rs::backtrace::libunwind::trace::hc13f57558ccbe1c0 + at $SRC_DIR/std/src/../../backtrace/src/backtrace/libunwind.rs:LL:COL + 1: 0x7fbbaf479a37 - std::backtrace_rs::backtrace::trace_unsynchronized::h0ba7c9fd2d8df1a7 + at $SRC_DIR/std/src/../../backtrace/src/backtrace/mod.rs:LL:COL + 2: 0x7fbbaf4b138a - std::sys_common::backtrace::_print_fmt::hfd0b34fa09501b14 + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 3: 0x7fbbaf4b138a - ::fmt::h16d79d304baa5bf5 + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 4: 0x7fbbaf52b95a - core::fmt::write::hdc6538b0659603cd + at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + 5: 0x7fbbaf4be492 - std::io::Write::write_fmt::h178c096e1e554155 + at $SRC_DIR/std/src/io/mod.rs:LL:COL + 6: 0x7fbbaf4b2b7c - std::sys_common::backtrace::_print::hf53c91d94be1940a + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 7: 0x7fbbaf4b2b7c - std::sys_common::backtrace::print::h24b2a0fff734f579 + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 8: 0x7fbbaf4b2b7c - std::panicking::default_hook::{{closure}}::h21047dc7f75070bc + at $SRC_DIR/std/src/panicking.rs:LL:COL + 9: 0x7fbbaf4b2823 - std::panicking::default_hook::h1e63bdbfa5e08794 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 10: 0x7fbbaf4b30c5 - std::panicking::rust_panic_with_hook::h6b2517373d106b14 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 11: 0x5559f0559d24 - std::panicking::begin_panic::{{closure}}::h1afa1057f376144b + 12: 0x5559f0559c9c - std::sys_common::backtrace::__rust_end_short_backtrace::h1ab15588b2849c06 + 13: 0x5559f0559cf2 - std::panicking::begin_panic::h628edeaaff5865b9 + 14: 0x5559f0559dd6 - location_detail_panic_no_line::main::h44a33e4045fb965c + 15: 0x5559f0559ca3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h95c4bf0d8ee1823d + 16: 0x5559f0559cb9 - std::rt::lang_start::{{closure}}::hec89a90f7e30ea92 + 17: 0x7fbbaf479285 - std::panicking::try::do_call::hd06046c6ef182bc2 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 18: 0x7fbbaf479285 - std::panicking::try::h0f31985a464394df + at $SRC_DIR/std/src/panicking.rs:LL:COL + 19: 0x7fbbaf479285 - std::panic::catch_unwind::h8b78424877c919fa + at $SRC_DIR/std/src/panic.rs:LL:COL + 20: 0x7fbbaf479285 - std::rt::lang_start_internal::{{closure}}::h1357335e8f30db71 + at $SRC_DIR/std/src/rt.rs:LL:COL + 21: 0x7fbbaf479285 - std::panicking::try::do_call::h8f8f209ec21cb601 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 22: 0x7fbbaf479285 - std::panicking::try::h2a224e3f86719b13 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 23: 0x7fbbaf479285 - std::panic::catch_unwind::ha3afd6710f9ae126 + at $SRC_DIR/std/src/panic.rs:LL:COL + 24: 0x7fbbaf48ec4b - std::rt::lang_start_internal::hf422800097c0f41b + at $SRC_DIR/std/src/rt.rs:LL:COL + 25: 0x5559f0559e02 - main + 26: 0x7fbbaf1d4b25 - __libc_start_main + 27: 0x5559f0559b9e - _start + 28: 0x0 - diff --git a/src/test/ui/panics/location-detail-unwrap-no-file.run.stderr b/src/test/ui/panics/location-detail-unwrap-no-file.run.stderr index f8f84b5c49a22..9c972079bbddf 100644 --- a/src/test/ui/panics/location-detail-unwrap-no-file.run.stderr +++ b/src/test/ui/panics/location-detail-unwrap-no-file.run.stderr @@ -1,2 +1,57 @@ thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', :7:9 -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +stack backtrace: + 0: 0x7f7fc1812a37 - std::backtrace_rs::backtrace::libunwind::trace::hc13f57558ccbe1c0 + at $SRC_DIR/std/src/../../backtrace/src/backtrace/libunwind.rs:LL:COL + 1: 0x7f7fc1812a37 - std::backtrace_rs::backtrace::trace_unsynchronized::h0ba7c9fd2d8df1a7 + at $SRC_DIR/std/src/../../backtrace/src/backtrace/mod.rs:LL:COL + 2: 0x7f7fc184a38a - std::sys_common::backtrace::_print_fmt::hfd0b34fa09501b14 + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 3: 0x7f7fc184a38a - ::fmt::h16d79d304baa5bf5 + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 4: 0x7f7fc18c495a - core::fmt::write::hdc6538b0659603cd + at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + 5: 0x7f7fc1857492 - std::io::Write::write_fmt::h178c096e1e554155 + at $SRC_DIR/std/src/io/mod.rs:LL:COL + 6: 0x7f7fc184bb7c - std::sys_common::backtrace::_print::hf53c91d94be1940a + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 7: 0x7f7fc184bb7c - std::sys_common::backtrace::print::h24b2a0fff734f579 + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 8: 0x7f7fc184bb7c - std::panicking::default_hook::{{closure}}::h21047dc7f75070bc + at $SRC_DIR/std/src/panicking.rs:LL:COL + 9: 0x7f7fc184b823 - std::panicking::default_hook::h1e63bdbfa5e08794 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 10: 0x7f7fc184c0c5 - std::panicking::rust_panic_with_hook::h6b2517373d106b14 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 11: 0x7f7fc18437cd - std::panicking::begin_panic_handler::{{closure}}::he3187d78b52d47dc + at $SRC_DIR/std/src/panicking.rs:LL:COL + 12: 0x7f7fc1843734 - std::sys_common::backtrace::__rust_end_short_backtrace::h22b1f01f203d8785 + at $SRC_DIR/std/src/sys_common/backtrace.rs:LL:COL + 13: 0x7f7fc184bcb2 - rust_begin_unwind + at $SRC_DIR/std/src/panicking.rs:LL:COL + 14: 0x7f7fc18c43cb - core::panicking::panic_fmt::h4e9086903f62cbbb + at $SRC_DIR/core/src/panicking.rs:LL:COL + 15: 0x7f7fc18c425d - core::panicking::panic::h15c9aab8a3d2e545 + at $SRC_DIR/core/src/panicking.rs:LL:COL + 16: 0x556ac89969ca - location_detail_unwrap_no_file::main::h6509d9167e171e53 + 17: 0x556ac8996973 - std::sys_common::backtrace::__rust_begin_short_backtrace::h31b673d7f0ef8c6a + 18: 0x556ac8996989 - std::rt::lang_start::{{closure}}::h3519a9a2496cd93d + 19: 0x7f7fc1812285 - std::panicking::try::do_call::hd06046c6ef182bc2 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 20: 0x7f7fc1812285 - std::panicking::try::h0f31985a464394df + at $SRC_DIR/std/src/panicking.rs:LL:COL + 21: 0x7f7fc1812285 - std::panic::catch_unwind::h8b78424877c919fa + at $SRC_DIR/std/src/panic.rs:LL:COL + 22: 0x7f7fc1812285 - std::rt::lang_start_internal::{{closure}}::h1357335e8f30db71 + at $SRC_DIR/std/src/rt.rs:LL:COL + 23: 0x7f7fc1812285 - std::panicking::try::do_call::h8f8f209ec21cb601 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 24: 0x7f7fc1812285 - std::panicking::try::h2a224e3f86719b13 + at $SRC_DIR/std/src/panicking.rs:LL:COL + 25: 0x7f7fc1812285 - std::panic::catch_unwind::ha3afd6710f9ae126 + at $SRC_DIR/std/src/panic.rs:LL:COL + 26: 0x7f7fc1827c4b - std::rt::lang_start_internal::hf422800097c0f41b + at $SRC_DIR/std/src/rt.rs:LL:COL + 27: 0x556ac89969f2 - main + 28: 0x7f7fc156db25 - __libc_start_main + 29: 0x556ac899689e - _start + 30: 0x0 - diff --git a/src/test/ui/regions/regions-in-enums.stderr b/src/test/ui/regions/regions-in-enums.stderr index d56c1fbd119c8..66537653291c7 100644 --- a/src/test/ui/regions/regions-in-enums.stderr +++ b/src/test/ui/regions/regions-in-enums.stderr @@ -5,8 +5,6 @@ LL | enum No0 { | - help: consider introducing lifetime `'foo` here: `<'foo>` LL | X5(&'foo usize) | ^^^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-in-enums.rs:17:9 @@ -15,8 +13,6 @@ LL | enum No1 { | - help: consider introducing lifetime `'a` here: `<'a>` LL | X6(&'a usize) | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-in-structs.stderr b/src/test/ui/regions/regions-in-structs.stderr index 2750149d09735..5dfdc2ee93b43 100644 --- a/src/test/ui/regions/regions-in-structs.stderr +++ b/src/test/ui/regions/regions-in-structs.stderr @@ -5,8 +5,6 @@ LL | struct StructDecl { | - help: consider introducing lifetime `'a` here: `<'a>` LL | a: &'a isize, | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-in-structs.rs:11:9 @@ -16,8 +14,6 @@ LL | struct StructDecl { LL | a: &'a isize, LL | b: &'a isize, | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-name-duplicated.rs b/src/test/ui/regions/regions-name-duplicated.rs index f2adf01531569..ee9549991ce24 100644 --- a/src/test/ui/regions/regions-name-duplicated.rs +++ b/src/test/ui/regions/regions-name-duplicated.rs @@ -1,5 +1,7 @@ -struct Foo<'a, 'a> { //~ ERROR lifetime name `'a` declared twice - x: &'a isize +struct Foo<'a, 'a> { + //~^ ERROR lifetime name `'a` declared twice + //~| ERROR parameter `'a` is never used [E0392] + x: &'a isize, } fn main() {} diff --git a/src/test/ui/regions/regions-name-duplicated.stderr b/src/test/ui/regions/regions-name-duplicated.stderr index a7e03a61adcf5..6d6e28c8479e5 100644 --- a/src/test/ui/regions/regions-name-duplicated.stderr +++ b/src/test/ui/regions/regions-name-duplicated.stderr @@ -2,10 +2,19 @@ error[E0263]: lifetime name `'a` declared twice in the same scope --> $DIR/regions-name-duplicated.rs:1:16 | LL | struct Foo<'a, 'a> { - | -- ^^ declared twice + | -- ^^ lifetime `'a` already in scope | | - | previous declaration here + | first declared here -error: aborting due to previous error +error[E0392]: parameter `'a` is never used + --> $DIR/regions-name-duplicated.rs:1:12 + | +LL | struct Foo<'a, 'a> { + | ^^ unused parameter + | + = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0263`. +Some errors have detailed explanations: E0263, E0392. +For more information about an error, try `rustc --explain E0263`. diff --git a/src/test/ui/regions/regions-name-static.rs b/src/test/ui/regions/regions-name-static.rs index 730fd99aa68c2..cc52f5d1f840a 100644 --- a/src/test/ui/regions/regions-name-static.rs +++ b/src/test/ui/regions/regions-name-static.rs @@ -1,5 +1,7 @@ -struct Foo<'static> { //~ ERROR invalid lifetime parameter name: `'static` - x: &'static isize +struct Foo<'static> { + //~^ ERROR invalid lifetime parameter name: `'static` + //~| ERROR parameter `'static` is never used [E0392] + x: &'static isize, } fn main() {} diff --git a/src/test/ui/regions/regions-name-static.stderr b/src/test/ui/regions/regions-name-static.stderr index 4b7026e65eacc..e1e19eaea2826 100644 --- a/src/test/ui/regions/regions-name-static.stderr +++ b/src/test/ui/regions/regions-name-static.stderr @@ -4,6 +4,15 @@ error[E0262]: invalid lifetime parameter name: `'static` LL | struct Foo<'static> { | ^^^^^^^ 'static is a reserved lifetime name -error: aborting due to previous error +error[E0392]: parameter `'static` is never used + --> $DIR/regions-name-static.rs:1:12 + | +LL | struct Foo<'static> { + | ^^^^^^^ unused parameter + | + = help: consider removing `'static`, referring to it in a field, or using a marker such as `PhantomData` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0262`. +Some errors have detailed explanations: E0262, E0392. +For more information about an error, try `rustc --explain E0262`. diff --git a/src/test/ui/regions/regions-name-undeclared.stderr b/src/test/ui/regions/regions-name-undeclared.stderr index 250752c9b9e68..00049db795875 100644 --- a/src/test/ui/regions/regions-name-undeclared.stderr +++ b/src/test/ui/regions/regions-name-undeclared.stderr @@ -1,23 +1,3 @@ -error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/regions-name-undeclared.rs:28:13 - | -LL | enum E { - | - help: consider introducing lifetime `'a` here: `<'a>` -LL | E1(&'a isize) - | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes - -error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/regions-name-undeclared.rs:31:13 - | -LL | struct S { - | - help: consider introducing lifetime `'a` here: `<'a>` -LL | f: &'a isize - | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes - error[E0261]: use of undeclared lifetime name `'b` --> $DIR/regions-name-undeclared.rs:16:24 | @@ -73,8 +53,22 @@ LL | type X = Option<&'a isize>; | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'a` here: `<'a>` + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/regions-name-undeclared.rs:28:13 | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes +LL | enum E { + | - help: consider introducing lifetime `'a` here: `<'a>` +LL | E1(&'a isize) + | ^^ undeclared lifetime + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/regions-name-undeclared.rs:31:13 + | +LL | struct S { + | - help: consider introducing lifetime `'a` here: `<'a>` +LL | f: &'a isize + | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:33:14 @@ -103,15 +97,14 @@ LL | ... &'b isize, | ^^ undeclared lifetime | = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes help: consider introducing lifetime `'b` here | LL | fn fn_types<'b>(a: &'a isize, | ++++ help: consider making the bound lifetime-generic with a new `'b` lifetime | -LL | b: Box FnOnce(&'a isize, - | ++++ +LL | b: Box FnOnce(&'a isize, + | +++ error[E0261]: use of undeclared lifetime name `'b` --> $DIR/regions-name-undeclared.rs:46:36 @@ -120,15 +113,14 @@ LL | ... &'b isize)>, | ^^ undeclared lifetime | = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes help: consider introducing lifetime `'b` here | LL | fn fn_types<'b>(a: &'a isize, | ++++ help: consider making the bound lifetime-generic with a new `'b` lifetime | -LL | b: Box FnOnce(&'a isize, - | ++++ +LL | b: Box FnOnce(&'a isize, + | +++ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:47:17 diff --git a/src/test/ui/regions/regions-undeclared.stderr b/src/test/ui/regions/regions-undeclared.stderr index f3cae184ccde8..46f2fb1a3c4c5 100644 --- a/src/test/ui/regions/regions-undeclared.stderr +++ b/src/test/ui/regions/regions-undeclared.stderr @@ -11,8 +11,6 @@ LL | enum EnumDecl { | - help: consider introducing lifetime `'a` here: `<'a>` LL | Foo(&'a isize), | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:5:10 @@ -22,8 +20,6 @@ LL | enum EnumDecl { LL | Foo(&'a isize), LL | Bar(&'a isize), | ^^ undeclared lifetime - | - = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:8:15 diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.rs b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.rs index dd434ea531878..6d3acebaaf3d6 100644 --- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.rs +++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.rs @@ -13,8 +13,9 @@ impl Get for Foo { } fn foo(g: G, dest: &mut T) -> impl FnOnce() +//~^ ERROR hidden type for `impl Trait` captures lifetime where - G: Get + G: Get, { move || { *dest = g.get(); @@ -23,19 +24,20 @@ where // After applying suggestion for `foo`: fn bar(g: G, dest: &mut T) -> impl FnOnce() + '_ +//~^ ERROR the parameter type `G` may not live long enough where - G: Get + G: Get, { move || { *dest = g.get(); } } - // After applying suggestion for `bar`: -fn baz(g: G, dest: &mut T) -> impl FnOnce() + '_ //~ ERROR undeclared lifetime +fn baz(g: G, dest: &mut T) -> impl FnOnce() + '_ +//~^ ERROR undeclared lifetime name `'a` where - G: Get + G: Get, { move || { *dest = g.get(); @@ -44,8 +46,9 @@ where // After applying suggestion for `baz`: fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ +//~^ ERROR the parameter type `G` may not live long enough where - G: Get + G: Get, { move || { *dest = g.get(); @@ -55,6 +58,7 @@ where // Same as above, but show that we pay attention to lifetime names from parent item impl<'a> Foo { fn qux<'b, G: Get + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { + //~^ ERROR the parameter type `G` may not live long enough move || { *dest = g.get(); } @@ -63,8 +67,9 @@ impl<'a> Foo { // After applying suggestion for `qux`: fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a +//~^ ERROR explicit lifetime required in the type of `dest` where - G: Get + G: Get, { move || { *dest = g.get(); @@ -73,19 +78,19 @@ where // Potential incorrect attempt: fn bak<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a +//~^ ERROR the parameter type `G` may not live long enough where - G: Get + G: Get, { move || { *dest = g.get(); } } - // We need to tie the lifetime of `G` with the lifetime of `&mut T` and the returned closure: fn ok<'a, G: 'a, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a where - G: Get + G: Get, { move || { *dest = g.get(); @@ -95,7 +100,7 @@ where // This also works. The `'_` isn't necessary but it's where we arrive to following the suggestions: fn ok2<'a, G: 'a, T>(g: G, dest: &'a mut T) -> impl FnOnce() + '_ + 'a where - G: Get + G: Get, { move || { *dest = g.get(); diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr index 916a6c2bf12af..103f5e468214b 100644 --- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr +++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr @@ -1,11 +1,106 @@ error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/missing-lifetimes-in-signature.rs:36:11 + --> $DIR/missing-lifetimes-in-signature.rs:37:11 | LL | fn baz(g: G, dest: &mut T) -> impl FnOnce() + '_ | - ^^ undeclared lifetime | | | help: consider introducing lifetime `'a` here: `'a,` + | + = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes + +error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds + --> $DIR/missing-lifetimes-in-signature.rs:15:37 + | +LL | fn foo(g: G, dest: &mut T) -> impl FnOnce() + | ------ ^^^^^^^^^^^^^ + | | + | hidden type `[closure@$DIR/missing-lifetimes-in-signature.rs:20:5: 22:6]` captures the anonymous lifetime defined here + | +help: to declare that the `impl Trait` captures '_, you can add an explicit `'_` lifetime bound + | +LL | fn foo(g: G, dest: &mut T) -> impl FnOnce() + '_ + | ++++ + +error[E0311]: the parameter type `G` may not live long enough + --> $DIR/missing-lifetimes-in-signature.rs:26:37 + | +LL | fn bar(g: G, dest: &mut T) -> impl FnOnce() + '_ + | ^^^^^^^^^^^^^^^^^^ + | +note: the parameter type `G` must be valid for the anonymous lifetime defined here... + --> $DIR/missing-lifetimes-in-signature.rs:26:26 + | +LL | fn bar(g: G, dest: &mut T) -> impl FnOnce() + '_ + | ^^^^^^ +note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:31:5: 33:6]` will meet its required lifetime bounds + --> $DIR/missing-lifetimes-in-signature.rs:26:37 + | +LL | fn bar(g: G, dest: &mut T) -> impl FnOnce() + '_ + | ^^^^^^^^^^^^^^^^^^ +help: consider introducing an explicit lifetime bound + | +LL | fn bar<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a + | ~~~~~ ++++ + +error[E0311]: the parameter type `G` may not live long enough + --> $DIR/missing-lifetimes-in-signature.rs:48:45 + | +LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + | ^^^^^^^^^^^^^^^^^^ + | +note: the parameter type `G` must be valid for the anonymous lifetime defined here... + --> $DIR/missing-lifetimes-in-signature.rs:48:34 + | +LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + | ^^^^^^ +note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:53:5: 55:6]` will meet its required lifetime bounds + --> $DIR/missing-lifetimes-in-signature.rs:48:45 + | +LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + | ^^^^^^^^^^^^^^^^^^ +help: consider introducing an explicit lifetime bound + | +LL | fn qux<'b, 'a, G: 'b + 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'b + | +++ ~~~~~~~ ++++ + +error[E0311]: the parameter type `G` may not live long enough + --> $DIR/missing-lifetimes-in-signature.rs:60:58 + | +LL | fn qux<'b, G: Get + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { + | ^^^^^^^^^^^^^^^^^^ + | +note: the parameter type `G` must be valid for the anonymous lifetime defined here... + --> $DIR/missing-lifetimes-in-signature.rs:60:47 + | +LL | fn qux<'b, G: Get + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { + | ^^^^^^ +note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:62:9: 64:10]` will meet its required lifetime bounds + --> $DIR/missing-lifetimes-in-signature.rs:60:58 + | +LL | fn qux<'b, G: Get + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { + | ^^^^^^^^^^^^^^^^^^ +help: consider introducing an explicit lifetime bound + | +LL | fn qux<'c, 'b, G: 'c + Get + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'c { + | +++ ~~~~~~~ ++++ + +error[E0621]: explicit lifetime required in the type of `dest` + --> $DIR/missing-lifetimes-in-signature.rs:69:45 + | +LL | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a + | ------ ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required + | | + | help: add explicit lifetime `'a` to the type of `dest`: `&'a mut T` + +error[E0309]: the parameter type `G` may not live long enough + --> $DIR/missing-lifetimes-in-signature.rs:80:44 + | +LL | fn bak<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a + | - ^^^^^^^^^^^^^^^^^^ ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:85:5: 87:6]` will meet its required lifetime bounds + | | + | help: consider adding an explicit lifetime bound...: `G: 'a` -error: aborting due to previous error +error: aborting due to 7 previous errors -For more information about this error, try `rustc --explain E0261`. +Some errors have detailed explanations: E0261, E0309, E0621, E0700. +For more information about an error, try `rustc --explain E0261`. diff --git a/src/test/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs b/src/test/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs index 6732902c09a50..6d12d7b887236 100644 --- a/src/test/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs +++ b/src/test/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs @@ -16,7 +16,11 @@ impl WithAssoc for () { type Return = impl WithAssoc; //~^ ERROR use of undeclared lifetime name `'a` +//~| ERROR could not find defining uses +//~| ERROR could not find defining uses fn my_fun() -> Return<()> {} +//~^ ERROR non-defining opaque type use in defining scope +//~| ERROR non-defining opaque type use in defining scope fn main() {} diff --git a/src/test/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.stderr b/src/test/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.stderr index fe45e39d938f0..4b95dff8a2bec 100644 --- a/src/test/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.stderr @@ -2,10 +2,54 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/issue-69136-inner-lifetime-resolve-error.rs:17:65 | LL | type Return = impl WithAssoc; - | - ^^ undeclared lifetime - | | - | help: consider introducing lifetime `'a` here: `'a,` + | ^^ undeclared lifetime + | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html +help: consider introducing lifetime `'a` here + | +LL | type Return<'a, A> = impl WithAssoc; + | +++ +help: consider making the bound lifetime-generic with a new `'a` lifetime + | +LL | type Return = impl for<'a> WithAssoc; + | +++++++ + +error: non-defining opaque type use in defining scope + --> $DIR/issue-69136-inner-lifetime-resolve-error.rs:22:16 + | +LL | fn my_fun() -> Return<()> {} + | ^^^^^^^^^^ + | +note: used non-generic type `()` for generic parameter + --> $DIR/issue-69136-inner-lifetime-resolve-error.rs:17:13 + | +LL | type Return = impl WithAssoc; + | ^ + +error: non-defining opaque type use in defining scope + --> $DIR/issue-69136-inner-lifetime-resolve-error.rs:22:16 + | +LL | fn my_fun() -> Return<()> {} + | ^^^^^^^^^^ + | +note: used non-generic type `()` for generic parameter + --> $DIR/issue-69136-inner-lifetime-resolve-error.rs:17:13 + | +LL | type Return = impl WithAssoc; + | ^ + +error: could not find defining uses + --> $DIR/issue-69136-inner-lifetime-resolve-error.rs:17:18 + | +LL | type Return = impl WithAssoc; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: could not find defining uses + --> $DIR/issue-69136-inner-lifetime-resolve-error.rs:17:48 + | +LL | type Return = impl WithAssoc; + | ^^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0261`. diff --git a/src/test/ui/underscore-lifetime/in-binder.rs b/src/test/ui/underscore-lifetime/in-binder.rs index e4ee5e8cb2741..0fb69b844160f 100644 --- a/src/test/ui/underscore-lifetime/in-binder.rs +++ b/src/test/ui/underscore-lifetime/in-binder.rs @@ -3,29 +3,32 @@ // Regression test for #52098. struct IceCube<'a> { - v: Vec<&'a char> + v: Vec<&'a char>, } impl<'_> IceCube<'_> {} //~^ ERROR `'_` cannot be used here struct Struct<'_> { -//~^ ERROR `'_` cannot be used here - v: Vec<&'static char> + //~^ ERROR `'_` cannot be used here + //~| ERROR parameter `'_` is never used + v: Vec<&'static char>, } enum Enum<'_> { -//~^ ERROR `'_` cannot be used here - Variant + //~^ ERROR `'_` cannot be used here + //~| ERROR parameter `'_` is never used + Variant, } union Union<'_> { -//~^ ERROR `'_` cannot be used here - a: u32 + //~^ ERROR `'_` cannot be used here + //~| ERROR parameter `'_` is never used + a: u32, } trait Trait<'_> { -//~^ ERROR `'_` cannot be used here + //~^ ERROR `'_` cannot be used here } fn foo<'_>() { diff --git a/src/test/ui/underscore-lifetime/in-binder.stderr b/src/test/ui/underscore-lifetime/in-binder.stderr index fcd7eddb57605..f33e1b18a692d 100644 --- a/src/test/ui/underscore-lifetime/in-binder.stderr +++ b/src/test/ui/underscore-lifetime/in-binder.stderr @@ -11,29 +11,54 @@ LL | struct Struct<'_> { | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here - --> $DIR/in-binder.rs:17:11 + --> $DIR/in-binder.rs:18:11 | LL | enum Enum<'_> { | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here - --> $DIR/in-binder.rs:22:13 + --> $DIR/in-binder.rs:24:13 | LL | union Union<'_> { | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here - --> $DIR/in-binder.rs:27:13 + --> $DIR/in-binder.rs:30:13 | LL | trait Trait<'_> { | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here - --> $DIR/in-binder.rs:31:8 + --> $DIR/in-binder.rs:34:8 | LL | fn foo<'_>() { | ^^ `'_` is a reserved lifetime name -error: aborting due to 6 previous errors +error[E0392]: parameter `'_` is never used + --> $DIR/in-binder.rs:12:15 + | +LL | struct Struct<'_> { + | ^^ unused parameter + | + = help: consider removing `'_`, referring to it in a field, or using a marker such as `PhantomData` + +error[E0392]: parameter `'_` is never used + --> $DIR/in-binder.rs:18:11 + | +LL | enum Enum<'_> { + | ^^ unused parameter + | + = help: consider removing `'_`, referring to it in a field, or using a marker such as `PhantomData` + +error[E0392]: parameter `'_` is never used + --> $DIR/in-binder.rs:24:13 + | +LL | union Union<'_> { + | ^^ unused parameter + | + = help: consider removing `'_`, referring to it in a field, or using a marker such as `PhantomData` + +error: aborting due to 9 previous errors -For more information about this error, try `rustc --explain E0637`. +Some errors have detailed explanations: E0392, E0637. +For more information about an error, try `rustc --explain E0392`. diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr index 22bf1fdba326f..05fb13f5dc43e 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr @@ -28,10 +28,10 @@ LL | fn meh() -> Box Meh<'_>> | ^^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from -help: consider using the `'static` lifetime +help: consider using the `'_` lifetime | -LL | fn meh() -> Box Meh<'static>> - | ~~~~~~~ +LL | fn meh() -> Box Meh<'_>> + | ~~ error[E0106]: missing lifetime specifier --> $DIR/underscore-lifetime-binders.rs:16:35 diff --git a/src/test/ui/where-clauses/where-lifetime-resolution.stderr b/src/test/ui/where-clauses/where-lifetime-resolution.stderr index a704fea282899..47a6a4b680607 100644 --- a/src/test/ui/where-clauses/where-lifetime-resolution.stderr +++ b/src/test/ui/where-clauses/where-lifetime-resolution.stderr @@ -1,24 +1,46 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/where-lifetime-resolution.rs:6:38 | -LL | fn f() where - | - help: consider introducing lifetime `'a` here: `<'a>` -LL | for<'a> dyn Trait1<'a>: Trait1<'a>, // OK LL | (dyn for<'a> Trait1<'a>): Trait1<'a>, | ^^ undeclared lifetime | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes +help: consider introducing lifetime `'a` here + | +LL | fn f<'a>() where + | ++++ +help: consider making the bound lifetime-generic with a new `'a` lifetime + | +LL | for<'a> (dyn for<'a> Trait1<'a>): Trait1<'a>, + | +++++++ +help: consider making the bound lifetime-generic with a new `'a` lifetime + | +LL | (dyn for<'a> Trait1<'a>): for<'a> Trait1<'a>, + | +++++++ error[E0261]: use of undeclared lifetime name `'b` --> $DIR/where-lifetime-resolution.rs:8:52 | -LL | fn f() where - | - help: consider introducing lifetime `'b` here: `<'b>` -... LL | for<'a> dyn for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, | ^^ undeclared lifetime | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes +help: consider introducing lifetime `'b` here + | +LL | fn f<'b>() where + | ++++ +help: consider making the bound lifetime-generic with a new `'b` lifetime + | +LL | for<'afor<'b> > dyn for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, + | +++++++ +help: consider making the bound lifetime-generic with a new `'b` lifetime + | +LL | for<'a> dyn for<'b> Trait2<'a, 'b>: for<'b> Trait2<'a, 'b>, + | +++++++ error: aborting due to 2 previous errors