-
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.
Don't require lifetime super-bounds on traits apply to trait objects …
…of that trait
- Loading branch information
1 parent
e674cf0
commit e42c979
Showing
2 changed files
with
33 additions
and
14 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
16 changes: 16 additions & 0 deletions
16
src/test/ui/traits/trait-object-supertrait-lifetime-bound.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,16 @@ | ||
// check-pass | ||
|
||
use std::any::Any; | ||
|
||
trait A<T>: Any { | ||
fn m(&self) {} | ||
} | ||
|
||
impl<S, T: 'static> A<S> for T {} | ||
|
||
fn call_obj<'a>() { | ||
let obj: &dyn A<&'a ()> = &(); | ||
obj.m(); | ||
} | ||
|
||
fn main() {} |