Skip to content

Commit

Permalink
Rollup merge of rust-lang#73834 - oli-obk:safe_intrinsics, r=ecstatic…
Browse files Browse the repository at this point in the history
…-morse

Some refactoring around intrinsic type checking

So... This PR went a bit overboard. I wanted to make the `rustc_peek` intrinsic safe (cc @ecstatic-morse ), and remembered a long-standing itch of mine. So I made that huge `&str` match for the intrinsic name a match on `Symbol`s (so basically `u32`s). This is unlikely to have a positive perf effect, even if it likely has better codegen (intrinsics are used rarely, mostly once in their wrapper), so it's mostly a consistency thing since other places actually match on the symbol name of the intrinsics.
  • Loading branch information
Manishearth authored Jul 4, 2020
2 parents 0cd7ff7 + 394b8cd commit 0e8a34a
Show file tree
Hide file tree
Showing 15 changed files with 307 additions and 193 deletions.
79 changes: 79 additions & 0 deletions src/librustc_span/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,14 @@ symbols! {
arm_target_feature,
asm,
assert,
assert_inhabited,
assert_uninit_valid,
assert_zero_valid,
associated_consts,
associated_type_bounds,
associated_type_defaults,
associated_types,
assume,
assume_init,
async_await,
async_closure,
Expand All @@ -181,11 +185,14 @@ symbols! {
box_patterns,
box_syntax,
braced_empty_structs,
breakpoint,
bswap,
bitreverse,
C,
caller_location,
cdylib,
ceilf32,
ceilf64,
cfg,
cfg_accessible,
cfg_attr,
Expand Down Expand Up @@ -239,8 +246,14 @@ symbols! {
convert,
Copy,
copy_closures,
copy,
copy_nonoverlapping,
copysignf32,
copysignf64,
core,
core_intrinsics,
cosf32,
cosf64,
count_code_region,
coverage_counter_add,
coverage_counter_subtract,
Expand Down Expand Up @@ -299,6 +312,7 @@ symbols! {
dropck_eyepatch,
dropck_parametricity,
drop_types_in_const,
drop_in_place,
dylib,
dyn_trait,
eh_personality,
Expand All @@ -311,11 +325,16 @@ symbols! {
Eq,
Equal,
enclosing_scope,
exact_div,
except,
exclusive_range_pattern,
exhaustive_integer_patterns,
exhaustive_patterns,
existential_type,
expf32,
expf64,
exp2f32,
exp2f64,
expected,
export_name,
expr,
Expand All @@ -329,20 +348,32 @@ symbols! {
f16c_target_feature,
f32,
f64,
fadd_fast,
fabsf32,
fabsf64,
fdiv_fast,
feature,
ffi_const,
ffi_pure,
ffi_returns_twice,
field,
field_init_shorthand,
file,
float_to_int_unchecked,
floorf64,
floorf32,
fmaf32,
fmaf64,
fmt,
fmt_internals,
fmul_fast,
fn_must_use,
forbid,
forget,
format_args,
format_args_nl,
format_args_capture,
frem_fast,
from,
From,
from_desugaring,
Expand All @@ -352,6 +383,7 @@ symbols! {
from_ok,
from_usize,
from_trait,
fsub_fast,
fundamental,
future,
Future,
Expand Down Expand Up @@ -448,6 +480,12 @@ symbols! {
llvm_asm,
local_inner_macros,
log_syntax,
logf32,
logf64,
log10f32,
log10f64,
log2f32,
log2f64,
loop_break_value,
macro_at_most_once_rep,
macro_escape,
Expand Down Expand Up @@ -475,10 +513,16 @@ symbols! {
message,
meta,
min_align_of,
min_align_of_val,
min_const_fn,
min_const_unsafe_fn,
min_specialization,
minnumf32,
minnumf64,
maxnumf32,
maxnumf64,
mips_target_feature,
miri_start_panic,
mmx_target_feature,
module,
module_path,
Expand All @@ -491,6 +535,8 @@ symbols! {
naked,
naked_functions,
name,
nearbyintf32,
nearbyintf64,
needs_allocator,
needs_drop,
needs_panic_runtime,
Expand Down Expand Up @@ -518,6 +564,7 @@ symbols! {
None,
non_exhaustive,
non_modrs_mods,
nontemporal_store,
nontrapping_fptoint: "nontrapping-fptoint",
noreturn,
no_niche,
Expand Down Expand Up @@ -577,8 +624,16 @@ symbols! {
poll,
Poll,
powerpc_target_feature,
powf32,
powf64,
powif32,
powif64,
precise_pointer_size_matching,
pref_align_of,
prefetch_read_data,
prefetch_read_instruction,
prefetch_write_data,
prefetch_write_instruction,
prelude,
prelude_import,
preserves_flags,
Expand Down Expand Up @@ -640,10 +695,14 @@ symbols! {
Result,
Return,
rhs,
rintf32,
rintf64,
riscv_target_feature,
rlib,
rotate_left,
rotate_right,
roundf32,
roundf64,
rt,
rtm_target_feature,
rust,
Expand Down Expand Up @@ -726,14 +785,19 @@ symbols! {
simd_ffi,
simd_insert,
since,
sinf32,
sinf64,
size,
size_of,
size_of_val,
slice_patterns,
slicing_syntax,
soft,
Some,
specialization,
speed,
sqrtf32,
sqrtf64,
sse4a_target_feature,
stable,
staged_api,
Expand Down Expand Up @@ -787,6 +851,8 @@ symbols! {
transparent_enums,
transparent_unions,
trivial_bounds,
truncf32,
truncf64,
Try,
try_blocks,
try_trait,
Expand All @@ -809,6 +875,8 @@ symbols! {
u32,
u64,
u8,
unaligned_volatile_load,
unaligned_volatile_store,
unboxed_closures,
unchecked_add,
unchecked_div,
Expand All @@ -824,6 +892,7 @@ symbols! {
universal_impl_trait,
unlikely,
unmarked_api,
unreachable,
unreachable_code,
unrestricted_attribute_tokens,
unsafe_block_in_unsafe_fn,
Expand All @@ -843,12 +912,21 @@ symbols! {
val,
var,
variant_count,
va_arg,
va_copy,
va_end,
va_start,
vec,
Vec,
version,
vis,
visible_private_types,
volatile,
volatile_copy_memory,
volatile_copy_nonoverlapping_memory,
volatile_load,
volatile_set_memory,
volatile_store,
warn,
wasm_import_module,
wasm_target_feature,
Expand All @@ -858,6 +936,7 @@ symbols! {
wrapping_add,
wrapping_sub,
wrapping_mul,
write_bytes,
Yield,
}
}
Expand Down
Loading

0 comments on commit 0e8a34a

Please sign in to comment.