Skip to content

Add unused pre-interned symbols tidy check #110437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 1 addition & 36 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,9 @@ symbols! {
AcqRel,
Acquire,
AddToDiagnostic,
Alignment,
Any,
Arc,
Argument,
ArgumentV1,
ArgumentV1Methods,
Arguments,
AsMut,
AsRef,
AssertParamIsClone,
Expand Down Expand Up @@ -160,14 +156,12 @@ symbols! {
Break,
C,
CStr,
CString,
Capture,
Center,
Clone,
Context,
Continue,
Copy,
Count,
Cow,
Debug,
Decodable,
Expand All @@ -188,15 +182,11 @@ symbols! {
Error,
File,
FileType,
FormatSpec,
Formatter,
From,
FromIterator,
FromResidual,
Future,
FutureOutput,
FxHashMap,
FxHashSet,
GlobalAlloc,
Hash,
HashMap,
Expand All @@ -223,7 +213,6 @@ symbols! {
LocalKey,
Mutex,
MutexGuard,
N,
NonZeroI128,
NonZeroI16,
NonZeroI32,
Expand All @@ -248,7 +237,6 @@ symbols! {
Path,
PathBuf,
Pending,
Pin,
Pointer,
Poll,
ProcMacro,
Expand Down Expand Up @@ -284,7 +272,6 @@ symbols! {
StructuralPartialEq,
SubdiagnosticMessage,
Sync,
T,
Target,
ToOwned,
ToString,
Expand All @@ -298,7 +285,6 @@ symbols! {
TyCtxt,
TyKind,
Unknown,
UnsafeArg,
Vec,
VecDeque,
Wrapper,
Expand Down Expand Up @@ -352,7 +338,6 @@ symbols! {
allow_fail,
allow_internal_unsafe,
allow_internal_unstable,
allowed,
alu32,
always,
and,
Expand All @@ -368,7 +353,6 @@ symbols! {
arm,
arm_target_feature,
array,
arrays,
as_ptr,
as_ref,
as_str,
Expand Down Expand Up @@ -396,7 +380,6 @@ symbols! {
async_await,
async_closure,
async_fn_in_trait,
atomic,
atomic_mod,
atomics,
att_syntax,
Expand Down Expand Up @@ -439,7 +422,6 @@ symbols! {
breakpoint,
bridge,
bswap,
c_str,
c_unwind,
c_variadic,
call,
Expand Down Expand Up @@ -540,7 +522,6 @@ symbols! {
const_try,
constant,
constructor,
context,
copy,
copy_closures,
copy_nonoverlapping,
Expand Down Expand Up @@ -583,9 +564,7 @@ symbols! {
debug_assert_macro,
debug_assert_ne_macro,
debug_assertions,
debug_struct,
debug_struct_fields_finish,
debug_tuple,
debug_tuple_fields_finish,
debugger_visualizer,
decl_macro,
Expand All @@ -610,7 +589,6 @@ symbols! {
derive_default_enum,
destruct,
destructuring_assignment,
diagnostic,
direct,
discriminant_kind,
discriminant_type,
Expand Down Expand Up @@ -701,15 +679,11 @@ symbols! {
fence,
ferris: "🦀",
fetch_update,
ffi,
ffi_const,
ffi_pure,
ffi_returns_twice,
field,
field_init_shorthand,
file,
fill,
flags,
float,
float_to_int_unchecked,
floorf32,
Expand All @@ -727,7 +701,6 @@ symbols! {
fn_ptr_trait,
forbid,
forget,
format,
format_alignment,
format_args,
format_args_capture,
Expand All @@ -754,7 +727,6 @@ symbols! {
from_yeet,
fsub_fast,
fundamental,
future,
future_trait,
gdb_script_file,
ge,
Expand Down Expand Up @@ -947,7 +919,6 @@ symbols! {
minnumf64,
mips_target_feature,
miri,
misc,
mmx_reg,
modifiers,
module,
Expand Down Expand Up @@ -1041,7 +1012,6 @@ symbols! {
on_unimplemented,
oom,
opaque,
ops,
opt_out_copy,
optimize,
optimize_attribute,
Expand Down Expand Up @@ -1105,7 +1075,6 @@ symbols! {
powif64,
pre_dash_lto: "pre-lto",
precise_pointer_size_matching,
precision,
pref_align_of,
prefetch_read_data,
prefetch_read_instruction,
Expand All @@ -1115,7 +1084,6 @@ symbols! {
prelude,
prelude_import,
preserves_flags,
primitive,
print_macro,
println_macro,
proc_dash_macro: "proc-macro",
Expand Down Expand Up @@ -1450,7 +1418,6 @@ symbols! {
structural_match,
structural_peq,
structural_teq,
sty,
sub,
sub_assign,
sub_with_overflow,
Expand Down Expand Up @@ -1589,7 +1556,6 @@ symbols! {
used_with_arg,
using,
usize,
v1,
va_arg,
va_copy,
va_end,
Expand All @@ -1606,7 +1572,6 @@ symbols! {
vfp2,
vis,
visible_private_types,
volatile,
volatile_copy_memory,
volatile_copy_nonoverlapping_memory,
volatile_load,
Expand Down Expand Up @@ -2006,7 +1971,7 @@ pub mod kw {
// This module has a very short name because it's used a lot.
/// This module contains all the defined non-keyword `Symbol`s.
///
/// Given that `sym` is imported, use them like `sym::symbol_name`.
/// Given that `sym` is imported, use them like `sym::<symbol_name>`.
/// For example `sym::rustfmt` or `sym::u8`.
pub mod sym {
use super::Symbol;
Expand Down
1 change: 1 addition & 0 deletions src/tools/tidy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ pub mod pal;
pub mod primitive_docs;
pub mod rustdoc_gui_tests;
pub mod style;
pub mod symbols;
pub mod target_specific_tests;
pub mod tests_placement;
pub mod ui_tests;
Expand Down
11 changes: 7 additions & 4 deletions src/tools/tidy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use std::env;
use std::num::NonZeroUsize;
use std::path::PathBuf;
use std::process;
use std::str::FromStr;
use std::sync::atomic::{AtomicBool, Ordering};
use std::thread::{self, scope, ScopedJoinHandle};

Expand All @@ -20,15 +19,18 @@ fn main() {
let cargo: PathBuf = env::args_os().nth(2).expect("need path to cargo").into();
let output_directory: PathBuf =
env::args_os().nth(3).expect("need path to output directory").into();
let concurrency: NonZeroUsize =
FromStr::from_str(&env::args().nth(4).expect("need concurrency"))
.expect("concurrency must be a number");
let concurrency: NonZeroUsize = env::args()
.nth(4)
.expect("need concurrency")
.parse()
.expect("concurrency must be a non-zero number");

let src_path = root_path.join("src");
let tests_path = root_path.join("tests");
let library_path = root_path.join("library");
let compiler_path = root_path.join("compiler");
let librustdoc_path = src_path.join("librustdoc");
let tools_path = src_path.join("tools");

let args: Vec<String> = env::args().skip(1).collect();

Expand Down Expand Up @@ -96,6 +98,7 @@ fn main() {

// Checks that only make sense for the compiler.
check!(error_codes, &root_path, &[&compiler_path, &librustdoc_path], verbose);
check!(symbols, &compiler_path, &librustdoc_path, &tools_path);

// Checks that only make sense for the std libs.
check!(pal, &library_path);
Expand Down
Loading