Skip to content

Trait ref is not considered knowable due to normalization

Closed
rust-lang/rust
#114457
rust-lang/rust#114457

Description

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-coherenceHaving to do with regressions in `-Ztrait-solver=next-coherence`Having to do with regressions in `-Ztrait-solver=next-coherence`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions