-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve diagnostics when a static lifetime is expected
- Loading branch information
Showing
12 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 3 additions & 1 deletion
4
src/test/ui/issues/issue-46983.stderr → ...issue-46983-expected-return-static.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use std::cell::RefCell; | ||
use std::io::Read; | ||
|
||
fn main() {} | ||
|
||
fn inner(mut foo: &[u8]) { | ||
let refcell = RefCell::new(&mut foo); | ||
let read = &refcell as &RefCell<dyn Read>; | ||
|
||
read_thing(read); | ||
//~^ ERROR explicit lifetime required in the type of `foo` [E0621] | ||
} | ||
|
||
fn read_thing(refcell: &RefCell<dyn Read>) {} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/lifetimes/issue-90600-expected-return-static-indirect.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0621]: explicit lifetime required in the type of `foo` | ||
--> $DIR/issue-90600-expected-return-static-indirect.rs:10:16 | ||
| | ||
LL | fn inner(mut foo: &[u8]) { | ||
| ----- the type of `foo` does not have lifetime `'static'` | ||
... | ||
LL | read_thing(read); | ||
| ^^^^ lifetime `'static` required | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0621`. |
2 changes: 2 additions & 0 deletions
2
src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters