-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-trait-systemArea: Trait systemArea: Trait systemICEBreaker-Cleanup-CrewHelping to "clean up" bugs with minimal examples and bisectionsHelping to "clean up" bugs with minimal examples and bisectionsT-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 code below doesn't compile anymore since nightly-2018-10-05:
use std::marker::PhantomData;
pub trait FooTypeHack: for<'a, 'b> FooType<'a, 'b> {}
impl<T: for<'a, 'b> FooType<'a, 'b>> FooTypeHack for T {}
pub trait FooType<'a, 'b: 'a> {
type Foo: Foo<'a, 'b>;
}
pub trait Foo<'a, 'b: 'a> {}
pub struct FooStruct<T>
where
T: FooTypeHack,
{
_t: PhantomData<T>,
}
impl<T> FooStruct<T>
where
T: FooTypeHack,
{
fn new() -> Self {
Self { _t: PhantomData }
}
}
pub struct FooTypeImpl {}
impl<'a, 'b: 'a> FooType<'a, 'b> for FooTypeImpl {
type Foo = FooImpl<'a, 'b>;
}
pub struct FooImpl<'a, 'b: 'a> {
_a: &'a PhantomData<&'b String>,
}
impl<'a, 'b> Foo<'a, 'b> for FooImpl<'a, 'b> {}
fn main() {
FooStruct::<FooTypeImpl>::new();
}
One would expect this to compile since it compiles on stable. Instead it throws:
error[E0279]: the requirement `for<'b, 'a> 'b : 'a` is not satisfied (`expected bound lifetime parameter 'a, found concrete lifetime`)
--> src/main.rs:40:5
AFAIK for<'b, 'a> 'b: 'a
can currently not be satisfied in rust therefore this should compile.
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemICEBreaker-Cleanup-CrewHelping to "clean up" bugs with minimal examples and bisectionsHelping to "clean up" bugs with minimal examples and bisectionsT-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.