Skip to content

Commit

Permalink
Rollup merge of #104383 - WaffleLapkin:rustc_undiagnostic_item, r=com…
Browse files Browse the repository at this point in the history
…piler-errors

Remove unused symbols and diagnostic items

As the title suggests, this removes unused symbols from `sym::` and `#[rustc_diagnostic_item]` annotations that weren't mentioned anywhere.

Originally I tried to use grep, to find symbols and item names that are never mentioned via `sym::name`, however this produced a lot of false positives (?), for example clippy matching on `Symbol::as_str` or macros "implicitly" adding `sym::`. I ended up fixing all these false positives (?) by hand, but tbh I'm not sure if it was worth it...
  • Loading branch information
matthiaskrgr committed Nov 15, 2022
2 parents 0a3cb1e + 29fe28f commit 2c29b05
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 79 deletions.
52 changes: 1 addition & 51 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ symbols! {
Count,
Cow,
Debug,
DebugStruct,
DebugTuple,
Decodable,
Decoder,
DecorateLint,
Expand All @@ -190,9 +188,6 @@ symbols! {
Error,
File,
FileType,
Fn,
FnMut,
FnOnce,
FormatSpec,
Formatter,
From,
Expand All @@ -211,7 +206,6 @@ symbols! {
Input,
Into,
IntoDiagnostic,
IntoFuture,
IntoIterator,
IoRead,
IoWrite,
Expand Down Expand Up @@ -256,7 +250,6 @@ symbols! {
Pointer,
Poll,
ProcMacro,
ProcMacroHack,
ProceduralMasqueradeDummyType,
Range,
RangeFrom,
Expand Down Expand Up @@ -332,7 +325,6 @@ symbols! {
abi_vectorcall,
abi_x86_interrupt,
abort,
aborts,
add,
add_assign,
add_with_overflow,
Expand All @@ -344,7 +336,6 @@ symbols! {
align,
align_offset,
alignment,
alignstack,
all,
alloc,
alloc_error_handler,
Expand Down Expand Up @@ -433,7 +424,6 @@ symbols! {
bool,
borrowck_graphviz_format,
borrowck_graphviz_postflow,
borrowck_graphviz_preflow,
box_free,
box_patterns,
box_syntax,
Expand Down Expand Up @@ -462,15 +452,13 @@ symbols! {
cfg_doctest,
cfg_eval,
cfg_hide,
cfg_macro,
cfg_panic,
cfg_sanitize,
cfg_target_abi,
cfg_target_compact,
cfg_target_feature,
cfg_target_has_atomic,
cfg_target_has_atomic_equal_alignment,
cfg_target_has_atomic_load_store,
cfg_target_thread_local,
cfg_target_vendor,
cfg_version,
Expand All @@ -495,19 +483,15 @@ symbols! {
cold,
collapse_debuginfo,
column,
column_macro,
compare_and_swap,
compare_exchange,
compare_exchange_weak,
compile_error,
compile_error_macro,
compiler,
compiler_builtins,
compiler_fence,
concat,
concat_bytes,
concat_idents,
concat_macro,
conservative_impl_trait,
console,
const_allocate,
Expand All @@ -528,7 +512,6 @@ symbols! {
const_fn_unsize,
const_for,
const_format_args,
const_generic_defaults,
const_generics,
const_generics_defaults,
const_if_match,
Expand All @@ -547,22 +530,19 @@ symbols! {
const_trait,
const_trait_bound_opt_out,
const_trait_impl,
const_transmute,
const_try,
constant,
constructor,
contents,
context,
convert,
copy,
copy_closures,
copy_nonoverlapping,
copysignf32,
copysignf64,
core,
core_intrinsics,
core_panic,
core_panic_2015_macro,
core_panic_2021_macro,
core_panic_macro,
cosf32,
cosf64,
Expand Down Expand Up @@ -598,7 +578,6 @@ symbols! {
debug_assertions,
debug_struct,
debug_struct_fields_finish,
debug_trait_builder,
debug_tuple,
debug_tuple_fields_finish,
debugger_visualizer,
Expand Down Expand Up @@ -630,7 +609,6 @@ symbols! {
discriminant_type,
discriminant_value,
dispatch_from_dyn,
display_trait,
div,
div_assign,
doc,
Expand Down Expand Up @@ -661,7 +639,6 @@ symbols! {
dyn_star,
dyn_trait,
e,
edition_macro_pats,
edition_panic,
eh_catch_typeinfo,
eh_personality,
Expand All @@ -674,7 +651,6 @@ symbols! {
encode,
end,
env,
env_macro,
eprint_macro,
eprintln_macro,
eq,
Expand Down Expand Up @@ -724,9 +700,7 @@ symbols! {
field,
field_init_shorthand,
file,
file_macro,
fill,
finish,
flags,
float,
float_to_int_unchecked,
Expand All @@ -735,8 +709,6 @@ symbols! {
fmaf32,
fmaf64,
fmt,
fmt_as_str,
fmt_internals,
fmul_fast,
fn_align,
fn_must_use,
Expand All @@ -751,7 +723,6 @@ symbols! {
format_args_macro,
format_args_nl,
format_macro,
fp,
freeze,
freg,
frem_fast,
Expand Down Expand Up @@ -814,7 +785,6 @@ symbols! {
ignore,
impl_header_lifetime_elision,
impl_lint_pass,
impl_macros,
impl_trait_in_bindings,
impl_trait_in_fn_trait_return,
implied_by,
Expand All @@ -826,7 +796,6 @@ symbols! {
include,
include_bytes,
include_bytes_macro,
include_macro,
include_str,
include_str_macro,
inclusive_range_syntax,
Expand All @@ -844,7 +813,6 @@ symbols! {
instruction_set,
integer_: "integer",
integral,
intel,
into_future,
into_iter,
intra_doc_pointers,
Expand Down Expand Up @@ -881,7 +849,6 @@ symbols! {
lifetimes,
likely,
line,
line_macro,
link,
link_args,
link_cfg,
Expand Down Expand Up @@ -926,7 +893,6 @@ symbols! {
masked,
match_beginning_vert,
match_default_bindings,
matches_macro,
maxnumf32,
maxnumf64,
may_dangle,
Expand Down Expand Up @@ -965,7 +931,6 @@ symbols! {
modifiers,
module,
module_path,
module_path_macro,
more_qualified_paths,
more_struct_aliases,
movbe_target_feature,
Expand Down Expand Up @@ -1059,7 +1024,6 @@ symbols! {
optin_builtin_traits,
option,
option_env,
option_env_macro,
options,
or,
or_patterns,
Expand Down Expand Up @@ -1102,7 +1066,6 @@ symbols! {
plugins,
pointee_trait,
pointer,
pointer_trait_fmt,
poll,
position,
post_dash_lto: "post-lto",
Expand All @@ -1129,7 +1092,6 @@ symbols! {
proc_dash_macro: "proc-macro",
proc_macro,
proc_macro_attribute,
proc_macro_def_site,
proc_macro_derive,
proc_macro_expr,
proc_macro_gen,
Expand Down Expand Up @@ -1230,9 +1192,6 @@ symbols! {
rust_cold_cc,
rust_eh_catch_typeinfo,
rust_eh_personality,
rust_eh_register_frames,
rust_eh_unregister_frames,
rust_oom,
rustc,
rustc_allocator,
rustc_allocator_zeroed,
Expand Down Expand Up @@ -1305,7 +1264,6 @@ symbols! {
rustc_serialize,
rustc_skip_array_during_method_dispatch,
rustc_specialization_trait,
rustc_stable,
rustc_std_internal_symbol,
rustc_strict_coherence,
rustc_symbol_name,
Expand Down Expand Up @@ -1433,7 +1391,6 @@ symbols! {
static_recursion,
staticlib,
std,
std_inject,
std_panic,
std_panic_2015_macro,
std_panic_macro,
Expand All @@ -1448,7 +1405,6 @@ symbols! {
str_trim_start,
strict_provenance,
stringify,
stringify_macro,
struct_field_attributes,
struct_inherit,
struct_variant,
Expand Down Expand Up @@ -1476,10 +1432,8 @@ symbols! {
target_has_atomic_load_store,
target_os,
target_pointer_width,
target_target_vendor,
target_thread_local,
target_vendor,
task,
tbm_target_feature,
termination,
termination_trait,
Expand All @@ -1491,7 +1445,6 @@ symbols! {
test_removed_feature,
test_runner,
test_unstable_lint,
then_with,
thread,
thread_local,
thread_local_macro,
Expand Down Expand Up @@ -1523,7 +1476,6 @@ symbols! {
try_trait_v2,
tt,
tuple,
tuple_from_req,
tuple_indexing,
tuple_trait,
two_phase,
Expand Down Expand Up @@ -1567,7 +1519,6 @@ symbols! {
unreachable_2015,
unreachable_2015_macro,
unreachable_2021,
unreachable_2021_macro,
unreachable_code,
unreachable_display,
unreachable_macro,
Expand All @@ -1586,7 +1537,6 @@ symbols! {
from crates.io via `Cargo.toml` instead?",
untagged_unions,
unused_imports,
unused_qualifications,
unwind,
unwind_attributes,
unwind_safe_trait,
Expand Down
1 change: 0 additions & 1 deletion library/core/src/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,6 @@ pub trait UpperHex {
pub trait Pointer {
/// Formats the value using the given formatter.
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "pointer_trait_fmt"]
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
}

Expand Down
Loading

0 comments on commit 2c29b05

Please sign in to comment.