Skip to content

Normalizes-to terms equal modulo normalization #86

Closed
@compiler-errors

Description

@compiler-errors
Member
trait Bar {
    type Item;
    type Assoc: AsRef<[Self::Item]>;
}

struct Foo<T: Bar> {
    t: <T as Bar>::Assoc,
}

impl<T: Bar<Item = u32>> Foo<T>
where
    <T as Bar>::Assoc: AsRef<[u32]>,
{
    fn hello(&self) {
        println!("{}", self.t.as_ref().len());
    }
}

fn main() {}

Since <T as Bar>::Assoc can project to [u32] or <[T as Bar::Item]> (which is [u32]).

I found this in rand-core 0.5.x.

This is not present in the most recent rand-core version afaict, but many crates use rand-core 0.5.x as a dep.

Activity

compiler-errors

compiler-errors commented on Jan 29, 2024

@compiler-errors
MemberAuthor

Related #4

Related #84 (the supertrait version of this)

lcnr

lcnr commented on Mar 14, 2024

@lcnr
Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @compiler-errors@lcnr

        Issue actions

          Normalizes-to terms equal modulo normalization · Issue #86 · rust-lang/trait-system-refactor-initiative