Skip to content

E0269 (not all control paths return a value) misfiring on an () associated type. #31597

Closed
@eddyb

Description

@eddyb

Try on playpen:

trait Make {
    type Out;

    fn make() -> Self::Out;
}

impl Make for () {
    type Out = ();

    fn make() -> Self::Out {}
}

This looks like missing normalization when checking for the return type.
fn make() -> Self::Out { () } and fn make() -> Self::Out { return; } work just fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions