Tracking Issue for `#[global_registration]`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
This is a tracking issue for the global registration experiment.
The feature gate for the issue is #![feature(global_registration)].
Global registration has previously been discussed on internals.rust-lang.org and a proposal was made on the testing devex team with @epage . Specific syntax has not been discussed yet, which is part of what this experiment is going to figure out. Likely, a first implementation will use built-in attribute macros.
About tracking issues
Tracking issues are used to record the overall progress of implementation. They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature. Instead, open a dedicated issue for the specific matter and add the relevant feature gate label. Discussion comments will get marked as off-topic or deleted. Repeated discussions on the tracking issue may lead to the tracking issue getting locked.
Steps
- Get lang experiment approved. (@scottmcm is liaisoning me)
- Land the experimental implementation in nightly.
- Experimental feature flag: #125314 (now available on nightly)
- Update core/std with a new
global_registrationmodule (implemented on forked branch) - Add new built-in macros to rust to create and add to global registries (implemented on forked branch)
- Propagate global registries through the AST and HIR, also performing name resolution (implemented on forked branch)
- Write docs for
core::global_registration - Check whether
#[global_registry]defenitions have the right wrapper type (Registry<T>) - Actually create nice errors instead of panicking in unexpected cases
- tests for
- errors generated
-
doc(alias)(not entirely sure about my current implementation, so test that) - the right
has_codegen_attrs, I'm not sure I did that right - privacy of global registries
- Add global registries to RustDoc
- Check if my
sym::anonindefinition.rsis correct
- Accept an RFC
- Adjust documentation (see instructions on rustc-dev-guide)
- Formatting for new syntax has been added to the Style Guide (nightly-style-procedure)
- Stabilization PR (see instructions on rustc-dev-guide)
Unresolved Questions
TODO
Implementation history
TODO
Current proposed syntax
use core::global_registration::{global_registry, register, Registry};
#[global_registry]
static ERROR_MSGS: Registry<&str>;
register!(ERROR_MSGS, "a");
register!(ERROR_MSGS, "b", "c");
fn main() {
for msg in ERROR_MSGS {
println!("{}", msg);
}
}
Contributor guide
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 tracking checklist and the linked internals and testing-devex discussions; the issue does not identify a single file or test entry point. A contribution would need to take one explicitly listed task, such as documentation for core::global_registration or tests for generated errors, and define completion against that checklist.
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
- Needs clarification
- Newbie friendliness
- 25/100