Skip to content

TAIT fails where RPIT works #101903

@oli-obk

Description

@oli-obk

I tried this code:

trait Duh {} impl Duh for i32 {} trait Trait { type Assoc: Duh; } impl<R: Duh, F: FnMut() -> R> Trait for F { type Assoc = R; } type Sendable = impl Send; type Foo = impl Trait<Assoc = Sendable>; fn foo() -> Foo { || 42 }

I expected to see this happen: it compiles, just like

trait Duh {} impl Duh for i32 {} trait Trait { type Assoc: Duh; } impl<R: Duh, F: FnMut() -> R> Trait for F { type Assoc = R; } type Sendable = impl Send; fn foo() -> impl Trait<Assoc = Sendable> { || 42 }

Instead, this happened:

error[[E0277]](https://doc.rust-lang.org/nightly/error-index.html#E0277): the trait bound `Sendable: Duh` is not satisfied --> src/lib.rs:19:5 | 19 | || 42 | ^^^^^ the trait `Duh` is not implemented for `Sendable` | = help: the trait `Duh` is implemented for `i32` note: required for `[closure@src/lib.rs:19:5: 19:7]` to implement `Trait` --> src/lib.rs:10:31 | 10 | impl<R: Duh, F: FnMut() -> R> Trait for F { | ^^^^^ ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions