Use tidy to sort sym::* items
This commit is contained in:
@@ -190,17 +190,6 @@ fn symbols_with_errors(input: TokenStream) -> (TokenStream, Vec<syn::Error>) {
|
|||||||
let mut symbols_stream = quote! {};
|
let mut symbols_stream = quote! {};
|
||||||
let mut prefill_stream = quote! {};
|
let mut prefill_stream = quote! {};
|
||||||
let mut entries = Entries::with_capacity(input.keywords.len() + input.symbols.len() + 10);
|
let mut entries = Entries::with_capacity(input.keywords.len() + input.symbols.len() + 10);
|
||||||
let mut prev_key: Option<(Span, String)> = None;
|
|
||||||
|
|
||||||
let mut check_order = |span: Span, s: &str, errors: &mut Errors| {
|
|
||||||
if let Some((prev_span, ref prev_str)) = prev_key {
|
|
||||||
if s < prev_str {
|
|
||||||
errors.error(span, format!("Symbol `{s}` must precede `{prev_str}`"));
|
|
||||||
errors.error(prev_span, format!("location of previous symbol `{prev_str}`"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
prev_key = Some((span, s.to_string()));
|
|
||||||
};
|
|
||||||
|
|
||||||
// Generate the listed keywords.
|
// Generate the listed keywords.
|
||||||
for keyword in input.keywords.iter() {
|
for keyword in input.keywords.iter() {
|
||||||
@@ -219,7 +208,6 @@ fn symbols_with_errors(input: TokenStream) -> (TokenStream, Vec<syn::Error>) {
|
|||||||
// Generate the listed symbols.
|
// Generate the listed symbols.
|
||||||
for symbol in input.symbols.iter() {
|
for symbol in input.symbols.iter() {
|
||||||
let name = &symbol.name;
|
let name = &symbol.name;
|
||||||
check_order(symbol.name.span(), &name.to_string(), &mut errors);
|
|
||||||
|
|
||||||
let value = match &symbol.value {
|
let value = match &symbol.value {
|
||||||
Value::SameAsName => name.to_string(),
|
Value::SameAsName => name.to_string(),
|
||||||
|
|||||||
@@ -84,18 +84,3 @@ fn check_dup_symbol_and_keyword() {
|
|||||||
};
|
};
|
||||||
test_symbols_macro(input, &["Symbol `splat` is duplicated", "location of previous definition"]);
|
test_symbols_macro(input, &["Symbol `splat` is duplicated", "location of previous definition"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn check_symbol_order() {
|
|
||||||
let input = quote! {
|
|
||||||
Keywords {}
|
|
||||||
Symbols {
|
|
||||||
zebra,
|
|
||||||
aardvark,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
test_symbols_macro(
|
|
||||||
input,
|
|
||||||
&["Symbol `aardvark` must precede `zebra`", "location of previous symbol `zebra`"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -150,14 +150,10 @@ symbols! {
|
|||||||
// As well as the symbols listed, there are symbols for the strings
|
// As well as the symbols listed, there are symbols for the strings
|
||||||
// "0", "1", ..., "9", which are accessible via `sym::integer`.
|
// "0", "1", ..., "9", which are accessible via `sym::integer`.
|
||||||
//
|
//
|
||||||
// The proc macro will abort if symbols are not in alphabetical order (as
|
|
||||||
// defined by `impl Ord for str`) or if any symbols are duplicated. Vim
|
|
||||||
// users can sort the list by selecting it and executing the command
|
|
||||||
// `:'<,'>!LC_ALL=C sort`.
|
|
||||||
//
|
|
||||||
// There is currently no checking that all symbols are used; that would be
|
// There is currently no checking that all symbols are used; that would be
|
||||||
// nice to have.
|
// nice to have.
|
||||||
Symbols {
|
Symbols {
|
||||||
|
// tidy-alphabetical-start
|
||||||
Abi,
|
Abi,
|
||||||
AcqRel,
|
AcqRel,
|
||||||
Acquire,
|
Acquire,
|
||||||
@@ -175,18 +171,18 @@ symbols! {
|
|||||||
AsyncGenPending,
|
AsyncGenPending,
|
||||||
AsyncGenReady,
|
AsyncGenReady,
|
||||||
AtomicBool,
|
AtomicBool,
|
||||||
AtomicI128,
|
AtomicI8,
|
||||||
AtomicI16,
|
AtomicI16,
|
||||||
AtomicI32,
|
AtomicI32,
|
||||||
AtomicI64,
|
AtomicI64,
|
||||||
AtomicI8,
|
AtomicI128,
|
||||||
AtomicIsize,
|
AtomicIsize,
|
||||||
AtomicPtr,
|
AtomicPtr,
|
||||||
AtomicU128,
|
AtomicU8,
|
||||||
AtomicU16,
|
AtomicU16,
|
||||||
AtomicU32,
|
AtomicU32,
|
||||||
AtomicU64,
|
AtomicU64,
|
||||||
AtomicU8,
|
AtomicU128,
|
||||||
AtomicUsize,
|
AtomicUsize,
|
||||||
BTreeEntry,
|
BTreeEntry,
|
||||||
BTreeMap,
|
BTreeMap,
|
||||||
@@ -607,10 +603,10 @@ symbols! {
|
|||||||
catch_unwind,
|
catch_unwind,
|
||||||
cause,
|
cause,
|
||||||
cdylib,
|
cdylib,
|
||||||
ceilf128,
|
|
||||||
ceilf16,
|
ceilf16,
|
||||||
ceilf32,
|
ceilf32,
|
||||||
ceilf64,
|
ceilf64,
|
||||||
|
ceilf128,
|
||||||
cfg,
|
cfg,
|
||||||
cfg_accessible,
|
cfg_accessible,
|
||||||
cfg_attr,
|
cfg_attr,
|
||||||
@@ -747,10 +743,10 @@ symbols! {
|
|||||||
copy,
|
copy,
|
||||||
copy_closures,
|
copy_closures,
|
||||||
copy_nonoverlapping,
|
copy_nonoverlapping,
|
||||||
copysignf128,
|
|
||||||
copysignf16,
|
copysignf16,
|
||||||
copysignf32,
|
copysignf32,
|
||||||
copysignf64,
|
copysignf64,
|
||||||
|
copysignf128,
|
||||||
core,
|
core,
|
||||||
core_panic,
|
core_panic,
|
||||||
core_panic_2015_macro,
|
core_panic_2015_macro,
|
||||||
@@ -763,10 +759,10 @@ symbols! {
|
|||||||
coroutine_state,
|
coroutine_state,
|
||||||
coroutine_yield,
|
coroutine_yield,
|
||||||
coroutines,
|
coroutines,
|
||||||
cosf128,
|
|
||||||
cosf16,
|
cosf16,
|
||||||
cosf32,
|
cosf32,
|
||||||
cosf64,
|
cosf64,
|
||||||
|
cosf128,
|
||||||
count,
|
count,
|
||||||
coverage,
|
coverage,
|
||||||
coverage_attribute,
|
coverage_attribute,
|
||||||
@@ -874,8 +870,8 @@ symbols! {
|
|||||||
dotdot_in_tuple_patterns,
|
dotdot_in_tuple_patterns,
|
||||||
dotdoteq_in_patterns,
|
dotdoteq_in_patterns,
|
||||||
dreg,
|
dreg,
|
||||||
dreg_low16,
|
|
||||||
dreg_low8,
|
dreg_low8,
|
||||||
|
dreg_low16,
|
||||||
drop,
|
drop,
|
||||||
drop_in_place,
|
drop_in_place,
|
||||||
drop_types_in_const,
|
drop_types_in_const,
|
||||||
@@ -928,16 +924,16 @@ symbols! {
|
|||||||
exhaustive_integer_patterns,
|
exhaustive_integer_patterns,
|
||||||
exhaustive_patterns,
|
exhaustive_patterns,
|
||||||
existential_type,
|
existential_type,
|
||||||
exp2f128,
|
|
||||||
exp2f16,
|
exp2f16,
|
||||||
exp2f32,
|
exp2f32,
|
||||||
exp2f64,
|
exp2f64,
|
||||||
|
exp2f128,
|
||||||
expect,
|
expect,
|
||||||
expected,
|
expected,
|
||||||
expf128,
|
|
||||||
expf16,
|
expf16,
|
||||||
expf32,
|
expf32,
|
||||||
expf64,
|
expf64,
|
||||||
|
expf128,
|
||||||
explicit_extern_abis,
|
explicit_extern_abis,
|
||||||
explicit_generic_args_with_impl_trait,
|
explicit_generic_args_with_impl_trait,
|
||||||
explicit_tail_calls,
|
explicit_tail_calls,
|
||||||
@@ -958,9 +954,6 @@ symbols! {
|
|||||||
external,
|
external,
|
||||||
external_doc,
|
external_doc,
|
||||||
f,
|
f,
|
||||||
f128,
|
|
||||||
f128_epsilon,
|
|
||||||
f128_nan,
|
|
||||||
f16,
|
f16,
|
||||||
f16_epsilon,
|
f16_epsilon,
|
||||||
f16_nan,
|
f16_nan,
|
||||||
@@ -999,10 +992,13 @@ symbols! {
|
|||||||
f64_legacy_const_neg_infinity,
|
f64_legacy_const_neg_infinity,
|
||||||
f64_legacy_const_radix,
|
f64_legacy_const_radix,
|
||||||
f64_nan,
|
f64_nan,
|
||||||
fabsf128,
|
f128,
|
||||||
|
f128_epsilon,
|
||||||
|
f128_nan,
|
||||||
fabsf16,
|
fabsf16,
|
||||||
fabsf32,
|
fabsf32,
|
||||||
fabsf64,
|
fabsf64,
|
||||||
|
fabsf128,
|
||||||
fadd_algebraic,
|
fadd_algebraic,
|
||||||
fadd_fast,
|
fadd_fast,
|
||||||
fake_variadic,
|
fake_variadic,
|
||||||
@@ -1024,22 +1020,22 @@ symbols! {
|
|||||||
flags,
|
flags,
|
||||||
float,
|
float,
|
||||||
float_to_int_unchecked,
|
float_to_int_unchecked,
|
||||||
floorf128,
|
|
||||||
floorf16,
|
floorf16,
|
||||||
floorf32,
|
floorf32,
|
||||||
floorf64,
|
floorf64,
|
||||||
fmaf128,
|
floorf128,
|
||||||
fmaf16,
|
fmaf16,
|
||||||
fmaf32,
|
fmaf32,
|
||||||
fmaf64,
|
fmaf64,
|
||||||
|
fmaf128,
|
||||||
fmt,
|
fmt,
|
||||||
fmt_debug,
|
fmt_debug,
|
||||||
fmul_algebraic,
|
fmul_algebraic,
|
||||||
fmul_fast,
|
fmul_fast,
|
||||||
fmuladdf128,
|
|
||||||
fmuladdf16,
|
fmuladdf16,
|
||||||
fmuladdf32,
|
fmuladdf32,
|
||||||
fmuladdf64,
|
fmuladdf64,
|
||||||
|
fmuladdf128,
|
||||||
fn_align,
|
fn_align,
|
||||||
fn_body,
|
fn_body,
|
||||||
fn_delegation,
|
fn_delegation,
|
||||||
@@ -1140,13 +1136,12 @@ symbols! {
|
|||||||
html_root_url,
|
html_root_url,
|
||||||
hwaddress,
|
hwaddress,
|
||||||
i,
|
i,
|
||||||
i128,
|
i8,
|
||||||
i128_legacy_const_max,
|
i8_legacy_const_max,
|
||||||
i128_legacy_const_min,
|
i8_legacy_const_min,
|
||||||
i128_legacy_fn_max_value,
|
i8_legacy_fn_max_value,
|
||||||
i128_legacy_fn_min_value,
|
i8_legacy_fn_min_value,
|
||||||
i128_legacy_mod,
|
i8_legacy_mod,
|
||||||
i128_type,
|
|
||||||
i16,
|
i16,
|
||||||
i16_legacy_const_max,
|
i16_legacy_const_max,
|
||||||
i16_legacy_const_min,
|
i16_legacy_const_min,
|
||||||
@@ -1165,12 +1160,13 @@ symbols! {
|
|||||||
i64_legacy_fn_max_value,
|
i64_legacy_fn_max_value,
|
||||||
i64_legacy_fn_min_value,
|
i64_legacy_fn_min_value,
|
||||||
i64_legacy_mod,
|
i64_legacy_mod,
|
||||||
i8,
|
i128,
|
||||||
i8_legacy_const_max,
|
i128_legacy_const_max,
|
||||||
i8_legacy_const_min,
|
i128_legacy_const_min,
|
||||||
i8_legacy_fn_max_value,
|
i128_legacy_fn_max_value,
|
||||||
i8_legacy_fn_min_value,
|
i128_legacy_fn_min_value,
|
||||||
i8_legacy_mod,
|
i128_legacy_mod,
|
||||||
|
i128_type,
|
||||||
ident,
|
ident,
|
||||||
if_let,
|
if_let,
|
||||||
if_let_guard,
|
if_let_guard,
|
||||||
@@ -1292,19 +1288,19 @@ symbols! {
|
|||||||
loaded_from_disk,
|
loaded_from_disk,
|
||||||
local,
|
local,
|
||||||
local_inner_macros,
|
local_inner_macros,
|
||||||
log10f128,
|
|
||||||
log10f16,
|
|
||||||
log10f32,
|
|
||||||
log10f64,
|
|
||||||
log2f128,
|
|
||||||
log2f16,
|
log2f16,
|
||||||
log2f32,
|
log2f32,
|
||||||
log2f64,
|
log2f64,
|
||||||
|
log2f128,
|
||||||
|
log10f16,
|
||||||
|
log10f32,
|
||||||
|
log10f64,
|
||||||
|
log10f128,
|
||||||
log_syntax,
|
log_syntax,
|
||||||
logf128,
|
|
||||||
logf16,
|
logf16,
|
||||||
logf32,
|
logf32,
|
||||||
logf64,
|
logf64,
|
||||||
|
logf128,
|
||||||
loongarch_target_feature,
|
loongarch_target_feature,
|
||||||
loop_break_value,
|
loop_break_value,
|
||||||
loop_match,
|
loop_match,
|
||||||
@@ -1334,14 +1330,14 @@ symbols! {
|
|||||||
match_beginning_vert,
|
match_beginning_vert,
|
||||||
match_default_bindings,
|
match_default_bindings,
|
||||||
matches_macro,
|
matches_macro,
|
||||||
maximumf128,
|
|
||||||
maximumf16,
|
maximumf16,
|
||||||
maximumf32,
|
maximumf32,
|
||||||
maximumf64,
|
maximumf64,
|
||||||
maxnumf128,
|
maximumf128,
|
||||||
maxnumf16,
|
maxnumf16,
|
||||||
maxnumf32,
|
maxnumf32,
|
||||||
maxnumf64,
|
maxnumf64,
|
||||||
|
maxnumf128,
|
||||||
may_dangle,
|
may_dangle,
|
||||||
may_unwind,
|
may_unwind,
|
||||||
maybe_uninit,
|
maybe_uninit,
|
||||||
@@ -1372,14 +1368,14 @@ symbols! {
|
|||||||
min_generic_const_args,
|
min_generic_const_args,
|
||||||
min_specialization,
|
min_specialization,
|
||||||
min_type_alias_impl_trait,
|
min_type_alias_impl_trait,
|
||||||
minimumf128,
|
|
||||||
minimumf16,
|
minimumf16,
|
||||||
minimumf32,
|
minimumf32,
|
||||||
minimumf64,
|
minimumf64,
|
||||||
minnumf128,
|
minimumf128,
|
||||||
minnumf16,
|
minnumf16,
|
||||||
minnumf32,
|
minnumf32,
|
||||||
minnumf64,
|
minnumf64,
|
||||||
|
minnumf128,
|
||||||
mips_target_feature,
|
mips_target_feature,
|
||||||
mir_assume,
|
mir_assume,
|
||||||
mir_basic_block,
|
mir_basic_block,
|
||||||
@@ -1633,14 +1629,14 @@ symbols! {
|
|||||||
post_dash_lto: "post-lto",
|
post_dash_lto: "post-lto",
|
||||||
postfix_match,
|
postfix_match,
|
||||||
powerpc_target_feature,
|
powerpc_target_feature,
|
||||||
powf128,
|
|
||||||
powf16,
|
powf16,
|
||||||
powf32,
|
powf32,
|
||||||
powf64,
|
powf64,
|
||||||
powif128,
|
powf128,
|
||||||
powif16,
|
powif16,
|
||||||
powif32,
|
powif32,
|
||||||
powif64,
|
powif64,
|
||||||
|
powif128,
|
||||||
pre_dash_lto: "pre-lto",
|
pre_dash_lto: "pre-lto",
|
||||||
precise_capturing,
|
precise_capturing,
|
||||||
precise_capturing_in_traits,
|
precise_capturing_in_traits,
|
||||||
@@ -1785,14 +1781,14 @@ symbols! {
|
|||||||
ropi_rwpi: "ropi-rwpi",
|
ropi_rwpi: "ropi-rwpi",
|
||||||
rotate_left,
|
rotate_left,
|
||||||
rotate_right,
|
rotate_right,
|
||||||
round_ties_even_f128,
|
|
||||||
round_ties_even_f16,
|
round_ties_even_f16,
|
||||||
round_ties_even_f32,
|
round_ties_even_f32,
|
||||||
round_ties_even_f64,
|
round_ties_even_f64,
|
||||||
roundf128,
|
round_ties_even_f128,
|
||||||
roundf16,
|
roundf16,
|
||||||
roundf32,
|
roundf32,
|
||||||
roundf64,
|
roundf64,
|
||||||
|
roundf128,
|
||||||
rt,
|
rt,
|
||||||
rtm_target_feature,
|
rtm_target_feature,
|
||||||
rust,
|
rust,
|
||||||
@@ -1972,8 +1968,8 @@ symbols! {
|
|||||||
simd_fexp2,
|
simd_fexp2,
|
||||||
simd_ffi,
|
simd_ffi,
|
||||||
simd_flog,
|
simd_flog,
|
||||||
simd_flog10,
|
|
||||||
simd_flog2,
|
simd_flog2,
|
||||||
|
simd_flog10,
|
||||||
simd_floor,
|
simd_floor,
|
||||||
simd_fma,
|
simd_fma,
|
||||||
simd_fmax,
|
simd_fmax,
|
||||||
@@ -2021,10 +2017,10 @@ symbols! {
|
|||||||
simd_with_exposed_provenance,
|
simd_with_exposed_provenance,
|
||||||
simd_xor,
|
simd_xor,
|
||||||
since,
|
since,
|
||||||
sinf128,
|
|
||||||
sinf16,
|
sinf16,
|
||||||
sinf32,
|
sinf32,
|
||||||
sinf64,
|
sinf64,
|
||||||
|
sinf128,
|
||||||
size,
|
size,
|
||||||
size_of,
|
size_of,
|
||||||
size_of_val,
|
size_of_val,
|
||||||
@@ -2046,10 +2042,10 @@ symbols! {
|
|||||||
specialization,
|
specialization,
|
||||||
speed,
|
speed,
|
||||||
spotlight,
|
spotlight,
|
||||||
sqrtf128,
|
|
||||||
sqrtf16,
|
sqrtf16,
|
||||||
sqrtf32,
|
sqrtf32,
|
||||||
sqrtf64,
|
sqrtf64,
|
||||||
|
sqrtf128,
|
||||||
sreg,
|
sreg,
|
||||||
sreg_low16,
|
sreg_low16,
|
||||||
sse,
|
sse,
|
||||||
@@ -2127,10 +2123,10 @@ symbols! {
|
|||||||
target_has_atomic,
|
target_has_atomic,
|
||||||
target_has_atomic_equal_alignment,
|
target_has_atomic_equal_alignment,
|
||||||
target_has_atomic_load_store,
|
target_has_atomic_load_store,
|
||||||
target_has_reliable_f128,
|
|
||||||
target_has_reliable_f128_math,
|
|
||||||
target_has_reliable_f16,
|
target_has_reliable_f16,
|
||||||
target_has_reliable_f16_math,
|
target_has_reliable_f16_math,
|
||||||
|
target_has_reliable_f128,
|
||||||
|
target_has_reliable_f128_math,
|
||||||
target_os,
|
target_os,
|
||||||
target_pointer_width,
|
target_pointer_width,
|
||||||
target_thread_local,
|
target_thread_local,
|
||||||
@@ -2173,10 +2169,10 @@ symbols! {
|
|||||||
transparent_enums,
|
transparent_enums,
|
||||||
transparent_unions,
|
transparent_unions,
|
||||||
trivial_bounds,
|
trivial_bounds,
|
||||||
truncf128,
|
|
||||||
truncf16,
|
truncf16,
|
||||||
truncf32,
|
truncf32,
|
||||||
truncf64,
|
truncf64,
|
||||||
|
truncf128,
|
||||||
try_blocks,
|
try_blocks,
|
||||||
try_capture,
|
try_capture,
|
||||||
try_from,
|
try_from,
|
||||||
@@ -2205,12 +2201,12 @@ symbols! {
|
|||||||
type_name,
|
type_name,
|
||||||
type_privacy_lints,
|
type_privacy_lints,
|
||||||
typed_swap_nonoverlapping,
|
typed_swap_nonoverlapping,
|
||||||
u128,
|
u8,
|
||||||
u128_legacy_const_max,
|
u8_legacy_const_max,
|
||||||
u128_legacy_const_min,
|
u8_legacy_const_min,
|
||||||
u128_legacy_fn_max_value,
|
u8_legacy_fn_max_value,
|
||||||
u128_legacy_fn_min_value,
|
u8_legacy_fn_min_value,
|
||||||
u128_legacy_mod,
|
u8_legacy_mod,
|
||||||
u16,
|
u16,
|
||||||
u16_legacy_const_max,
|
u16_legacy_const_max,
|
||||||
u16_legacy_const_min,
|
u16_legacy_const_min,
|
||||||
@@ -2229,12 +2225,12 @@ symbols! {
|
|||||||
u64_legacy_fn_max_value,
|
u64_legacy_fn_max_value,
|
||||||
u64_legacy_fn_min_value,
|
u64_legacy_fn_min_value,
|
||||||
u64_legacy_mod,
|
u64_legacy_mod,
|
||||||
u8,
|
u128,
|
||||||
u8_legacy_const_max,
|
u128_legacy_const_max,
|
||||||
u8_legacy_const_min,
|
u128_legacy_const_min,
|
||||||
u8_legacy_fn_max_value,
|
u128_legacy_fn_max_value,
|
||||||
u8_legacy_fn_min_value,
|
u128_legacy_fn_min_value,
|
||||||
u8_legacy_mod,
|
u128_legacy_mod,
|
||||||
ub_checks,
|
ub_checks,
|
||||||
unaligned_volatile_load,
|
unaligned_volatile_load,
|
||||||
unaligned_volatile_store,
|
unaligned_volatile_store,
|
||||||
@@ -2387,6 +2383,7 @@ symbols! {
|
|||||||
zfh,
|
zfh,
|
||||||
zfhmin,
|
zfhmin,
|
||||||
zmm_reg,
|
zmm_reg,
|
||||||
|
// tidy-alphabetical-end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user