Use symbol in cfg

This commit is contained in:
Lukas Wirth 2024-07-16 10:36:59 +02:00
parent 93024ad411
commit c30bdfcc84
22 changed files with 147 additions and 92 deletions

View file

@ -139,11 +139,17 @@ impl TaggedArcPtr {
}
}
#[derive(PartialEq, Eq, Hash, Debug)]
#[derive(PartialEq, Eq, Hash)]
pub struct Symbol {
repr: TaggedArcPtr,
}
impl fmt::Debug for Symbol {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.as_str().fmt(f)
}
}
const _: () = assert!(std::mem::size_of::<Symbol>() == std::mem::size_of::<NonNull<()>>());
const _: () = assert!(std::mem::align_of::<Symbol>() == std::mem::align_of::<NonNull<()>>());

View file

@ -93,20 +93,20 @@ define_symbols! {
__ra_fixup,
add_assign,
add,
attributes,
align_offset,
align,
all,
alloc_layout,
alloc,
any,
as_str,
asm,
assert,
attributes,
begin_panic,
bench,
bitand_assign,
bitand,
notable_trait,
hidden,
local_inner_macros,
bitor_assign,
bitor,
bitxor_assign,
@ -118,6 +118,7 @@ define_symbols! {
branch,
Break,
c_void,
C,
call_mut,
call_once,
call,
@ -146,8 +147,10 @@ define_symbols! {
core,
coroutine_state,
coroutine,
count,
crate_type,
CStr,
debug_assertions,
Debug,
default,
Default,
@ -172,6 +175,7 @@ define_symbols! {
Eq,
Err,
exchange_malloc,
exhaustive_patterns,
f128,
f16,
f32,
@ -208,11 +212,13 @@ define_symbols! {
global_asm,
gt,
Hash,
hidden,
i128,
i16,
i32,
i64,
i8,
ignore,
Implied,
include_bytes,
include_str,
@ -237,14 +243,15 @@ define_symbols! {
len,
line,
llvm_asm,
local_inner_macros,
log_syntax,
lt,
macro_rules,
ignore,
count,
manually_drop,
maybe_uninit,
metadata_type,
min_exhaustive_patterns,
miri,
missing,
module_path,
mul_assign,
@ -271,6 +278,7 @@ define_symbols! {
None,
not,
Not,
notable_trait,
Ok,
opaque,
ops,
@ -280,6 +288,7 @@ define_symbols! {
Ord,
Output,
owned_box,
packed,
panic_2015,
panic_2021,
panic_bounds_check,
@ -328,6 +337,7 @@ define_symbols! {
rust_2018,
rust_2021,
rust_2024,
rust_analyzer,
rustc_coherence_is_core,
rustc_macro_transparency,
semitransparent,
@ -335,6 +345,7 @@ define_symbols! {
shl,
shr_assign,
shr,
simd,
sized,
slice_len_fn,
Some,
@ -367,10 +378,6 @@ define_symbols! {
u8,
Unknown,
unpin,
simd,
C,
align,
packed,
unreachable_2015,
unreachable_2021,
unreachable,
@ -378,7 +385,5 @@ define_symbols! {
unsize,
usize,
v1,
exhaustive_patterns,
min_exhaustive_patterns,
va_list
}