the.bay.news

Sealed pub traits and strange restrictions on associated types

The Rust Programming Language Forum
Sealed pub traits and strange restrictions on associated types
mod sealed { // As expected, making this private will cause T::SealAssoc to not work, even in impl Ans pub trait Sealed { type SealAssoc; } pub trait Res: Sealed {} } use sealed::Res; pub trait Ans { //type Dep; fn bleh(dep: Self::Dep); type Dep: Res; fn bleh(dep: Self::Dep::SealAssoc); } impl<T: Res> Ans for T { //type Dep = T::SealAssoc; fn bleh(_: Self::Dep) {} type Dep = T; fn bleh(_: Self::Dep::SealAssoc) {} } (Playground) I see that now, one s...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.