-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Disable some nice region errors in NLL mode. #53115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,17 +4,16 @@ warning: not reporting region error due to nll | |
| LL | if x > y { x } else { y } //~ ERROR lifetime mismatch | ||
| | ^ | ||
|
|
||
| error[E0623]: lifetime mismatch | ||
| error: unsatisfied lifetime constraints | ||
| --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:21:12 | ||
| | | ||
| LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | ||
| | ---- ------- | ||
| | | | ||
| | this parameter and the return type are declared with different lifetimes... | ||
| | -- - let's call the lifetime of this reference `'1` | ||
| | | | ||
| | lifetime `'a` defined here | ||
| LL | | ||
| LL | if x > y { x } else { y } //~ ERROR lifetime mismatch | ||
| | ^^^^^ ...but data from `x` is returned here | ||
| | ^^^^^ requires that `'1` must outlive `'a` | ||
|
||
|
|
||
| error: aborting due to previous error | ||
|
|
||
| For more information about this error, try `rustc --explain E0623`. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,17 +4,16 @@ warning: not reporting region error due to nll | |
| LL | x //~ ERROR lifetime mismatch | ||
| | ^ | ||
|
|
||
| error[E0623]: lifetime mismatch | ||
| error: unsatisfied lifetime constraints | ||
| --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:18:5 | ||
| | | ||
| LL | fn foo<'a>(&self, x: &'a i32) -> &i32 { | ||
| | ------- ---- | ||
| | | | ||
| | this parameter and the return type are declared with different lifetimes... | ||
| | -- - let's call the lifetime of this reference `'1` | ||
| | | | ||
| | lifetime `'a` defined here | ||
| LL | | ||
| LL | x //~ ERROR lifetime mismatch | ||
| | ^ ...but data from `x` is returned here | ||
| | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` | ||
|
||
|
|
||
| error: aborting due to previous error | ||
|
|
||
| For more information about this error, try `rustc --explain E0623`. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems strictly better