mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Fix stable iteration ordering for Map<Name, ...>
usages
This commit is contained in:
parent
f2d51073d2
commit
cde0f69cae
11 changed files with 55 additions and 29 deletions
|
@ -37,6 +37,7 @@ const _: () =
|
|||
/// A pointer that points to a pointer to a `str`, it may be backed as a `&'static &'static str` or
|
||||
/// `Arc<Box<str>>` but its size is that of a thin pointer. The active variant is encoded as a tag
|
||||
/// in the LSB of the alignment niche.
|
||||
// Note, Ideally this would encode a `ThinArc<str>` and `ThinRef<str>`/`ThinConstPtr<str>` instead of the double indirection.
|
||||
#[derive(PartialEq, Eq, Hash, Copy, Clone, Debug)]
|
||||
struct TaggedArcPtr {
|
||||
packed: NonNull<*const str>,
|
||||
|
|
|
@ -13,6 +13,10 @@ use crate::{
|
|||
|
||||
macro_rules! define_symbols {
|
||||
(@WITH_NAME: $($alias:ident = $value:literal),* $(,)? @PLAIN: $($name:ident),* $(,)?) => {
|
||||
// Ideally we would be emitting `const` here, but then we no longer have stable addresses
|
||||
// which is what we are relying on for equality! In the future if consts can refer to
|
||||
// statics we should swap these for `const`s and have the the string literal being pointed
|
||||
// to be statics to refer to such that their address is stable.
|
||||
$(
|
||||
pub static $name: Symbol = Symbol { repr: TaggedArcPtr::non_arc(&stringify!($name)) };
|
||||
)*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue