Closed
Description
I tried such code:
use std::iter::{Enumerate};
use std::vec;
pub struct IntoIter<V> {
iter: Enumerate<vec::IntoIter<Option<V>>>,
}
fn into_iter_covariant<'a, T>(iter: IntoIter<&'static T>) -> IntoIter<&'a T> { iter }
fn main() {
}
rustup run beta rustc test_code.rs give error:
error[E0308]: mismatched types
--> test_code.rs:9:80
|
9 | fn into_iter_covariant<'a, T>(iter: IntoIter<&'static T>) -> IntoIter<&'a T> { iter }
| ^^^^ lifetime mismatch
|
= note: expected type `IntoIter<&'a T>`
= note: found type `IntoIter<&'static T>`
note: the lifetime 'a as defined on the block at 9:77...
--> test_code.rs:9:78
|
9 | fn into_iter_covariant<'a, T>(iter: IntoIter<&'static T>) -> IntoIter<&'a T> { iter }
| ^^^^^^^^
= note: ...does not necessarily outlive the static lifetime
error: aborting due to previous error
$ rustup run beta rustc --version
rustc 1.12.0-beta.1 (822166b84 2016-08-16)
But stable and nightly version of compiler compile such code just fine:
$ rustup run nightly rustc --version
rustc 1.13.0-nightly (499484f56 2016-08-18)
$ rustup run stable rustc --version
rustc 1.11.0 (9b21dcd6a 2016-08-15)
This bug prevent to compile vec_map crate (from which I extract rust code above),
and racer depend on vec_map, so I can not compile racer project also.
Metadata
Metadata
Assignees
Labels
No labels