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 Jun 30, 2020
2 parents 1402233 + 824b2bb commit 691ba6f
Show file tree
Hide file tree
Showing 15 changed files with 307 additions and 191 deletions.
81 changes: 81 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,
crate_id,
crate_in_paths,
Expand Down Expand Up @@ -296,6 +309,7 @@ symbols! {
dropck_eyepatch,
dropck_parametricity,
drop_types_in_const,
drop_in_place,
dylib,
dyn_trait,
eh_personality,
Expand All @@ -308,11 +322,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 @@ -326,19 +345,31 @@ 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,
frem_fast,
from,
From,
from_desugaring,
Expand All @@ -348,6 +379,7 @@ symbols! {
from_ok,
from_usize,
from_trait,
fsub_fast,
fundamental,
future,
Future,
Expand Down Expand Up @@ -427,6 +459,7 @@ symbols! {
lhs,
lib,
lifetime,
likely,
line,
link,
linkage,
Expand All @@ -442,6 +475,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 @@ -469,10 +508,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 @@ -485,6 +530,8 @@ symbols! {
naked,
naked_functions,
name,
nearbyintf32,
nearbyintf64,
needs_allocator,
needs_drop,
needs_panic_runtime,
Expand Down Expand Up @@ -512,6 +559,7 @@ symbols! {
None,
non_exhaustive,
non_modrs_mods,
nontemporal_store,
noreturn,
no_niche,
no_sanitize,
Expand Down Expand Up @@ -570,8 +618,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 @@ -631,10 +687,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 @@ -717,14 +777,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 @@ -778,6 +843,8 @@ symbols! {
transparent_enums,
transparent_unions,
trivial_bounds,
truncf32,
truncf64,
Try,
try_blocks,
try_trait,
Expand All @@ -800,6 +867,8 @@ symbols! {
u32,
u64,
u8,
unaligned_volatile_load,
unaligned_volatile_store,
unboxed_closures,
unchecked_add,
unchecked_div,
Expand All @@ -813,7 +882,9 @@ symbols! {
underscore_lifetimes,
uniform_paths,
universal_impl_trait,
unlikely,
unmarked_api,
unreachable,
unreachable_code,
unrestricted_attribute_tokens,
unsafe_block_in_unsafe_fn,
Expand All @@ -833,12 +904,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 @@ -848,6 +928,7 @@ symbols! {
wrapping_add,
wrapping_sub,
wrapping_mul,
write_bytes,
Yield,
}
}
Expand Down
Loading

0 comments on commit 691ba6f

Please sign in to comment.