-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Description
TL;DR : This allows this code with the new prelude
keyword:
mod bar {
#[derive(Default)]
pub(crate) struct Bar(pub(crate) usize);
#[derive(Default)]
pub(crate) struct Baz(pub(crate) usize);
}
struct Foo {
bar: Bar,
prelude {
use bar::*;
},
baz: Baz,
}
impl Foo {
fn new() -> Self {
Foo {
bar: Default::default(),
baz: Default::default(),
}
}
fn into_baz(self) -> Baz {
self.baz
}
prelude {
use bar::*;
}
}
Although the similar names, the motivation is quite different from RFC 890, in that this tries to address these issues:
- Allowing
use
items in more cases, bringing more ergonomics
Possible Future extensions:
- Allowing nested ADT definitions, in a way not affecting the typesystem.
- Generalize this to the mod levels, to actually cover the original custom prelude use case
PatchMixolydic, konsumlamm, Noratrieb and michael-0acf4
Metadata
Metadata
Assignees
Labels
No labels