Remove interner_name argument from define_label! and make the interner private.#24445
Conversation
ChristopherBiscardi
left a comment
There was a problem hiding this comment.
This moves the static from the top level to the interior of the intern function, which I believe is fine since statics are only initialized at compile time.
The old static is technically visible inside the module, so someone could be accessing it and it might warrant a migration guide?
That’s right. This is a common Rust pattern, though more often for statics that need lazy initialization.
More importantly, users of the macro need to change the way they call it! I have added a migration guide. |
|
Merging #24444; ping me once the conflicts from that are resolved. |
…e#24444) # Objective Fixes <bevyengine#22834>. ## Solution - Add more explanation of what `define_label!` does - Add example implementations - Change the existing `extra_methods_impl` example to forward the call This PR will conflict with bevyengine#24445. I will rebase whichever one doesn’t get merged first. ## Testing - Ran doctests - Reviewed rendered documentation
…erner private. The only operation the interner has is interning, so the `intern()` trait method is all the access that is ever needed. Also added support for trailing commas.
|
@alice-i-cecile Rebased. |
Objective
Simplify the use of
define_label!().Solution
staticinterner inside theintern()method, so that it is not visible anywhere else and does not need to have a non-conflicting name. The only operation the interner has is interning, so theintern()trait method is all the access that is ever needed.This PR will conflict with #24444. I will rebase whichever one doesn’t get merged first.
Testing
cargo run -p ci -- --keep-going test. There were some failures that I believe are existing/spurious.