Item inner preludes
Open
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 6.6k
- Forks
- 1.7k
- Avg merge
- 16h 14m
- Merged PRs (30d)
- 1
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
useitems 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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proposed Rust examples and compare the motivation with RFC 890. Determine whether the item-level prelude behavior and its possible future extensions have enough design detail for an RFC; done means reaching a documented decision on the proposal, rather than implementing code in this repository.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100