-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check lifetimes for some pointer casts
Specifically check them for trait objects, i.e. `*const Trait + 'a` -> `*const Trait + b`, etc.
- Loading branch information
1 parent
f3de343
commit 3c3cf17
Showing
5 changed files
with
49 additions
and
18 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error: lifetime may not live long enough | ||
--> $DIR/ptr-to-trait-obj-different-regions.rs:12:5 | ||
| | ||
LL | fn bad_cast<'a>(x: *const dyn Static<'static>) -> *const dyn Static<'a> { | ||
| -- lifetime `'a` defined here | ||
LL | x as _ | ||
| ^^^^^^ returning this value requires that `'a` must outlive `'static` | ||
|
||
error: aborting due to 1 previous error | ||
|