-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking Issue for #[global_registration]
#125119
Comments
@rustbot label +F-global_registration +T-lang |
…eature-gate, r=pnkfelix Add an experimental feature gate for global registration See rust-lang#125119 for the tracking issue.
Rollup merge of rust-lang#125314 - jdonszelmann:global-registration-feature-gate, r=pnkfelix Add an experimental feature gate for global registration See rust-lang#125119 for the tracking issue.
Another use case: I think Clippy could use this to register more Symbol constants like |
You did have to be careful to ensure that the crate metadata encoder doesn't consider those extra symbol constants as preinterned, otherwise rustc won't be able to decode metadata generated by clippy. Also clippy uses rustc as dylib, so for clippy to use |
A potential use case for this could be to is assign meta data to a type. In my particular use case, assigning an id / index "static" to each type. Currently Rust doesn't support generic statics due to issues on windows with dylib, but this could potentially be used instead? Would global registration allow for such use case? See relevant discussion (before and after) here: https://discord.com/channels/273534239310479360/592856094527848449/1246014749288955945 |
To elaborate a bit, as I was in that discussion: The goal here is to generate a per-type identifier that, for FFI/stability reasons, cannot be The C++ way of doing this is approximately equivalent to a The idea here, from our discussion, is to ensure that |
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
global_registration
module (implemented on forked branch)core::global_registration
#[global_registry]
defenitions have the right wrapper type (Registry<T>
)doc(alias)
(not entirely sure about my current implementation, so test that)has_codegen_attrs
, I'm not sure I did that rightsym::anon
indefinition.rs
is correctUnresolved Questions
TODO
Implementation history
TODO
Current proposed syntax
The text was updated successfully, but these errors were encountered: