-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
The following code compiles with Rust version 1.20, but not with 1.21 and above:
pub trait StreamingIterator<'a>: 'a {
type Item: 'a;
fn next(&'a mut self) -> Option<Self::Item>;
}
pub trait StreamingIteratorExt: for<'a> StreamingIterator<'a> {}
impl<I> StreamingIteratorExt for I where
I: for<'a>StreamingIterator<'a>
{}
Error in Rust 1.21+:
error[E0310]: the parameter type `I` may not live long enough
--> src/lib.rs:14:9
|
14 | impl<I> StreamingIteratorExt for I where
| - ^^^^^^^^^^^^^^^^^^^^
| |
| help: consider adding an explicit lifetime bound `I: 'static`...
|
note: ...so that the type `I` will meet its required lifetime bounds
--> src/lib.rs:14:9
|
14 | impl<I> StreamingIteratorExt for I where
| ^^^^^^^^^^^^^^^^^^^^
Note the Self: 'a
bound on StreamingIterator
. If I remove it, the error goes away.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.