Trait ref is not considered knowable due to normalization · Issue #51 · rust-lang/trait-system-refactor-initiative (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@compiler-errors

Description

@compiler-errors

This code fails in the new trait solver -Ztrait-solver=next-coherence:

use std::future::Future; use std::pin::Pin;

struct Value;

impl<'a> std::future::IntoFuture for Pin<&'a mut Value> { type Output = (); type IntoFuture = Pin<Box<dyn Future<Output = ()> + Send>>;

fn into_future(self) -> Self::IntoFuture {
    todo!()
}

}

Which overlaps with this implementation: https://doc.rust-lang.org/std/future/trait.Future.html#impl-Future-for-Pin%3CP%3E

We try to prove that <&mut Value as std::ops::Deref>::Target: std::future::Future does not hold, but that ends up being ambiguous because aliases are treated as non-local tys, even though we can definitely normalize <&mut Value as std::ops::Deref>::Target to just Value, which is a local ty.