Skip to content

Document when associated types may be omitted from dyn Trait type #1933

@traviscross

Description

@traviscross

We accept this,

pub trait Tr {
    type Ty;
}
fn f(_: &dyn Tr<Ty = ()>) {}

and we accept this (as of rust-lang/rust#112319),

pub trait Tr {
    type Ty where Self: Sized;
}
fn f(_: &dyn Tr) {}

but we of course don't accept this:

pub trait Tr {
    type Ty;
}
fn f(_: &dyn Tr) {} //~ ERROR

The Reference should speak to this in our chapter on trait object types, but is silent on this matter.

cc @ehuss #1932 rust-lang/rust#127251

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions