-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle trait objects formed from traits with
Self::Foo: 'a
clauses
- Loading branch information
1 parent
0d744ec
commit 6575988
Showing
2 changed files
with
33 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Regression test for #54467: | ||
// | ||
// Here, the trait object has an "inferred outlives" requirement that | ||
// `<Self as MyIterator<'a>>::Item: 'a`; but since we don't know what | ||
// `Self` is, we were (incorrectly) messing things up, leading to | ||
// strange errors. This test ensures that we do not give compilation | ||
// errors. | ||
// | ||
// compile-pass | ||
|
||
trait MyIterator<'a>: Iterator where Self::Item: 'a { } | ||
|
||
struct MyStruct<'a, A> { | ||
item: Box<dyn MyIterator<'a, Item = A>> | ||
} | ||
|
||
fn main() { } |