Skip to content

Insufficient normalization #38298

@alexreg

Description

@alexreg

The following should work, as far as I know, but unfortunately doesn't. It seems like the type bound on Bar is getting ignored when used in Foo.

use ::std::io::Write;

pub trait Foo {
    type FooBaz: Bar;
    
    fn get_bars() -> Box<Iterator<Item = Self::FooBaz>>;
}

pub trait Bar where <Self::BarBaz as ToOwned>::Owned: Write {
    type BarBaz: ToOwned;
}

Of course, ideally I would specify the where clause on the associated type itself, but this currently isn't possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemA-type-systemArea: Type systemC-bugCategory: This is a bug.T-compilerRelevant 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.

    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