Skip to content

Object safety "method references the Self type" check does not normalize. #44092

Open

Description

Example (using an associated type that matches a blanket impl):

trait Foo {
    type X;
}

impl<T: ?Sized> Foo for T {
    type X = ();
}

trait Bar {
    // Note how this is allowed without a bound.
    fn foo(&self) -> <Self as Foo>::X;
}

// error: the trait `Bar` cannot be made into an object
fn foo(_: Box<dyn Bar>) {}

fn main() {}
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-trait-objectsArea: trait objects, vtable layoutArea: trait objects, vtable layoutA-typesystemArea: The type systemArea: The type systemC-bugCategory: This is a bug.Category: This is a bug.T-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.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions