-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Marker traits cause inference error when used with associated types and lifetimes #133957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Minimized even further: #![feature(marker_trait_attr)]
#[marker] trait Trait<U> {}
impl<T, U> Trait<U> for T {}
impl<T, U> Trait<U> for T {}
fn check<T, U>(_: T, _: U) where T: Trait<U> {}
fn f() {
check((), &());
} |
Why do you have duplicate |
Just minimization. In the real code there is overlap but they're not identical. It's #[marker] trait CanSafetyCast<To> {}
impl<From: Function, To: Function<Safety = Unsafe>> CanSafetyCast<To> for From {}
impl<From: Function<Safety = Safe>, To: Function> CanSafetyCast<To> for From {} |
Okay, the generic and the inferred type aren't even required: #![feature(marker_trait_attr)]
#[marker] trait Trait {}
impl<T> Trait for T {}
impl<T> Trait for T {}
fn check<T: Trait>() {}
fn f() {
check::<&'static ()>();
} |
Duplicate of #89515. |
I tried this code:
This should compile normally, as it does if
&'static u8
is replaced with, say,u8
, but instead I get:Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: