Skip to content

Normalizes-to terms equal modulo normalization #86

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
compiler-errors opened this issue Jan 29, 2024 · 2 comments
Closed

Normalizes-to terms equal modulo normalization #86

compiler-errors opened this issue Jan 29, 2024 · 2 comments

Comments

@compiler-errors
Copy link
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.

@compiler-errors
Copy link
Member Author

compiler-errors commented Jan 29, 2024

Related #4

Related #84 (the supertrait version of this)

@lcnr
Copy link
Contributor

lcnr commented Mar 14, 2024

fixed by rust-lang/rust#119106

@lcnr lcnr closed this as completed Mar 14, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants