Skip to content
Closed
1,199 changes: 752 additions & 447 deletions compiler/rustc_resolve/src/late.rs

Large diffs are not rendered by default.

759 changes: 207 additions & 552 deletions compiler/rustc_resolve/src/late/diagnostics.rs

Large diffs are not rendered by default.

206 changes: 37 additions & 169 deletions compiler/rustc_resolve/src/late/lifetimes.rs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#![feature(bool_to_option)]
#![feature(crate_visibility_modifier)]
#![feature(if_let_guard)]
#![feature(iter_intersperse)]
#![feature(let_chains)]
#![feature(let_else)]
#![feature(never_type)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/abi/numbers-arithmetic/i128-ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
extern "C" {
fn identity(f: u128) -> u128;
fn square(f: i128) -> i128;
fn sub(f: i128, f: i128) -> i128;
fn sub(f: i128, g: i128) -> i128;
}

fn main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@ LL | fn elision<T: Fn() -> &i32>() {
| ^ 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
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the bound lifetime-generic with a new `'a` lifetime
|
LL | fn elision<T: for<'a> Fn() -> &'a i32>() {
| +++++++ ~~~
help: consider using the `'static` lifetime
|
LL | fn elision<T: Fn() -> &'static i32>() {
| ~~~~~~~~
| +++++++

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@ LL | fn elision(_: fn() -> &i32) {
| ^ 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
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the type lifetime-generic with a new `'a` lifetime
|
LL | fn elision(_: for<'a> fn() -> &'a i32) {
| +++++++ ~~~
help: consider using the `'static` lifetime
|
LL | fn elision(_: fn() -> &'static i32) {
| ~~~~~~~~
| +++++++

error: aborting due to previous error

Expand Down
1 change: 1 addition & 0 deletions src/test/ui/async-await/issues/issue-63388-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ trait Foo {}
impl Xyz {
async fn do_sth<'a>(
foo: &dyn Foo, bar: &'a dyn Foo
//~^ ERROR `foo` has an anonymous lifetime `'_` but it needs to satisfy a `'static`
) -> &dyn Foo //~ ERROR missing lifetime specifier
{
foo
Expand Down
34 changes: 30 additions & 4 deletions src/test/ui/async-await/issues/issue-63388-2.stderr
Original file line number Diff line number Diff line change
@@ -1,17 +1,43 @@
error[E0106]: missing lifetime specifier
--> $DIR/issue-63388-2.rs:12:10
--> $DIR/issue-63388-2.rs:13:10
|
LL | foo: &dyn Foo, bar: &'a dyn Foo
| -------- -----------
LL |
LL | ) -> &dyn Foo
| ^ 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 `foo` or `bar`
help: consider using the `'a` lifetime
|
LL | ) -> &'a dyn Foo
| ~~~
| ++

error: aborting due to previous error
error[E0759]: `foo` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
--> $DIR/issue-63388-2.rs:11:9
|
LL | foo: &dyn Foo, bar: &'a dyn Foo
| ^^^ -------- this data with an anonymous lifetime `'_`...
| |
| ...is used here...
...
LL | foo
| --- ...and is required to live as long as `'static` here
|
note: `'static` lifetime requirement introduced by the return type
--> $DIR/issue-63388-2.rs:13:10
|
LL | ) -> &dyn Foo
| ^^^^^^^^ requirement introduced by this return type
LL | {
LL | foo
| --- because of this returned expression
help: to declare that the trait object captures data from argument `foo`, you can add an explicit `'_` lifetime bound
|
LL | ) -> &dyn Foo + '_
| ++++

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0106`.
Some errors have detailed explanations: E0106, E0759.
For more information about an error, try `rustc --explain E0106`.
4 changes: 2 additions & 2 deletions src/test/ui/c-variadic/variadic-ffi-6.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ error[E0106]: missing lifetime specifier
LL | ) -> &usize {
| ^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
= 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 | ) -> &'static usize {
| ~~~~~~~~
| +++++++

error: aborting due to previous error

Expand Down
Loading