From b463c0791e8b2d1a99573852a7699b0b470efb38 Mon Sep 17 00:00:00 2001 From: klensy Date: Fri, 17 Jan 2025 12:16:40 +0300 Subject: [PATCH 1/8] impl watcher --- Cargo.lock | 1 + src/tools/tidy/Cargo.toml | 1 + src/tools/tidy/src/lib.rs | 1 + src/tools/tidy/src/main.rs | 2 + src/tools/tidy/src/watcher.rs | 188 ++++++++++++++++++++++++++++ src/tools/tidy/src/watcher/tests.rs | 39 ++++++ 6 files changed, 232 insertions(+) create mode 100644 src/tools/tidy/src/watcher.rs create mode 100644 src/tools/tidy/src/watcher/tests.rs diff --git a/Cargo.lock b/Cargo.lock index 89eb514917d6d..14e652ee6622b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5429,6 +5429,7 @@ dependencies = [ "cargo_metadata 0.19.1", "fluent-syntax", "ignore", + "md-5", "miropt-test-tools", "regex", "rustc-hash 2.1.0", diff --git a/src/tools/tidy/Cargo.toml b/src/tools/tidy/Cargo.toml index 9a4d0891b4aee..50bd8b01dc7cb 100644 --- a/src/tools/tidy/Cargo.toml +++ b/src/tools/tidy/Cargo.toml @@ -17,6 +17,7 @@ termcolor = "1.1.3" rustc-hash = "2.0.0" fluent-syntax = "0.11.1" similar = "2.5.0" +md-5 = "0.10" [features] build-metrics = ["dep:serde"] diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs index 1e7eb82b83e98..243893fab1f47 100644 --- a/src/tools/tidy/src/lib.rs +++ b/src/tools/tidy/src/lib.rs @@ -93,4 +93,5 @@ pub mod unit_tests; pub mod unknown_revision; pub mod unstable_book; pub mod walk; +pub mod watcher; pub mod x_version; diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index 13a558fea48ea..8c74ed36994f7 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -146,6 +146,8 @@ fn main() { check!(x_version, &root_path, &cargo); + check!(watcher, &root_path); + let collected = { drain_handles(&mut handles); diff --git a/src/tools/tidy/src/watcher.rs b/src/tools/tidy/src/watcher.rs new file mode 100644 index 0000000000000..199f19c7137cc --- /dev/null +++ b/src/tools/tidy/src/watcher.rs @@ -0,0 +1,188 @@ +//! Checks that text between tags unchanged, emitting warning otherwise, +//! allowing asserting that code in different places over codebase is in sync. +//! +//! This works via hashing text between tags and saving hash in tidy. +//! +//! Usage: +//! +//! some.rs: +//! // tidy-ticket-foo +//! const FOO: usize = 42; +//! // tidy-ticket-foo +//! +//! some.sh: +//! # tidy-ticket-foo +//! export FOO=42 +//! # tidy-ticket-foo +use md5::{Digest, Md5}; +use std::fs; +use std::path::Path; + +#[cfg(test)] +mod tests; + +/// Return hash for source text between 2 tag occurrence, +/// ignoring lines where tag written +/// +/// Expecting: +/// tag is not multiline +/// source always have at least 2 occurrence of tag (>2 ignored) +fn span_hash(source: &str, tag: &str, bad: &mut bool) -> Result { + let start_idx = match source.find(tag) { + Some(idx) => idx, + None => return Err(tidy_error!(bad, "tag {} should exist in provided text", tag)), + }; + let end_idx = { + let end = match source[start_idx + tag.len()..].find(tag) { + // index from source start + Some(idx) => start_idx + tag.len() + idx, + None => return Err(tidy_error!(bad, "tag end {} should exist in provided text", tag)), + }; + // second line with tag can contain some other text before tag, ignore it + // by finding position of previous line ending + // + // FIXME: what if line ending is \r\n? In that case \r will be hashed too + let offset = source[start_idx..end].rfind('\n').unwrap(); + start_idx + offset + }; + + let mut hasher = Md5::new(); + + source[start_idx..end_idx] + .lines() + // skip first line with tag + .skip(1) + // hash next lines, ignoring end trailing whitespaces + .for_each(|line| { + let trimmed = line.trim_end(); + hasher.update(trimmed); + }); + Ok(format!("{:x}", hasher.finalize())) +} + +fn check_entry(entry: &ListEntry<'_>, group_idx: usize, bad: &mut bool, root_path: &Path) { + let file = fs::read_to_string(root_path.join(Path::new(entry.0))) + .unwrap_or_else(|e| panic!("{:?}, path: {}", e, entry.0)); + let actual_hash = span_hash(&file, entry.2, bad).unwrap(); + if actual_hash != entry.1 { + // Write tidy error description for wather only once. + // Will not work if there was previous errors of other types. + if *bad == false { + tidy_error!( + bad, + "The code blocks tagged with tidy watcher has changed.\n\ + It's likely that code blocks with the following tags need to be changed too. Check src/tools/tidy/src/watcher.rs, find tag/hash in TIDY_WATCH_LIST list \ + and verify that sources for provided group of tags in sync. Once that done, run tidy again and update hashes in TIDY_WATCH_LIST with provided actual hashes." + ) + } + tidy_error!( + bad, + "hash for tag `{}` in path `{}` mismatch:\n actual: `{}`, expected: `{}`\n \ + Verify that tags `{:?}` in sync.", + entry.2, + entry.0, + actual_hash, + entry.1, + TIDY_WATCH_LIST[group_idx].iter().map(|e| e.2).collect::>() + ); + } +} + +macro_rules! add_group { + ($($entry:expr),*) => { + &[$($entry),*] + }; +} + +/// (path, hash, tag) +type ListEntry<'a> = (&'a str, &'a str, &'a str); + +/// List of tags to watch, along with paths and hashes +#[rustfmt::skip] +const TIDY_WATCH_LIST: &[&[ListEntry<'_>]] = &[ + // sync perf commit across dockerfile and opt-dist + add_group!( + ("src/tools/opt-dist/src/main.rs", "f99844fda86216628167cd3391844ed1", "tidy-ticket-perf-commit"), + ("src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile", "fa9a88e552735e9f93934501e9c8d87a", "tidy-ticket-perf-commit") + ), + + add_group!( + ("compiler/rustc_ast/src/token.rs", "0f6ba78f1007a398f01cc6217838cadc", "tidy-ticket-ast-from_token"), + ("compiler/rustc_ast/src/token.rs", "9a78008a2377486eadf19d67ee4fdce2", "tidy-ticket-ast-can_begin_literal_maybe_minus"), + ("compiler/rustc_parse/src/parser/expr.rs", "500240cdc80690209060fdce10ce065a", "tidy-ticket-rustc_parse-can_begin_literal_maybe_minus") + ), + + add_group!( + ("compiler/rustc_builtin_macros/src/assert/context.rs", "de6cc928308947a05a373a355e036f68", "tidy-ticket-all-expr-kinds"), + ("tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs", "78ce54cc25baeac3ae07c876db25180c", "tidy-ticket-all-expr-kinds") + ), + + add_group!( + ("compiler/rustc_const_eval/src/interpret/validity.rs", "91c69e391741f64b7624e1bda4b31bc3", "tidy-ticket-try_visit_primitive"), + ("compiler/rustc_const_eval/src/interpret/validity.rs", "763a70aa04279a7b1cd184b75f79751d", "tidy-ticket-visit_value") + ), + + // sync self-profile-events help mesage with actual list of events + add_group!( + ("compiler/rustc_data_structures/src/profiling.rs", "881e7899c7d6904af1bc000594ee0418", "tidy-ticket-self-profile-events"), + ("compiler/rustc_session/src/options.rs", "012ee5a3b61ee1377744e5c6913fa00a", "tidy-ticket-self-profile-events") + ), + + add_group!( + ("compiler/rustc_errors/src/json.rs", "5907da5c0476785fe2aae4d0d62f7171", "tidy-ticket-UnusedExterns"), + ("src/librustdoc/doctest.rs", "b5bb5128abb4a2dbb47bb1a1a083ba9b", "tidy-ticket-UnusedExterns") + ), + + add_group!( + ("compiler/rustc_middle/src/ty/util.rs", "cae64b1bc854e7ee81894212facb5bfa", "tidy-ticket-static_ptr_ty"), + ("compiler/rustc_middle/src/ty/util.rs", "6f5ead08474b4d3e358db5d3c7aef970", "tidy-ticket-thread_local_ptr_ty") + ), + + add_group!( + ("compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs", "c17706947fc814aa5648972a5b3dc143", "tidy-ticket-arity"), + ("compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs", "7ce77b84c142c22530b047703ef209f0", "tidy-ticket-wildcards") + ), + + add_group!( + ("compiler/rustc_monomorphize/src/partitioning.rs", "f4f33e9c14f4e0c3a20b5240ae36a7c8", "tidy-ticket-short_description"), + ("compiler/rustc_codegen_ssa/src/back/write.rs", "5286f7f76fcf564c98d7a8eaeec39b18", "tidy-ticket-short_description") + ), + + add_group!( + ("compiler/rustc_session/src/config/sigpipe.rs", "8d765a5c613d931852c0f59ed1997dcd", "tidy-ticket-sigpipe"), + ("library/std/src/sys/unix/mod.rs", "2cdc37081831cdcf44f3331efbe440af", "tidy-ticket-sigpipe") + ), + + add_group!( + ("compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs", "6b4ce7c9aa0e799618d53926fb3e9684", "tidy-ticket-extract_tupled_inputs_and_output_from_callable"), + ("compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs", "f1085622f189fc5ec2786e4abff67915", "tidy-ticket-assemble_fn_pointer_candidates") + ), + + add_group!( + ("compiler/rustc_trait_selection/src/solve/eval_ctxt/select.rs", "d0c807d90501f3f63dffc3e7ec046c20", "tidy-ticket-rematch_unsize"), + ("compiler/rustc_trait_selection/src/solve/trait_goals.rs", "f1b0ce28128b5d5a5b545af3f3cf55f4", "tidy-ticket-consider_builtin_unsize_candidate") + ), + + add_group!( + ("compiler/rustc_trait_selection/src/traits/project.rs", "66585f93352fe56a5be6cc5a63bcc756", "tidy-ticket-assemble_candidates_from_impls-UserDefined"), + ("compiler/rustc_ty_utils/src/instance.rs", "5ad30b96493636ba3357448f0b0a4d76", "tidy-ticket-resolve_associated_item-UserDefined") + ), + + add_group!( + ("compiler/rustc_hir_analysis/src/lib.rs", "842e23fb65caf3a96681686131093316", "tidy-ticket-sess-time-item_types_checking"), + ("src/librustdoc/core.rs", "85d9dd0cbb94fd521e2d15a8ed38a75f", "tidy-ticket-sess-time-item_types_checking") + ), + + add_group!( + ("library/core/src/ptr/metadata.rs", "57fc0e05c177c042c9766cc1134ae240", "tidy-ticket-static_assert_expected_bounds_for_metadata"), + ("library/core/tests/ptr.rs", "13ecb32e2a0db0998ff94f33a30f5cfd", "tidy-ticket-static_assert_expected_bounds_for_metadata") + ), +]; + +pub fn check(root_path: &Path, bad: &mut bool) { + for (group_idx, group) in TIDY_WATCH_LIST.iter().enumerate() { + for entry in group.iter() { + check_entry(entry, group_idx, bad, root_path); + } + } +} \ No newline at end of file diff --git a/src/tools/tidy/src/watcher/tests.rs b/src/tools/tidy/src/watcher/tests.rs new file mode 100644 index 0000000000000..1c5d3fbd1ce95 --- /dev/null +++ b/src/tools/tidy/src/watcher/tests.rs @@ -0,0 +1,39 @@ +use super::*; + +#[test] +fn test_span_hash_one_line() { + let source = "some text\ntidy-tag\ncheckme=42\ntidy-tag\n"; + let tag = "tidy-tag"; + assert_eq!("42258eba764c3f94a24de379e5715dc8", span_hash(source, tag, &mut true).unwrap()); +} + +#[test] +fn test_span_hash_multiple_lines() { + let source = "some text\ntidy-tag\ncheckme=42\nother line\ntidy-tag\n"; + let tag = "tidy-tag"; + assert_eq!("49cb23dc2032ceea671ca48092750a1c", span_hash(source, tag, &mut true).unwrap()); +} + +#[test] +fn test_span_hash_has_some_text_in_line_with_tag() { + let source = "some text\ntidy-tag ignore me\ncheckme=42\nother line\ntidy-tag\n"; + let tag = "tidy-tag"; + assert_eq!("49cb23dc2032ceea671ca48092750a1c", span_hash(source, tag, &mut true).unwrap()); +} + +#[test] +fn test_span_hash_has_some_text_in_line_before_second_tag() { + let source = r#" +RUN ./build-clang.sh +ENV CC=clang CXX=clang++ +# tidy-ticket-perf-commit +# rustc-perf version from 2023-05-30 +ENV PERF_COMMIT 8b2ac3042e1ff2c0074455a0a3618adef97156b1 +# tidy-ticket-perf-commit +RUN curl -LS -o perf.zip https://github.com/rust-lang/rustc-perf/archive/$PERF_COMMIT.zip && \ + unzip perf.zip && \ + mv rustc-perf-$PERF_COMMIT rustc-perf && \ + rm perf.zip"#; + let tag = "tidy-ticket-perf-commit"; + assert_eq!("76c8d9783e38e25a461355f82fcd7955", span_hash(source, tag, &mut true).unwrap()); +} \ No newline at end of file From dbc585e758581053d899435d2a78caf93086f0ec Mon Sep 17 00:00:00 2001 From: klensy Date: Fri, 17 Jan 2025 13:50:20 +0300 Subject: [PATCH 2/8] refresh expected ones --- compiler/rustc_ast/src/token.rs | 4 ++ .../src/assert/context.rs | 3 +- compiler/rustc_codegen_ssa/src/back/write.rs | 2 + .../src/interpret/validity.rs | 6 +- .../rustc_data_structures/src/profiling.rs | 2 + compiler/rustc_errors/src/json.rs | 3 + .../rustc_hir_analysis/src/check/region.rs | 1 + compiler/rustc_middle/src/ty/util.rs | 5 ++ .../rustc_monomorphize/src/partitioning.rs | 3 + .../src/solve/assembly/structural_traits.rs | 2 + compiler/rustc_parse/src/parser/expr.rs | 2 + .../rustc_pattern_analysis/src/constructor.rs | 3 + compiler/rustc_session/src/config/cfg.rs | 1 + compiler/rustc_session/src/config/sigpipe.rs | 2 + compiler/rustc_session/src/options.rs | 8 ++- .../src/traits/project.rs | 2 + .../src/traits/select/candidate_assembly.rs | 2 + compiler/rustc_ty_utils/src/instance.rs | 2 + library/alloc/src/boxed.rs | 1 + library/core/src/ptr/metadata.rs | 4 +- library/coretests/tests/ptr.rs | 3 + library/std/src/sys/pal/unix/mod.rs | 2 + src/librustdoc/core.rs | 2 + src/librustdoc/doctest.rs | 2 + src/tools/tidy/src/watcher.rs | 66 ++++++++----------- src/tools/tidy/src/watcher/tests.rs | 2 +- .../all-expr-kinds.rs | 2 + 27 files changed, 93 insertions(+), 44 deletions(-) diff --git a/compiler/rustc_ast/src/token.rs b/compiler/rustc_ast/src/token.rs index 36a7b7d87892f..31053bbcf8188 100644 --- a/compiler/rustc_ast/src/token.rs +++ b/compiler/rustc_ast/src/token.rs @@ -209,6 +209,7 @@ impl Lit { } } + // tidy-keep-sync-with=tidy-ticket-ast-from_token /// Keep this in sync with `Token::can_begin_literal_maybe_minus` excluding unary negation. pub fn from_token(token: &Token) -> Option { match token.uninterpolate().kind { @@ -223,6 +224,7 @@ impl Lit { _ => None, } } + // tidy-keep-sync-with=tidy-ticket-ast-from_token } impl fmt::Display for Lit { @@ -748,6 +750,7 @@ impl Token { /// /// In other words, would this token be a valid start of `parse_literal_maybe_minus`? /// + // tidy-keep-sync-with=tidy-ticket-ast-can_begin_literal_maybe_minus /// Keep this in sync with and `Lit::from_token`, excluding unary negation. pub fn can_begin_literal_maybe_minus(&self) -> bool { match self.uninterpolate().kind { @@ -774,6 +777,7 @@ impl Token { _ => false, } } + // tidy-keep-sync-with=tidy-ticket-ast-can_begin_literal_maybe_minus pub fn can_begin_string_literal(&self) -> bool { match self.uninterpolate().kind { diff --git a/compiler/rustc_builtin_macros/src/assert/context.rs b/compiler/rustc_builtin_macros/src/assert/context.rs index bb9dc651cec25..e192ab748379f 100644 --- a/compiler/rustc_builtin_macros/src/assert/context.rs +++ b/compiler/rustc_builtin_macros/src/assert/context.rs @@ -291,6 +291,7 @@ impl<'cx, 'a> Context<'cx, 'a> { } // Expressions that are not worth or can not be captured. // + // tidy-keep-sync-with=tidy-ticket-all-expr-kinds // Full list instead of `_` to catch possible future inclusions and to // sync with the `rfc-2011-nicer-assert-messages/all-expr-kinds.rs` test. ExprKind::Assign(_, _, _) @@ -323,7 +324,7 @@ impl<'cx, 'a> Context<'cx, 'a> { | ExprKind::Yeet(_) | ExprKind::Become(_) | ExprKind::Yield(_) - | ExprKind::UnsafeBinderCast(..) => {} + | ExprKind::UnsafeBinderCast(..) => {} // tidy-keep-sync-with=tidy-ticket-all-expr-kinds } } diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index ce2161a07ebf6..52fa1806dccee 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -754,6 +754,7 @@ impl WorkItem { } } + // tidy-keep-sync-with=tidy-ticket-short_description /// Generate a short description of this work item suitable for use as a thread name. fn short_description(&self) -> String { // `pthread_setname()` on *nix ignores anything beyond the first 15 @@ -801,6 +802,7 @@ impl WorkItem { WorkItem::LTO(m) => desc("lto", "LTO module", m.name()), } } + // tidy-keep-sync-with=tidy-ticket-short_description } /// A result produced by the backend. diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs index 8e54479874297..70dbeb5f94e1a 100644 --- a/compiler/rustc_const_eval/src/interpret/validity.rs +++ b/compiler/rustc_const_eval/src/interpret/validity.rs @@ -707,6 +707,7 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> { interp_ok(true) } ty::Float(_) | ty::Int(_) | ty::Uint(_) => { + // tidy-keep-sync-with=tidy-ticket-try_visit_primitive // NOTE: Keep this in sync with the array optimization for int/float // types below! self.read_scalar( @@ -722,6 +723,7 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> { self.add_data_range_place(value); } interp_ok(true) + // tidy-keep-sync-with=tidy-ticket-try_visit_primitive } ty::RawPtr(..) => { let place = self.deref_pointer(value, ExpectedKind::RawPtr)?; @@ -1188,9 +1190,10 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValueVisitor<'tcx, M> for ValidityVisitor<'rt, } }; + // tidy-keep-sync-with=tidy-ticket-visit_value // Optimization: we just check the entire range at once. // NOTE: Keep this in sync with the handling of integer and float - // types above, in `visit_primitive`. + // types above, in `try_visit_primitive`. // No need for an alignment check here, this is not an actual memory access. let alloc = self.ecx.get_ptr_alloc(mplace.ptr(), size)?.expect("we already excluded size 0"); @@ -1230,6 +1233,7 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValueVisitor<'tcx, M> for ValidityVisitor<'rt, // Also, mark this as containing data, not padding. self.add_data_range(mplace.ptr(), size); } + // tidy-keep-sync-with=tidy-ticket-visit_value } // Fast path for arrays and slices of ZSTs. We only need to check a single ZST element // of an array and not all of them, because there's only a single value of a specific diff --git a/compiler/rustc_data_structures/src/profiling.rs b/compiler/rustc_data_structures/src/profiling.rs index 18e98e6c39fa9..7e109de67b012 100644 --- a/compiler/rustc_data_structures/src/profiling.rs +++ b/compiler/rustc_data_structures/src/profiling.rs @@ -126,6 +126,7 @@ bitflags::bitflags! { } } +// tidy-keep-sync-with=tidy-ticket-self-profile-events // keep this in sync with the `-Z self-profile-events` help message in rustc_session/options.rs const EVENT_FILTERS_BY_NAME: &[(&str, EventFilter)] = &[ ("none", EventFilter::empty()), @@ -143,6 +144,7 @@ const EVENT_FILTERS_BY_NAME: &[(&str, EventFilter)] = &[ ("incr-result-hashing", EventFilter::INCR_RESULT_HASHING), ("artifact-sizes", EventFilter::ARTIFACT_SIZES), ]; +// tidy-keep-sync-with=tidy-ticket-self-profile-events /// Something that uniquely identifies a query invocation. pub struct QueryInvocationId(pub u32); diff --git a/compiler/rustc_errors/src/json.rs b/compiler/rustc_errors/src/json.rs index 7d7f364fec236..e7dbdc8d80f83 100644 --- a/compiler/rustc_errors/src/json.rs +++ b/compiler/rustc_errors/src/json.rs @@ -275,6 +275,8 @@ struct FutureIncompatReport<'a> { future_incompat_report: Vec>, } +// tidy-keep-sync-with=tidy-ticket-UnusedExterns +// FIXME: where it located in cargo? // NOTE: Keep this in sync with the equivalent structs in rustdoc's // doctest component (as well as cargo). // We could unify this struct the one in rustdoc but they have different @@ -286,6 +288,7 @@ struct UnusedExterns<'a> { /// List of unused externs by their names. unused_extern_names: &'a [&'a str], } +// tidy-keep-sync-with=tidy-ticket-UnusedExterns impl Diagnostic { /// Converts from `rustc_errors::DiagInner` to `Diagnostic`. diff --git a/compiler/rustc_hir_analysis/src/check/region.rs b/compiler/rustc_hir_analysis/src/check/region.rs index d43c65c0023b0..51b318000724f 100644 --- a/compiler/rustc_hir_analysis/src/check/region.rs +++ b/compiler/rustc_hir_analysis/src/check/region.rs @@ -116,6 +116,7 @@ fn resolve_block<'tcx>(visitor: &mut ScopeResolutionVisitor<'tcx>, blk: &'tcx hi visitor.cx.var_parent = visitor.cx.parent; { + // FIXME: sync with exactly where? // This block should be kept approximately in sync with // `intravisit::walk_block`. (We manually walk the block, rather // than call `walk_block`, in order to maintain precise diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs index 6fd0fb9a0a4f0..dc9093e16851c 100644 --- a/compiler/rustc_middle/src/ty/util.rs +++ b/compiler/rustc_middle/src/ty/util.rs @@ -694,6 +694,7 @@ impl<'tcx> TyCtxt<'tcx> { && !self.is_foreign_item(def_id) } + // tidy-keep-sync-with=tidy-ticket-thread_local_ptr_ty /// Returns the type a reference to the thread local takes in MIR. pub fn thread_local_ptr_ty(self, def_id: DefId) -> Ty<'tcx> { let static_ty = self.type_of(def_id).instantiate_identity(); @@ -706,6 +707,7 @@ impl<'tcx> TyCtxt<'tcx> { Ty::new_imm_ref(self, self.lifetimes.re_static, static_ty) } } + // tidy-keep-sync-with=tidy-ticket-thread_local_ptr_ty /// Get the type of the pointer to the static that we use in MIR. pub fn static_ptr_ty(self, def_id: DefId, typing_env: ty::TypingEnv<'tcx>) -> Ty<'tcx> { @@ -713,7 +715,9 @@ impl<'tcx> TyCtxt<'tcx> { let static_ty = self.normalize_erasing_regions(typing_env, self.type_of(def_id).instantiate_identity()); + // tidy-keep-sync-with=tidy-ticket-static_ptr_ty // Make sure that accesses to unsafe statics end up using raw pointers. + // FIXME: should it said sync with thread_local_ptr_ty? // For thread-locals, this needs to be kept in sync with `Rvalue::ty`. if self.is_mutable_static(def_id) { Ty::new_mut_ptr(self, static_ty) @@ -722,6 +726,7 @@ impl<'tcx> TyCtxt<'tcx> { } else { Ty::new_imm_ref(self, self.lifetimes.re_erased, static_ty) } + // tidy-keep-sync-with=tidy-ticket-static_ptr_ty } /// Return the set of types that should be taken into account when checking diff --git a/compiler/rustc_monomorphize/src/partitioning.rs b/compiler/rustc_monomorphize/src/partitioning.rs index 3ef061195da50..9fdc51eb36a88 100644 --- a/compiler/rustc_monomorphize/src/partitioning.rs +++ b/compiler/rustc_monomorphize/src/partitioning.rs @@ -500,6 +500,8 @@ fn merge_codegen_units<'tcx>( codegen_units.sort_by_key(|cgu| cmp::Reverse(cgu.size_estimate())); let num_digits = codegen_units.len().ilog10() as usize + 1; for (index, cgu) in codegen_units.iter_mut().enumerate() { + // tidy-keep-sync-with=tidy-ticket-short_description + // FIXME: is it sync? // Note: `WorkItem::short_description` depends on this name ending // with `-cgu.` followed by a numeric suffix. Please keep it in // sync with this code. @@ -507,6 +509,7 @@ fn merge_codegen_units<'tcx>( let numbered_codegen_unit_name = cgu_name_builder.build_cgu_name_no_mangle(LOCAL_CRATE, &["cgu"], Some(suffix)); cgu.set_name(numbered_codegen_unit_name); + // tidy-keep-sync-with=tidy-ticket-short_description } } } diff --git a/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs b/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs index 3c5d9b95e772d..7aef4a2087748 100644 --- a/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs +++ b/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs @@ -255,6 +255,7 @@ where } } +// tidy-keep-sync-with=tidy-ticket-extract_tupled_inputs_and_output_from_callable // Returns a binder of the tupled inputs types and output type from a builtin callable type. pub(in crate::solve) fn extract_tupled_inputs_and_output_from_callable( cx: I, @@ -393,6 +394,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_callable Parser<'a> { } } + // tidy-keep-sync-with=tidy-ticket-rustc_parse-can_begin_literal_maybe_minus /// Matches `'-' lit | lit` (cf. `ast_validation::AstValidator::check_expr_within_pat`). /// Keep this in sync with `Token::can_begin_literal_maybe_minus`. pub fn parse_literal_maybe_minus(&mut self) -> PResult<'a, P> { @@ -2216,6 +2217,7 @@ impl<'a> Parser<'a> { Ok(expr) } } + // tidy-keep-sync-with=tidy-ticket-rustc_parse-can_begin_literal_maybe_minus fn is_array_like_block(&mut self) -> bool { self.look_ahead(1, |t| matches!(t.kind, TokenKind::Ident(..) | TokenKind::Literal(_))) diff --git a/compiler/rustc_pattern_analysis/src/constructor.rs b/compiler/rustc_pattern_analysis/src/constructor.rs index 4ce868f014f42..d7b59d9b4629d 100644 --- a/compiler/rustc_pattern_analysis/src/constructor.rs +++ b/compiler/rustc_pattern_analysis/src/constructor.rs @@ -782,11 +782,14 @@ impl Constructor { } } + // tidy-keep-sync-with=tidy-ticket-arity /// The number of fields for this constructor. This must be kept in sync with /// `Fields::wildcards`. + // FIXME: this comment long ago desynced pub(crate) fn arity(&self, cx: &Cx, ty: &Cx::Ty) -> usize { cx.ctor_arity(self, ty) } + // tidy-keep-sync-with=tidy-ticket-arity /// Returns whether `self` is covered by `other`, i.e. whether `self` is a subset of `other`. /// For the simple cases, this is simply checking for equality. For the "grouped" constructors, diff --git a/compiler/rustc_session/src/config/cfg.rs b/compiler/rustc_session/src/config/cfg.rs index 4762281c329a7..3862fcb4041a3 100644 --- a/compiler/rustc_session/src/config/cfg.rs +++ b/compiler/rustc_session/src/config/cfg.rs @@ -340,6 +340,7 @@ impl CheckCfg { // The exceptions are where control flow forces things out of order. // // NOTE: This should be kept in sync with `default_configuration`. + // FIXME: what exactly sync there? // Note that symbols inserted conditionally in `default_configuration` // are inserted unconditionally here. // diff --git a/compiler/rustc_session/src/config/sigpipe.rs b/compiler/rustc_session/src/config/sigpipe.rs index 1830ee034855b..c08c5534777a7 100644 --- a/compiler/rustc_session/src/config/sigpipe.rs +++ b/compiler/rustc_session/src/config/sigpipe.rs @@ -1,3 +1,4 @@ +// tidy-keep-sync-with=tidy-ticket-sigpipe //! NOTE: Keep these constants in sync with `library/std/src/sys/pal/unix/mod.rs`! /// The default value if `-Zon-broken-pipe=...` is not specified. This resolves @@ -23,3 +24,4 @@ pub const SIG_IGN: u8 = 2; /// such as `head -n 1`. #[allow(dead_code)] pub const SIG_DFL: u8 = 3; +// tidy-keep-sync-with=tidy-ticket-sigpipe diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 35819f896c5bd..cb2b6e12a2aa1 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -2454,12 +2454,14 @@ written to standard error output)"), `instructions:u` (retired instructions, userspace-only) `instructions-minus-irqs:u` (subtracting hardware interrupt counts for extra accuracy)" ), - /// keep this in sync with the event filter names in librustc_data_structures/profiling.rs + // tidy-keep-sync-with=tidy-ticket-self-profile-events + /// keep this in sync with the event filter names in rustc_data_structures/src/profiling.rs self_profile_events: Option> = (None, parse_opt_comma_list, [UNTRACKED], "specify the events recorded by the self profiler; for example: `-Z self-profile-events=default,query-keys` - all options: none, all, default, generic-activity, query-provider, query-cache-hit - query-blocked, incr-cache-load, incr-result-hashing, query-keys, function-args, args, llvm, artifact-sizes"), + all options: none, all, default, generic-activity, query-provider, query-cache-hit, + query-blocked, incr-cache-load, query-keys, function-args, args, llvm, incr-result-hashing, artifact-sizes"), + // tidy-keep-sync-with=tidy-ticket-self-profile-events share_generics: Option = (None, parse_opt_bool, [TRACKED], "make the current crate share its generic instantiations"), shell_argfiles: bool = (false, parse_bool, [UNTRACKED], diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 537b042bde529..33934a48f2431 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -927,6 +927,7 @@ fn assemble_candidates_from_impls<'cx, 'tcx>( }; let eligible = match &impl_source { + // tidy-keep-sync-with=tidy-ticket-assemble_candidates_from_impls-UserDefined ImplSource::UserDefined(impl_data) => { // We have to be careful when projecting out of an // impl because of specialization. If we are not in @@ -991,6 +992,7 @@ fn assemble_candidates_from_impls<'cx, 'tcx>( Err(ErrorGuaranteed { .. }) => true, } } + // tidy-keep-sync-with=tidy-ticket-assemble_candidates_from_impls-UserDefined ImplSource::Builtin(BuiltinImplSource::Misc | BuiltinImplSource::Trivial, _) => { // While a builtin impl may be known to exist, the associated type may not yet // be known. Any type with multiple potential associated types is therefore diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index 13a6744c2e9b5..f309af613e876 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -503,6 +503,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { } } + // tidy-keep-sync-with=tidy-ticket-assemble_fn_pointer_candidates /// Implements one of the `Fn()` family for a fn pointer. fn assemble_fn_pointer_candidates( &mut self, @@ -542,6 +543,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { _ => {} } } + // tidy-keep-sync-with=tidy-ticket-assemble_fn_pointer_candidates /// Searches for impls that might apply to `obligation`. #[instrument(level = "debug", skip(self, candidates))] diff --git a/compiler/rustc_ty_utils/src/instance.rs b/compiler/rustc_ty_utils/src/instance.rs index 8c6e3c86bf5c8..3df028990feea 100644 --- a/compiler/rustc_ty_utils/src/instance.rs +++ b/compiler/rustc_ty_utils/src/instance.rs @@ -117,6 +117,7 @@ fn resolve_associated_item<'tcx>( // Now that we know which impl is being used, we can dispatch to // the actual function: Ok(match vtbl { + // tidy-keep-sync-with=tidy-ticket-resolve_associated_item-UserDefined traits::ImplSource::UserDefined(impl_data) => { debug!( "resolving ImplSource::UserDefined: {:?}, {:?}, {:?}, {:?}", @@ -230,6 +231,7 @@ fn resolve_associated_item<'tcx>( Some(ty::Instance::new(leaf_def.item.def_id, args)) } + // tidy-keep-sync-with=tidy-ticket-resolve_associated_item-UserDefined traits::ImplSource::Builtin(BuiltinImplSource::Object(_), _) => { let trait_ref = ty::TraitRef::from_method(tcx, trait_id, rcvr_args); if trait_ref.has_non_region_infer() || trait_ref.has_non_region_param() { diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index 8b38e6fc259af..7b61f513c3b89 100644 --- a/library/alloc/src/boxed.rs +++ b/library/alloc/src/boxed.rs @@ -226,6 +226,7 @@ pub use thin::ThinBox; #[stable(feature = "rust1", since = "1.0.0")] #[rustc_insignificant_dtor] #[doc(search_unbox)] +// FIXME: Sync with what? // The declaration of the `Box` struct must be kept in sync with the // compiler or ICEs will happen. pub struct Box< diff --git a/library/core/src/ptr/metadata.rs b/library/core/src/ptr/metadata.rs index e93b5658e2436..869f699bbc382 100644 --- a/library/core/src/ptr/metadata.rs +++ b/library/core/src/ptr/metadata.rs @@ -58,10 +58,12 @@ use crate::ptr::NonNull; pub trait Pointee { /// The type for metadata in pointers and references to `Self`. #[lang = "metadata_type"] + // tidy-keep-sync-with=tidy-ticket-static_assert_expected_bounds_for_metadata // NOTE: Keep trait bounds in `static_assert_expected_bounds_for_metadata` - // in `library/core/src/ptr/metadata.rs` + // in `library/core/tests/ptr.rs` // in sync with those here: type Metadata: fmt::Debug + Copy + Send + Sync + Ord + Hash + Unpin + Freeze; + // tidy-keep-sync-with=tidy-ticket-static_assert_expected_bounds_for_metadata } /// Pointers to types implementing this trait alias are “thin”. diff --git a/library/coretests/tests/ptr.rs b/library/coretests/tests/ptr.rs index 7cefb615d0371..dec89c0f0c60e 100644 --- a/library/coretests/tests/ptr.rs +++ b/library/coretests/tests/ptr.rs @@ -586,12 +586,15 @@ fn ptr_metadata_bounds() { let _ = static_assert_expected_bounds_for_metadata::<::Metadata>; } + // tidy-keep-sync-with=tidy-ticket-static_assert_expected_bounds_for_metadata + // FIXME: should be core::hash::hash? fn static_assert_expected_bounds_for_metadata() where // Keep this in sync with the associated type in `library/core/src/ptr/metadata.rs` Meta: Debug + Copy + Send + Sync + Ord + std::hash::Hash + Unpin + Freeze, { } + // tidy-keep-sync-with=tidy-ticket-static_assert_expected_bounds_for_metadata } #[test] diff --git a/library/std/src/sys/pal/unix/mod.rs b/library/std/src/sys/pal/unix/mod.rs index 6862399b9425c..9176d6c90cc7d 100644 --- a/library/std/src/sys/pal/unix/mod.rs +++ b/library/std/src/sys/pal/unix/mod.rs @@ -164,6 +164,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { target_vendor = "unikraft", )))] { + // tidy-keep-sync-with=tidy-ticket-sigpipe // We don't want to add this as a public type to std, nor do we // want to `include!` a file from the compiler (which would break // Miri and xargo for example), so we choose to duplicate these @@ -176,6 +177,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { pub const SIG_IGN: u8 = 2; pub const SIG_DFL: u8 = 3; } + // tidy-keep-sync-with=tidy-ticket-sigpipe let (sigpipe_attr_specified, handler) = match sigpipe { sigpipe::DEFAULT => (false, Some(libc::SIG_IGN)), diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 5c146da03acc7..5b87bdaf2fef6 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -333,10 +333,12 @@ pub(crate) fn run_global_ctxt( // typeck function bodies or run the default rustc lints. // (see `override_queries` in the `config`) + // tidy-keep-sync-with=tidy-ticket-sess-time-item_types_checking // NOTE: These are copy/pasted from typeck/lib.rs and should be kept in sync with those changes. let _ = tcx.sess.time("wf_checking", || { tcx.hir().try_par_for_each_module(|module| tcx.ensure_ok().check_mod_type_wf(module)) }); + // tidy-keep-sync-with=tidy-ticket-sess-time-item_types_checking tcx.dcx().abort_if_errors(); diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 8b522e614b813..70890728425f1 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -464,6 +464,7 @@ impl DirState { } } +// tidy-keep-sync-with=tidy-ticket-UnusedExterns // NOTE: Keep this in sync with the equivalent structs in rustc // and cargo. // We could unify this struct the one in rustc but they have different @@ -475,6 +476,7 @@ pub(crate) struct UnusedExterns { /// List of unused externs by their names. unused_extern_names: Vec, } +// tidy-keep-sync-with=tidy-ticket-UnusedExterns fn add_exe_suffix(input: String, target: &TargetTuple) -> String { let exe_suffix = match target { diff --git a/src/tools/tidy/src/watcher.rs b/src/tools/tidy/src/watcher.rs index 199f19c7137cc..ec3c27656e37d 100644 --- a/src/tools/tidy/src/watcher.rs +++ b/src/tools/tidy/src/watcher.rs @@ -14,10 +14,11 @@ //! # tidy-ticket-foo //! export FOO=42 //! # tidy-ticket-foo -use md5::{Digest, Md5}; use std::fs; use std::path::Path; +use md5::{Digest, Md5}; + #[cfg(test)] mod tests; @@ -100,26 +101,20 @@ type ListEntry<'a> = (&'a str, &'a str, &'a str); /// List of tags to watch, along with paths and hashes #[rustfmt::skip] const TIDY_WATCH_LIST: &[&[ListEntry<'_>]] = &[ - // sync perf commit across dockerfile and opt-dist add_group!( - ("src/tools/opt-dist/src/main.rs", "f99844fda86216628167cd3391844ed1", "tidy-ticket-perf-commit"), - ("src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile", "fa9a88e552735e9f93934501e9c8d87a", "tidy-ticket-perf-commit") + ("compiler/rustc_ast/src/token.rs", "2df3e863dc4caffb31a7ddf001517232", "tidy-ticket-ast-from_token"), + ("compiler/rustc_ast/src/token.rs", "3279df5da05e0455f45630917fe2a797", "tidy-ticket-ast-can_begin_literal_maybe_minus"), + ("compiler/rustc_parse/src/parser/expr.rs", "479655a8587512fc26f7361d7bbd75a5", "tidy-ticket-rustc_parse-can_begin_literal_maybe_minus") ), add_group!( - ("compiler/rustc_ast/src/token.rs", "0f6ba78f1007a398f01cc6217838cadc", "tidy-ticket-ast-from_token"), - ("compiler/rustc_ast/src/token.rs", "9a78008a2377486eadf19d67ee4fdce2", "tidy-ticket-ast-can_begin_literal_maybe_minus"), - ("compiler/rustc_parse/src/parser/expr.rs", "500240cdc80690209060fdce10ce065a", "tidy-ticket-rustc_parse-can_begin_literal_maybe_minus") - ), - - add_group!( - ("compiler/rustc_builtin_macros/src/assert/context.rs", "de6cc928308947a05a373a355e036f68", "tidy-ticket-all-expr-kinds"), + ("compiler/rustc_builtin_macros/src/assert/context.rs", "dbac73cc47a451d4822ccd3010c40a0f", "tidy-ticket-all-expr-kinds"), ("tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs", "78ce54cc25baeac3ae07c876db25180c", "tidy-ticket-all-expr-kinds") ), add_group!( - ("compiler/rustc_const_eval/src/interpret/validity.rs", "91c69e391741f64b7624e1bda4b31bc3", "tidy-ticket-try_visit_primitive"), - ("compiler/rustc_const_eval/src/interpret/validity.rs", "763a70aa04279a7b1cd184b75f79751d", "tidy-ticket-visit_value") + ("compiler/rustc_const_eval/src/interpret/validity.rs", "c4e96ecd3f81dcb54541b8ea41042e8f", "tidy-ticket-try_visit_primitive"), + ("compiler/rustc_const_eval/src/interpret/validity.rs", "cbe69005510c1a87ab07db601c0d36b8", "tidy-ticket-visit_value") ), // sync self-profile-events help mesage with actual list of events @@ -129,8 +124,8 @@ const TIDY_WATCH_LIST: &[&[ListEntry<'_>]] = &[ ), add_group!( - ("compiler/rustc_errors/src/json.rs", "5907da5c0476785fe2aae4d0d62f7171", "tidy-ticket-UnusedExterns"), - ("src/librustdoc/doctest.rs", "b5bb5128abb4a2dbb47bb1a1a083ba9b", "tidy-ticket-UnusedExterns") + ("compiler/rustc_errors/src/json.rs", "3963a8c4eee7f87eeb076622b8a92891", "tidy-ticket-UnusedExterns"), + ("src/librustdoc/doctest.rs", "14da85663568149c9b21686f4b7fa7b0", "tidy-ticket-UnusedExterns") ), add_group!( @@ -138,10 +133,11 @@ const TIDY_WATCH_LIST: &[&[ListEntry<'_>]] = &[ ("compiler/rustc_middle/src/ty/util.rs", "6f5ead08474b4d3e358db5d3c7aef970", "tidy-ticket-thread_local_ptr_ty") ), - add_group!( - ("compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs", "c17706947fc814aa5648972a5b3dc143", "tidy-ticket-arity"), - ("compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs", "7ce77b84c142c22530b047703ef209f0", "tidy-ticket-wildcards") - ), + // desynced, pieces in compiler/rustc_pattern_analysis/src/rustc.rs + // add_group!( + // ("compiler/rustc_pattern_analysis/src/constructor.rs", "c17706947fc814aa5648972a5b3dc143", "tidy-ticket-arity"), + // // ("compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs", "7ce77b84c142c22530b047703ef209f0", "tidy-ticket-wildcards") + // ), add_group!( ("compiler/rustc_monomorphize/src/partitioning.rs", "f4f33e9c14f4e0c3a20b5240ae36a7c8", "tidy-ticket-short_description"), @@ -149,33 +145,29 @@ const TIDY_WATCH_LIST: &[&[ListEntry<'_>]] = &[ ), add_group!( - ("compiler/rustc_session/src/config/sigpipe.rs", "8d765a5c613d931852c0f59ed1997dcd", "tidy-ticket-sigpipe"), - ("library/std/src/sys/unix/mod.rs", "2cdc37081831cdcf44f3331efbe440af", "tidy-ticket-sigpipe") + ("compiler/rustc_session/src/config/sigpipe.rs", "330e0776ba5a6c0a7439a5235297f08f", "tidy-ticket-sigpipe"), + ("library/std/src/sys/pal/unix/mod.rs", "2cdc37081831cdcf44f3331efbe440af", "tidy-ticket-sigpipe") ), add_group!( - ("compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs", "6b4ce7c9aa0e799618d53926fb3e9684", "tidy-ticket-extract_tupled_inputs_and_output_from_callable"), - ("compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs", "f1085622f189fc5ec2786e4abff67915", "tidy-ticket-assemble_fn_pointer_candidates") + ("compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs", "8726918d084e0ac5bb07184008403f88", "tidy-ticket-extract_tupled_inputs_and_output_from_callable"), + ("compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs", "be2967d323633c7458533c6cec228273", "tidy-ticket-assemble_fn_pointer_candidates") ), add_group!( - ("compiler/rustc_trait_selection/src/solve/eval_ctxt/select.rs", "d0c807d90501f3f63dffc3e7ec046c20", "tidy-ticket-rematch_unsize"), - ("compiler/rustc_trait_selection/src/solve/trait_goals.rs", "f1b0ce28128b5d5a5b545af3f3cf55f4", "tidy-ticket-consider_builtin_unsize_candidate") + ("compiler/rustc_trait_selection/src/traits/project.rs", "262d10feb1b7ba8d3ffb4a95314bf404", "tidy-ticket-assemble_candidates_from_impls-UserDefined"), + ("compiler/rustc_ty_utils/src/instance.rs", "a51a6022efb405c5ee86acdf49ec222d", "tidy-ticket-resolve_associated_item-UserDefined") ), - add_group!( - ("compiler/rustc_trait_selection/src/traits/project.rs", "66585f93352fe56a5be6cc5a63bcc756", "tidy-ticket-assemble_candidates_from_impls-UserDefined"), - ("compiler/rustc_ty_utils/src/instance.rs", "5ad30b96493636ba3357448f0b0a4d76", "tidy-ticket-resolve_associated_item-UserDefined") - ), + // desynced, pieces in compiler/rustc_hir_analysis/src/lib.rs missing? + //add_group!( // bad + // ("compiler/rustc_hir_analysis/src/lib.rs", "842e23fb65caf3a96681686131093316", "tidy-ticket-sess-time-item_types_checking"), + // ("src/librustdoc/core.rs", "85d9dd0cbb94fd521e2d15a8ed38a75f", "tidy-ticket-sess-time-item_types_checking") + // ), add_group!( - ("compiler/rustc_hir_analysis/src/lib.rs", "842e23fb65caf3a96681686131093316", "tidy-ticket-sess-time-item_types_checking"), - ("src/librustdoc/core.rs", "85d9dd0cbb94fd521e2d15a8ed38a75f", "tidy-ticket-sess-time-item_types_checking") - ), - - add_group!( - ("library/core/src/ptr/metadata.rs", "57fc0e05c177c042c9766cc1134ae240", "tidy-ticket-static_assert_expected_bounds_for_metadata"), - ("library/core/tests/ptr.rs", "13ecb32e2a0db0998ff94f33a30f5cfd", "tidy-ticket-static_assert_expected_bounds_for_metadata") + ("library/core/src/ptr/metadata.rs", "357c958a096c33bed67cfc7212d940a2", "tidy-ticket-static_assert_expected_bounds_for_metadata"), + ("library/core/tests/ptr.rs", "d8c47e54b871d72dfdce56e6a89b5c31", "tidy-ticket-static_assert_expected_bounds_for_metadata") ), ]; @@ -185,4 +177,4 @@ pub fn check(root_path: &Path, bad: &mut bool) { check_entry(entry, group_idx, bad, root_path); } } -} \ No newline at end of file +} diff --git a/src/tools/tidy/src/watcher/tests.rs b/src/tools/tidy/src/watcher/tests.rs index 1c5d3fbd1ce95..d0b8cb7e8646f 100644 --- a/src/tools/tidy/src/watcher/tests.rs +++ b/src/tools/tidy/src/watcher/tests.rs @@ -36,4 +36,4 @@ RUN curl -LS -o perf.zip https://github.com/rust-lang/rustc-perf/archive/$PERF_C rm perf.zip"#; let tag = "tidy-ticket-perf-commit"; assert_eq!("76c8d9783e38e25a461355f82fcd7955", span_hash(source, tag, &mut true).unwrap()); -} \ No newline at end of file +} diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs b/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs index de7dbb9052edb..268db0bfef906 100644 --- a/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs +++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs @@ -7,6 +7,7 @@ #![allow(path_statements, unused_allocation)] #![feature(core_intrinsics, generic_assert)] +// tidy-keep-sync-with=tidy-ticket-all-expr-kinds macro_rules! test { ( let mut $elem_ident:ident = $elem_expr:expr; @@ -118,3 +119,4 @@ fn main() { [ -elem == -3 ] => "Assertion failed: -elem == -3\nWith captures:\n elem = 1\n" ); } +// tidy-keep-sync-with=tidy-ticket-all-expr-kinds From 37de85785158c38b3a3729cf19ba3810436596bf Mon Sep 17 00:00:00 2001 From: klensy Date: Fri, 17 Jan 2025 14:07:53 +0300 Subject: [PATCH 3/8] add fixmes --- compiler/rustc_codegen_ssa/src/codegen_attrs.rs | 1 + compiler/rustc_errors/src/emitter.rs | 1 + compiler/rustc_metadata/src/native_libs.rs | 1 + compiler/rustc_middle/src/dep_graph/dep_node.rs | 2 ++ compiler/rustc_middle/src/mir/terminator.rs | 2 ++ compiler/rustc_middle/src/ty/instance.rs | 2 ++ compiler/rustc_middle/src/ty/predicate.rs | 1 + compiler/rustc_mir_transform/src/coverage/query.rs | 1 + compiler/rustc_mir_transform/src/mentioned_items.rs | 1 + .../src/solve/assembly/structural_traits.rs | 1 + compiler/rustc_session/src/config/cfg.rs | 1 + compiler/rustc_span/src/lib.rs | 1 + compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs | 1 + compiler/rustc_trait_selection/src/traits/effects.rs | 1 + library/core/src/panicking.rs | 2 ++ 15 files changed, 19 insertions(+) diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs index 4166387dad0c5..584eeab551e83 100644 --- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs +++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs @@ -292,6 +292,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { // // This exception needs to be kept in sync with allowing // `#[target_feature]` on `main` and `start`. + // FIXME: sync me } else if !tcx.features().target_feature_11() { feature_err( &tcx.sess, diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 15cf285e7ffc3..0bb3509f9c94e 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -3186,6 +3186,7 @@ fn num_decimal_digits(num: usize) -> usize { // We replace some characters so the CLI output is always consistent and underlines aligned. // Keep the following list in sync with `rustc_span::char_width`. +// FIXME: sync me const OUTPUT_REPLACEMENTS: &[(char, &str)] = &[ // In terminals without Unicode support the following will be garbled, but in *all* terminals // the underlying codepoint will be as well. We could gate this replacement behind a "unicode diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index 2a1e4b261e737..8a3664dda233d 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -57,6 +57,7 @@ pub fn walk_native_lib_search_dirs( // FIXME: On AIX this also has the side-effect of making the list of library search paths // non-empty, which is needed or the linker may decide to record the LIBPATH env, if // defined, as the search path instead of appending the default search paths. + // FIXME: sync me if sess.target.vendor == "fortanix" || sess.target.os == "linux" || sess.target.os == "fuchsia" diff --git a/compiler/rustc_middle/src/dep_graph/dep_node.rs b/compiler/rustc_middle/src/dep_graph/dep_node.rs index 7525aeb922729..cf1510e0c49d8 100644 --- a/compiler/rustc_middle/src/dep_graph/dep_node.rs +++ b/compiler/rustc_middle/src/dep_graph/dep_node.rs @@ -28,6 +28,7 @@ macro_rules! define_dep_nodes { // struct, and there we can take advantage of the unused bits in the u16. #[allow(non_camel_case_types)] #[repr(u16)] // Must be kept in sync with the inner type of `DepKind`. + // FIXME: sync me enum DepKindDefs { $( $( #[$attr] )* $variant),* } @@ -38,6 +39,7 @@ macro_rules! define_dep_nodes { $( // The `as u16` cast must be kept in sync with the inner type of `DepKind`. + // FIXME: sync me pub const $variant: DepKind = DepKind::new(DepKindDefs::$variant as u16); )* } diff --git a/compiler/rustc_middle/src/mir/terminator.rs b/compiler/rustc_middle/src/mir/terminator.rs index 2fe116212eb52..59dd1e5e0d173 100644 --- a/compiler/rustc_middle/src/mir/terminator.rs +++ b/compiler/rustc_middle/src/mir/terminator.rs @@ -136,6 +136,7 @@ impl UnwindAction { impl UnwindTerminateReason { pub fn as_str(self) -> &'static str { // Keep this in sync with the messages in `core/src/panicking.rs`. + // FIXME: sync me match self { UnwindTerminateReason::Abi => "panic in a function that cannot unwind", UnwindTerminateReason::InCleanup => "panic in a destructor during cleanup", @@ -306,6 +307,7 @@ impl AssertKind { /// `AssertKind::panic_function` and the lang items mentioned in its docs). /// Note that we deliberately show more details here than we do at runtime, such as the actual /// numbers that overflowed -- it is much easier to do so here than at runtime. + // FIXME: sync me pub fn diagnostic_message(&self) -> DiagMessage { use AssertKind::*; diff --git a/compiler/rustc_middle/src/ty/instance.rs b/compiler/rustc_middle/src/ty/instance.rs index b7a648aae3f19..6411389ed6348 100644 --- a/compiler/rustc_middle/src/ty/instance.rs +++ b/compiler/rustc_middle/src/ty/instance.rs @@ -900,6 +900,7 @@ impl<'tcx> Instance<'tcx> { #[inline(always)] // Keep me in sync with try_instantiate_mir_and_normalize_erasing_regions + // FIXME: sync me pub fn instantiate_mir_and_normalize_erasing_regions( &self, tcx: TyCtxt<'tcx>, @@ -918,6 +919,7 @@ impl<'tcx> Instance<'tcx> { #[inline(always)] // Keep me in sync with instantiate_mir_and_normalize_erasing_regions + // FIXME: sync me pub fn try_instantiate_mir_and_normalize_erasing_regions( &self, tcx: TyCtxt<'tcx>, diff --git a/compiler/rustc_middle/src/ty/predicate.rs b/compiler/rustc_middle/src/ty/predicate.rs index 584cac22ae8dd..a23c5abddb676 100644 --- a/compiler/rustc_middle/src/ty/predicate.rs +++ b/compiler/rustc_middle/src/ty/predicate.rs @@ -138,6 +138,7 @@ impl<'tcx> Predicate<'tcx> { /// unsoundly accept some programs. See #91068. #[inline] pub fn allow_normalization(self) -> bool { + // FIXME: sync me // Keep this in sync with the one in `rustc_type_ir::inherent`! match self.kind().skip_binder() { PredicateKind::Clause(ClauseKind::WellFormed(_)) diff --git a/compiler/rustc_mir_transform/src/coverage/query.rs b/compiler/rustc_mir_transform/src/coverage/query.rs index a849ed4c3e27c..7984389ef400f 100644 --- a/compiler/rustc_mir_transform/src/coverage/query.rs +++ b/compiler/rustc_mir_transform/src/coverage/query.rs @@ -101,6 +101,7 @@ fn coverage_ids_info<'tcx>( // to any particular point in the control-flow graph. // (Keep this in sync with the injection of `ExpressionUsed` // statements in the `InstrumentCoverage` MIR pass.) + // FIXME: sync me if let MappingKind::Code(CovTerm::Expression(id)) = mapping.kind { expressions_seen.remove(id); } diff --git a/compiler/rustc_mir_transform/src/mentioned_items.rs b/compiler/rustc_mir_transform/src/mentioned_items.rs index f5c57418467a1..18da264d1decf 100644 --- a/compiler/rustc_mir_transform/src/mentioned_items.rs +++ b/compiler/rustc_mir_transform/src/mentioned_items.rs @@ -37,6 +37,7 @@ impl<'tcx> crate::MirPass<'tcx> for MentionedItems { // visiting the exact same places but then instead of monomorphizing and creating `MonoItems`, we // have to remain generic and just recording the relevant information in `mentioned_items`, where it // will then be monomorphized later during "mentioned items" collection. +// FIXME: sync me impl<'tcx> Visitor<'tcx> for MentionedItemsVisitor<'_, 'tcx> { fn visit_terminator(&mut self, terminator: &mir::Terminator<'tcx>, location: Location) { self.super_terminator(terminator, location); diff --git a/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs b/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs index 7aef4a2087748..6f2918100eacf 100644 --- a/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs +++ b/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs @@ -716,6 +716,7 @@ pub(in crate::solve) fn extract_fn_def_from_const_callable( // NOTE: Keep this in sync with `evaluate_host_effect_for_destruct_goal` in // the old solver, for as long as that exists. +// FIXME: sync me pub(in crate::solve) fn const_conditions_for_destruct( cx: I, self_ty: I::Ty, diff --git a/compiler/rustc_session/src/config/cfg.rs b/compiler/rustc_session/src/config/cfg.rs index 3862fcb4041a3..7c68dee8c2be9 100644 --- a/compiler/rustc_session/src/config/cfg.rs +++ b/compiler/rustc_session/src/config/cfg.rs @@ -177,6 +177,7 @@ pub(crate) fn default_configuration(sess: &Session) -> Cfg { // // NOTE: These insertions should be kept in sync with // `CheckCfg::fill_well_known` below. + // FIXME: sync me if sess.opts.debug_assertions { ins_none!(sym::debug_assertions); diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index 0e146baef3751..cc8240124e1fc 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -2276,6 +2276,7 @@ pub fn char_width(ch: char) -> usize { // Keep the following list in sync with `rustc_errors::emitter::OUTPUT_REPLACEMENTS`. These // are control points that we replace before printing with a visible codepoint for the sake // of being able to point at them with underlines. + // FIXME: sync me '\u{0000}' | '\u{0001}' | '\u{0002}' | '\u{0003}' | '\u{0004}' | '\u{0005}' | '\u{0006}' | '\u{0007}' | '\u{0008}' | '\u{000B}' | '\u{000C}' | '\u{000D}' | '\u{000E}' | '\u{000F}' | '\u{0010}' | '\u{0011}' | '\u{0012}' | '\u{0013}' diff --git a/compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs b/compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs index 617bc87a9d23c..8c2c87efdab9c 100644 --- a/compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs +++ b/compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs @@ -428,6 +428,7 @@ fn virtual_call_violations_for_method<'tcx>( } else { // We confirm that the `receiver_is_dispatchable` is accurate later, // see `check_receiver_correct`. It should be kept in sync with this code. + // FIXME: sync me } } diff --git a/compiler/rustc_trait_selection/src/traits/effects.rs b/compiler/rustc_trait_selection/src/traits/effects.rs index b32909efe0be7..2b0cdec016596 100644 --- a/compiler/rustc_trait_selection/src/traits/effects.rs +++ b/compiler/rustc_trait_selection/src/traits/effects.rs @@ -245,6 +245,7 @@ fn evaluate_host_effect_from_builtin_impls<'tcx>( } // NOTE: Keep this in sync with `const_conditions_for_destruct` in the new solver. +// FIXME: sync me fn evaluate_host_effect_for_destruct_goal<'tcx>( selcx: &mut SelectionContext<'_, 'tcx>, obligation: &HostEffectObligation<'tcx>, diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs index a89de12c02bdc..66f489160c966 100644 --- a/library/core/src/panicking.rs +++ b/library/core/src/panicking.rs @@ -320,6 +320,7 @@ fn panic_null_pointer_dereference() -> ! { #[rustc_nounwind] fn panic_cannot_unwind() -> ! { // Keep the text in sync with `UnwindTerminateReason::as_str` in `rustc_middle`. + // FIXME: sync me panic_nounwind("panic in a function that cannot unwind") } @@ -336,6 +337,7 @@ fn panic_cannot_unwind() -> ! { #[rustc_nounwind] fn panic_in_cleanup() -> ! { // Keep the text in sync with `UnwindTerminateReason::as_str` in `rustc_middle`. + // FIXME: sync me panic_nounwind_nobacktrace("panic in a destructor during cleanup") } From 829b88da6e310434e039940edaf9d0e9ce608985 Mon Sep 17 00:00:00 2001 From: klensy Date: Fri, 17 Jan 2025 18:07:05 +0300 Subject: [PATCH 4/8] impl deser from config for watcher impl bless --- Cargo.lock | 2 + src/tools/tidy/Cargo.toml | 6 +- src/tools/tidy/src/main.rs | 2 +- src/tools/tidy/src/watcher.rs | 184 ++++++++++++------------ src/tools/tidy/src/watcher_list.json | 206 +++++++++++++++++++++++++++ 5 files changed, 303 insertions(+), 97 deletions(-) create mode 100644 src/tools/tidy/src/watcher_list.json diff --git a/Cargo.lock b/Cargo.lock index 14e652ee6622b..bae87304b4f26 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5435,6 +5435,8 @@ dependencies = [ "rustc-hash 2.1.0", "semver", "serde", + "serde_derive", + "serde_json", "similar", "termcolor", "walkdir", diff --git a/src/tools/tidy/Cargo.toml b/src/tools/tidy/Cargo.toml index 50bd8b01dc7cb..a214d62e4b7e3 100644 --- a/src/tools/tidy/Cargo.toml +++ b/src/tools/tidy/Cargo.toml @@ -12,15 +12,17 @@ miropt-test-tools = { path = "../miropt-test-tools" } walkdir = "2" ignore = "0.4.18" semver = "1.0" -serde = { version = "1.0.125", features = ["derive"], optional = true } +serde = { version = "1.0.125" } termcolor = "1.1.3" rustc-hash = "2.0.0" fluent-syntax = "0.11.1" similar = "2.5.0" md-5 = "0.10" +serde_derive = "1" +serde_json = "1" [features] -build-metrics = ["dep:serde"] +build-metrics = [] [[bin]] name = "rust-tidy" diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index 8c74ed36994f7..04b04b986648f 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -146,7 +146,7 @@ fn main() { check!(x_version, &root_path, &cargo); - check!(watcher, &root_path); + check!(watcher, &root_path, bless); let collected = { drain_handles(&mut handles); diff --git a/src/tools/tidy/src/watcher.rs b/src/tools/tidy/src/watcher.rs index ec3c27656e37d..9e5a255d9202d 100644 --- a/src/tools/tidy/src/watcher.rs +++ b/src/tools/tidy/src/watcher.rs @@ -15,23 +15,62 @@ //! export FOO=42 //! # tidy-ticket-foo use std::fs; -use std::path::Path; +use std::fs::OpenOptions; +use std::path::{Path, PathBuf}; use md5::{Digest, Md5}; +use serde::{Deserialize, Serialize}; +use serde_json; #[cfg(test)] mod tests; +#[derive(Deserialize, Serialize, Debug)] +struct TagGroups { + tag_groups: Vec, +} + +#[derive(Deserialize, Serialize, Debug)] +struct TagGroup { + name: String, + #[serde(skip_serializing_if = "is_false")] + #[serde(default)] + /// if group sync in broken but you don't want to remove it + is_off: bool, + tags: Vec, +} + +#[derive(Deserialize, Serialize, Debug)] +struct Tag { + /// path to file + path: PathBuf, + /// md5 tag of tag content + hash: String, + /// tag string + tag: String, +} + +fn is_false(b: &bool) -> bool { + !b +} + /// Return hash for source text between 2 tag occurrence, /// ignoring lines where tag written /// /// Expecting: /// tag is not multiline /// source always have at least 2 occurrence of tag (>2 ignored) -fn span_hash(source: &str, tag: &str, bad: &mut bool) -> Result { +fn span_hash(source: &str, tag: &str, bad: &mut bool, file_path: &Path) -> Result { let start_idx = match source.find(tag) { Some(idx) => idx, - None => return Err(tidy_error!(bad, "tag {} should exist in provided text", tag)), + None => { + return Err(tidy_error!( + bad, + "tag {} should exist in file {}", + tag, + file_path.display() + )); + } }; let end_idx = { let end = match source[start_idx + tag.len()..].find(tag) { @@ -61,120 +100,77 @@ fn span_hash(source: &str, tag: &str, bad: &mut bool) -> Result { Ok(format!("{:x}", hasher.finalize())) } -fn check_entry(entry: &ListEntry<'_>, group_idx: usize, bad: &mut bool, root_path: &Path) { - let file = fs::read_to_string(root_path.join(Path::new(entry.0))) - .unwrap_or_else(|e| panic!("{:?}, path: {}", e, entry.0)); - let actual_hash = span_hash(&file, entry.2, bad).unwrap(); - if actual_hash != entry.1 { - // Write tidy error description for wather only once. - // Will not work if there was previous errors of other types. - if *bad == false { - tidy_error!( - bad, - "The code blocks tagged with tidy watcher has changed.\n\ +fn check_entry( + entry: &mut Tag, + tag_group_name: &str, + bad: &mut bool, + root_path: &Path, + bless: bool, +) { + let file_path = root_path.join(Path::new(&entry.path)); + let file = fs::read_to_string(&file_path) + .unwrap_or_else(|e| panic!("{:?}, path: {}", e, entry.path.display())); + let actual_hash = span_hash(&file, &entry.tag, bad, &file_path).unwrap(); + if actual_hash != entry.hash { + if !bless { + // Write tidy error description for watcher only once. + // Will not work if there was previous errors of other types. + if *bad == false { + tidy_error!( + bad, + "The code blocks tagged with tidy watcher has changed.\n\ It's likely that code blocks with the following tags need to be changed too. Check src/tools/tidy/src/watcher.rs, find tag/hash in TIDY_WATCH_LIST list \ and verify that sources for provided group of tags in sync. Once that done, run tidy again and update hashes in TIDY_WATCH_LIST with provided actual hashes." - ) + ) + } + tidy_error!( + bad, + "hash for tag `{}` in path `{}` mismatch:\n actual: `{}`, expected: `{}`\n \ + Verify that tags from tag_group `{}` in sync.", + entry.tag, + entry.path.display(), + actual_hash, + entry.hash, + tag_group_name, + ); + } else { + entry.hash = actual_hash; } - tidy_error!( - bad, - "hash for tag `{}` in path `{}` mismatch:\n actual: `{}`, expected: `{}`\n \ - Verify that tags `{:?}` in sync.", - entry.2, - entry.0, - actual_hash, - entry.1, - TIDY_WATCH_LIST[group_idx].iter().map(|e| e.2).collect::>() - ); } } -macro_rules! add_group { - ($($entry:expr),*) => { - &[$($entry),*] - }; -} - -/// (path, hash, tag) -type ListEntry<'a> = (&'a str, &'a str, &'a str); - -/// List of tags to watch, along with paths and hashes -#[rustfmt::skip] -const TIDY_WATCH_LIST: &[&[ListEntry<'_>]] = &[ - add_group!( - ("compiler/rustc_ast/src/token.rs", "2df3e863dc4caffb31a7ddf001517232", "tidy-ticket-ast-from_token"), - ("compiler/rustc_ast/src/token.rs", "3279df5da05e0455f45630917fe2a797", "tidy-ticket-ast-can_begin_literal_maybe_minus"), - ("compiler/rustc_parse/src/parser/expr.rs", "479655a8587512fc26f7361d7bbd75a5", "tidy-ticket-rustc_parse-can_begin_literal_maybe_minus") - ), - - add_group!( - ("compiler/rustc_builtin_macros/src/assert/context.rs", "dbac73cc47a451d4822ccd3010c40a0f", "tidy-ticket-all-expr-kinds"), - ("tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs", "78ce54cc25baeac3ae07c876db25180c", "tidy-ticket-all-expr-kinds") - ), - - add_group!( - ("compiler/rustc_const_eval/src/interpret/validity.rs", "c4e96ecd3f81dcb54541b8ea41042e8f", "tidy-ticket-try_visit_primitive"), - ("compiler/rustc_const_eval/src/interpret/validity.rs", "cbe69005510c1a87ab07db601c0d36b8", "tidy-ticket-visit_value") - ), - +/* // sync self-profile-events help mesage with actual list of events add_group!( ("compiler/rustc_data_structures/src/profiling.rs", "881e7899c7d6904af1bc000594ee0418", "tidy-ticket-self-profile-events"), ("compiler/rustc_session/src/options.rs", "012ee5a3b61ee1377744e5c6913fa00a", "tidy-ticket-self-profile-events") ), - add_group!( - ("compiler/rustc_errors/src/json.rs", "3963a8c4eee7f87eeb076622b8a92891", "tidy-ticket-UnusedExterns"), - ("src/librustdoc/doctest.rs", "14da85663568149c9b21686f4b7fa7b0", "tidy-ticket-UnusedExterns") - ), - - add_group!( - ("compiler/rustc_middle/src/ty/util.rs", "cae64b1bc854e7ee81894212facb5bfa", "tidy-ticket-static_ptr_ty"), - ("compiler/rustc_middle/src/ty/util.rs", "6f5ead08474b4d3e358db5d3c7aef970", "tidy-ticket-thread_local_ptr_ty") - ), - // desynced, pieces in compiler/rustc_pattern_analysis/src/rustc.rs // add_group!( // ("compiler/rustc_pattern_analysis/src/constructor.rs", "c17706947fc814aa5648972a5b3dc143", "tidy-ticket-arity"), // // ("compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs", "7ce77b84c142c22530b047703ef209f0", "tidy-ticket-wildcards") // ), - add_group!( - ("compiler/rustc_monomorphize/src/partitioning.rs", "f4f33e9c14f4e0c3a20b5240ae36a7c8", "tidy-ticket-short_description"), - ("compiler/rustc_codegen_ssa/src/back/write.rs", "5286f7f76fcf564c98d7a8eaeec39b18", "tidy-ticket-short_description") - ), - - add_group!( - ("compiler/rustc_session/src/config/sigpipe.rs", "330e0776ba5a6c0a7439a5235297f08f", "tidy-ticket-sigpipe"), - ("library/std/src/sys/pal/unix/mod.rs", "2cdc37081831cdcf44f3331efbe440af", "tidy-ticket-sigpipe") - ), - - add_group!( - ("compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs", "8726918d084e0ac5bb07184008403f88", "tidy-ticket-extract_tupled_inputs_and_output_from_callable"), - ("compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs", "be2967d323633c7458533c6cec228273", "tidy-ticket-assemble_fn_pointer_candidates") - ), - - add_group!( - ("compiler/rustc_trait_selection/src/traits/project.rs", "262d10feb1b7ba8d3ffb4a95314bf404", "tidy-ticket-assemble_candidates_from_impls-UserDefined"), - ("compiler/rustc_ty_utils/src/instance.rs", "a51a6022efb405c5ee86acdf49ec222d", "tidy-ticket-resolve_associated_item-UserDefined") - ), - // desynced, pieces in compiler/rustc_hir_analysis/src/lib.rs missing? //add_group!( // bad // ("compiler/rustc_hir_analysis/src/lib.rs", "842e23fb65caf3a96681686131093316", "tidy-ticket-sess-time-item_types_checking"), // ("src/librustdoc/core.rs", "85d9dd0cbb94fd521e2d15a8ed38a75f", "tidy-ticket-sess-time-item_types_checking") // ), - - add_group!( - ("library/core/src/ptr/metadata.rs", "357c958a096c33bed67cfc7212d940a2", "tidy-ticket-static_assert_expected_bounds_for_metadata"), - ("library/core/tests/ptr.rs", "d8c47e54b871d72dfdce56e6a89b5c31", "tidy-ticket-static_assert_expected_bounds_for_metadata") - ), -]; - -pub fn check(root_path: &Path, bad: &mut bool) { - for (group_idx, group) in TIDY_WATCH_LIST.iter().enumerate() { - for entry in group.iter() { - check_entry(entry, group_idx, bad, root_path); +*/ +pub fn check(root_path: &Path, bless: bool, bad: &mut bool) { + let config_path = root_path.join(Path::new("src/tools/tidy/src/watcher_list.json")); + let config_file = fs::read_to_string(&config_path).unwrap_or_else(|e| panic!("{:?}", e)); + let mut tag_groups: TagGroups = serde_json::from_str(&config_file).unwrap(); + for tag_group in tag_groups.tag_groups.iter_mut() { + if !tag_group.is_off { + for entry in tag_group.tags.iter_mut() { + check_entry(entry, &tag_group.name, bad, root_path, bless); + } } } + if bless { + let f = OpenOptions::new().write(true).truncate(true).open(config_path).unwrap(); + serde_json::to_writer_pretty(f, &tag_groups).unwrap(); + } } diff --git a/src/tools/tidy/src/watcher_list.json b/src/tools/tidy/src/watcher_list.json new file mode 100644 index 0000000000000..5890f9a49341c --- /dev/null +++ b/src/tools/tidy/src/watcher_list.json @@ -0,0 +1,206 @@ +{ + "tag_groups": [ + { + "name": "group_1", + "tags": [ + { + "path": "compiler/rustc_ast/src/token.rs", + "hash": "2df3e863dc4caffb31a7ddf001517232", + "tag": "tidy-ticket-ast-from_token" + }, + { + "path": "compiler/rustc_ast/src/token.rs", + "hash": "3279df5da05e0455f45630917fe2a797", + "tag": "tidy-ticket-ast-can_begin_literal_maybe_minus" + }, + { + "path": "compiler/rustc_parse/src/parser/expr.rs", + "hash": "479655a8587512fc26f7361d7bbd75a5", + "tag": "tidy-ticket-rustc_parse-can_begin_literal_maybe_minus" + } + ] + }, + { + "name": "group_2", + "tags": [ + { + "path": "compiler/rustc_builtin_macros/src/assert/context.rs", + "hash": "dbac73cc47a451d4822ccd3010c40a0f", + "tag": "tidy-ticket-all-expr-kinds" + }, + { + "path": "tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs", + "hash": "78ce54cc25baeac3ae07c876db25180c", + "tag": "tidy-ticket-all-expr-kinds" + } + ] + }, + { + "name": "group_3", + "tags": [ + { + "path": "compiler/rustc_const_eval/src/interpret/validity.rs", + "hash": "c4e96ecd3f81dcb54541b8ea41042e8f", + "tag": "tidy-ticket-try_visit_primitive" + }, + { + "path": "compiler/rustc_const_eval/src/interpret/validity.rs", + "hash": "cbe69005510c1a87ab07db601c0d36b8", + "tag": "tidy-ticket-visit_value" + } + ] + }, + { + "name": "group_4", + "tags": [ + { + "path": "compiler/rustc_data_structures/src/profiling.rs", + "hash": "881e7899c7d6904af1bc000594ee0418", + "tag": "tidy-ticket-self-profile-events" + }, + { + "path": "compiler/rustc_session/src/options.rs", + "hash": "012ee5a3b61ee1377744e5c6913fa00a", + "tag": "tidy-ticket-self-profile-events" + } + ] + }, + { + "name": "group_5", + "tags": [ + { + "path": "compiler/rustc_errors/src/json.rs", + "hash": "3963a8c4eee7f87eeb076622b8a92891", + "tag": "tidy-ticket-UnusedExterns" + }, + { + "path": "src/librustdoc/doctest.rs", + "hash": "14da85663568149c9b21686f4b7fa7b0", + "tag": "tidy-ticket-UnusedExterns" + } + ] + }, + { + "name": "group_6", + "tags": [ + { + "path": "compiler/rustc_middle/src/ty/util.rs", + "hash": "cae64b1bc854e7ee81894212facb5bfa", + "tag": "tidy-ticket-static_ptr_ty" + }, + { + "path": "compiler/rustc_middle/src/ty/util.rs", + "hash": "6f5ead08474b4d3e358db5d3c7aef970", + "tag": "tidy-ticket-thread_local_ptr_ty" + } + ] + }, + { + "name": "group_7", + "tags": [ + { + "path": "compiler/rustc_monomorphize/src/partitioning.rs", + "hash": "f4f33e9c14f4e0c3a20b5240ae36a7c8", + "tag": "tidy-ticket-short_description" + }, + { + "path": "compiler/rustc_codegen_ssa/src/back/write.rs", + "hash": "5286f7f76fcf564c98d7a8eaeec39b18", + "tag": "tidy-ticket-short_description" + } + ] + }, + { + "name": "group_8", + "tags": [ + { + "path": "compiler/rustc_session/src/config/sigpipe.rs", + "hash": "330e0776ba5a6c0a7439a5235297f08f", + "tag": "tidy-ticket-sigpipe" + }, + { + "path": "library/std/src/sys/pal/unix/mod.rs", + "hash": "2cdc37081831cdcf44f3331efbe440af", + "tag": "tidy-ticket-sigpipe" + } + ] + }, + { + "name": "group_9", + "tags": [ + { + "path": "compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs", + "hash": "8726918d084e0ac5bb07184008403f88", + "tag": "tidy-ticket-extract_tupled_inputs_and_output_from_callable" + }, + { + "path": "compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs", + "hash": "be2967d323633c7458533c6cec228273", + "tag": "tidy-ticket-assemble_fn_pointer_candidates" + } + ] + }, + { + "name": "group_10", + "tags": [ + { + "path": "compiler/rustc_trait_selection/src/traits/project.rs", + "hash": "262d10feb1b7ba8d3ffb4a95314bf404", + "tag": "tidy-ticket-assemble_candidates_from_impls-UserDefined" + }, + { + "path": "compiler/rustc_ty_utils/src/instance.rs", + "hash": "a51a6022efb405c5ee86acdf49ec222d", + "tag": "tidy-ticket-resolve_associated_item-UserDefined" + } + ] + }, + { + "name": "group_11", + "tags": [ + { + "path": "library/core/src/ptr/metadata.rs", + "hash": "357c958a096c33bed67cfc7212d940a2", + "tag": "tidy-ticket-static_assert_expected_bounds_for_metadata" + }, + { + "path": "library/core/tests/ptr.rs", + "hash": "d8c47e54b871d72dfdce56e6a89b5c31", + "tag": "tidy-ticket-static_assert_expected_bounds_for_metadata" + } + ] + }, + { + "name": "group_12", + "is_off": true, + "tags": [ + { + "path": "compiler/rustc_pattern_analysis/src/constructor.rs", + "hash": "c17706947fc814aa5648972a5b3dc143", + "tag": "tidy-ticket-arity" + }, + { + "path": "compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs", + "hash": "7ce77b84c142c22530b047703ef209f0", + "tag": "tidy-ticket-wildcards" + } + ] + }, + { + "name": "group_13", + "is_off": true, + "tags": [ + { + "path": "compiler/rustc_hir_analysis/src/lib.rs", + "hash": "842e23fb65caf3a96681686131093316", + "tag": "tidy-ticket-sess-time-item_types_checking" + }, + { + "path": "src/librustdoc/core.rs", + "hash": "85d9dd0cbb94fd521e2d15a8ed38a75f", + "tag": "tidy-ticket-sess-time-item_types_checking" + } + ] + } + ] +} \ No newline at end of file From 7a8664483708d1a01fc22e555a4a073c25a8aca4 Mon Sep 17 00:00:00 2001 From: klensy Date: Fri, 17 Jan 2025 19:34:36 +0300 Subject: [PATCH 5/8] fix tests --- src/tools/tidy/src/watcher/tests.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/tools/tidy/src/watcher/tests.rs b/src/tools/tidy/src/watcher/tests.rs index d0b8cb7e8646f..a097bc3944048 100644 --- a/src/tools/tidy/src/watcher/tests.rs +++ b/src/tools/tidy/src/watcher/tests.rs @@ -4,21 +4,30 @@ use super::*; fn test_span_hash_one_line() { let source = "some text\ntidy-tag\ncheckme=42\ntidy-tag\n"; let tag = "tidy-tag"; - assert_eq!("42258eba764c3f94a24de379e5715dc8", span_hash(source, tag, &mut true).unwrap()); + assert_eq!( + "42258eba764c3f94a24de379e5715dc8", + span_hash(source, tag, &mut true, Path::new("")).unwrap() + ); } #[test] fn test_span_hash_multiple_lines() { let source = "some text\ntidy-tag\ncheckme=42\nother line\ntidy-tag\n"; let tag = "tidy-tag"; - assert_eq!("49cb23dc2032ceea671ca48092750a1c", span_hash(source, tag, &mut true).unwrap()); + assert_eq!( + "49cb23dc2032ceea671ca48092750a1c", + span_hash(source, tag, &mut true, Path::new("")).unwrap() + ); } #[test] fn test_span_hash_has_some_text_in_line_with_tag() { let source = "some text\ntidy-tag ignore me\ncheckme=42\nother line\ntidy-tag\n"; let tag = "tidy-tag"; - assert_eq!("49cb23dc2032ceea671ca48092750a1c", span_hash(source, tag, &mut true).unwrap()); + assert_eq!( + "49cb23dc2032ceea671ca48092750a1c", + span_hash(source, tag, &mut true, Path::new("")).unwrap() + ); } #[test] @@ -35,5 +44,8 @@ RUN curl -LS -o perf.zip https://github.com/rust-lang/rustc-perf/archive/$PERF_C mv rustc-perf-$PERF_COMMIT rustc-perf && \ rm perf.zip"#; let tag = "tidy-ticket-perf-commit"; - assert_eq!("76c8d9783e38e25a461355f82fcd7955", span_hash(source, tag, &mut true).unwrap()); + assert_eq!( + "76c8d9783e38e25a461355f82fcd7955", + span_hash(source, tag, &mut true, Path::new("")).unwrap() + ); } From 31ee3e278a6f74031d525c610551e3ceb5850a96 Mon Sep 17 00:00:00 2001 From: klensy Date: Sat, 18 Jan 2025 13:50:34 +0300 Subject: [PATCH 6/8] refresh fixmes --- compiler/rustc_metadata/src/native_libs.rs | 3 +- compiler/rustc_middle/src/mir/terminator.rs | 3 +- .../src/solve/assembly/structural_traits.rs | 3 +- .../src/traits/effects.rs | 3 +- library/core/src/panicking.rs | 6 ++- src/bootstrap/src/core/build_steps/compile.rs | 2 + src/bootstrap/src/core/config/config.rs | 1 + src/bootstrap/src/core/download.rs | 1 + src/bootstrap/src/lib.rs | 2 + src/bootstrap/src/utils/render_tests.rs | 1 + src/tools/tidy/src/watcher_list.json | 50 +++++++++++++++++++ 11 files changed, 69 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index 8a3664dda233d..05c5baff69be5 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -48,6 +48,7 @@ pub fn walk_native_lib_search_dirs( f(&sess.target_tlib_path.dir.join("self-contained"), false)?; } + // tidy-keep-sync-with=tidy-ticket-copy_third_party_objects // Toolchains for some targets may ship `libunwind.a`, but place it into the main sysroot // library directory instead of the self-contained directories. // Sanitizer libraries have the same issue and are also linked by name on Apple targets. @@ -57,7 +58,6 @@ pub fn walk_native_lib_search_dirs( // FIXME: On AIX this also has the side-effect of making the list of library search paths // non-empty, which is needed or the linker may decide to record the LIBPATH env, if // defined, as the search path instead of appending the default search paths. - // FIXME: sync me if sess.target.vendor == "fortanix" || sess.target.os == "linux" || sess.target.os == "fuchsia" @@ -77,6 +77,7 @@ pub fn walk_native_lib_search_dirs( } ControlFlow::Continue(()) + // tidy-keep-sync-with=tidy-ticket-copy_third_party_objects } pub fn try_find_native_static_library( diff --git a/compiler/rustc_middle/src/mir/terminator.rs b/compiler/rustc_middle/src/mir/terminator.rs index 59dd1e5e0d173..d472c33a38a4d 100644 --- a/compiler/rustc_middle/src/mir/terminator.rs +++ b/compiler/rustc_middle/src/mir/terminator.rs @@ -135,12 +135,13 @@ impl UnwindAction { impl UnwindTerminateReason { pub fn as_str(self) -> &'static str { + // tidy-keep-sync-with=tidy-tidy-ticket-panic-message // Keep this in sync with the messages in `core/src/panicking.rs`. - // FIXME: sync me match self { UnwindTerminateReason::Abi => "panic in a function that cannot unwind", UnwindTerminateReason::InCleanup => "panic in a destructor during cleanup", } + // tidy-keep-sync-with=tidy-tidy-ticket-panic-message } /// A short representation of this used for MIR printing. diff --git a/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs b/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs index 6f2918100eacf..cf8c23ac0f3a2 100644 --- a/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs +++ b/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs @@ -714,9 +714,9 @@ pub(in crate::solve) fn extract_fn_def_from_const_callable( } } +// tidy-keep-sync-with=tidy-ticket-evaluate_host_effect_for_destruct_goal // NOTE: Keep this in sync with `evaluate_host_effect_for_destruct_goal` in // the old solver, for as long as that exists. -// FIXME: sync me pub(in crate::solve) fn const_conditions_for_destruct( cx: I, self_ty: I::Ty, @@ -792,6 +792,7 @@ pub(in crate::solve) fn const_conditions_for_destruct( } } } +// tidy-keep-sync-with=tidy-ticket-evaluate_host_effect_for_destruct_goal /// Assemble a list of predicates that would be present on a theoretical /// user impl for an object type. These predicates must be checked any time diff --git a/compiler/rustc_trait_selection/src/traits/effects.rs b/compiler/rustc_trait_selection/src/traits/effects.rs index 2b0cdec016596..204e8f717aecc 100644 --- a/compiler/rustc_trait_selection/src/traits/effects.rs +++ b/compiler/rustc_trait_selection/src/traits/effects.rs @@ -244,8 +244,8 @@ fn evaluate_host_effect_from_builtin_impls<'tcx>( } } +// tidy-keep-sync-with=tidy-ticket-evaluate_host_effect_for_destruct_goal // NOTE: Keep this in sync with `const_conditions_for_destruct` in the new solver. -// FIXME: sync me fn evaluate_host_effect_for_destruct_goal<'tcx>( selcx: &mut SelectionContext<'_, 'tcx>, obligation: &HostEffectObligation<'tcx>, @@ -332,6 +332,7 @@ fn evaluate_host_effect_for_destruct_goal<'tcx>( }) .collect()) } +// tidy-keep-sync-with=tidy-ticket-evaluate_host_effect_for_destruct_goal fn evaluate_host_effect_from_selection_candiate<'tcx>( selcx: &mut SelectionContext<'_, 'tcx>, diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs index 66f489160c966..f712758166c1c 100644 --- a/library/core/src/panicking.rs +++ b/library/core/src/panicking.rs @@ -319,9 +319,10 @@ fn panic_null_pointer_dereference() -> ! { #[lang = "panic_cannot_unwind"] // needed by codegen for panic in nounwind function #[rustc_nounwind] fn panic_cannot_unwind() -> ! { + // tidy-keep-sync-with=tidy-ticket-panic-message-nounwind // Keep the text in sync with `UnwindTerminateReason::as_str` in `rustc_middle`. - // FIXME: sync me panic_nounwind("panic in a function that cannot unwind") + // tidy-keep-sync-with=tidy-ticket-panic-message-nounwind } /// Panics because we are unwinding out of a destructor during cleanup. @@ -336,9 +337,10 @@ fn panic_cannot_unwind() -> ! { #[lang = "panic_in_cleanup"] // needed by codegen for panic in nounwind function #[rustc_nounwind] fn panic_in_cleanup() -> ! { + // tidy-keep-sync-with=tidy-ticket-panic-message-nobacktrace // Keep the text in sync with `UnwindTerminateReason::as_str` in `rustc_middle`. - // FIXME: sync me panic_nounwind_nobacktrace("panic in a destructor during cleanup") + // tidy-keep-sync-with=tidy-ticket-panic-message-nobacktrace } /// This function is used instead of panic_fmt in const eval. diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index cd3558ac6a49b..60ea50d2ed139 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -291,6 +291,7 @@ fn copy_llvm_libunwind(builder: &Builder<'_>, target: TargetSelection, libdir: & libunwind_target } +// tidy-keep-sync-with=tidy-ticket-copy_third_party_objects /// Copies third party objects needed by various targets. fn copy_third_party_objects( builder: &Builder<'_>, @@ -320,6 +321,7 @@ fn copy_third_party_objects( target_deps } +// tidy-keep-sync-with=tidy-ticket-copy_third_party_objects /// Copies third party objects needed by various targets for self-contained linkage. fn copy_self_contained_objects( diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 4694dd2ca4e2e..7250309e742ea 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -1520,6 +1520,7 @@ impl Config { // Allows creating alias for profile names, allowing // profiles to be renamed while maintaining back compatibility // Keep in sync with `profile_aliases` in bootstrap.py + // FIXME: sync me let profile_aliases = HashMap::from([("user", "dist")]); let include = match profile_aliases.get(include.as_str()) { Some(alias) => alias, diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs index c477bdb829a91..5f7f75f7efa9e 100644 --- a/src/bootstrap/src/core/download.rs +++ b/src/bootstrap/src/core/download.rs @@ -231,6 +231,7 @@ impl Config { // options should be kept in sync with // src/bootstrap/src/core/download.rs // for consistency + // FIXME: sync with what? let mut curl = command("curl"); curl.args([ // follow redirect diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index 2dd83d5938e9d..e3e38f23742ed 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -681,6 +681,8 @@ impl Build { features.push("llvm"); } // keep in sync with `bootstrap/compile.rs:rustc_cargo_env` + // FIXME: this comment is leftover from https://github.com/rust-lang/rust/pull/93787, + // remove it? if self.config.rust_randomize_layout { features.push("rustc_randomized_layouts"); } diff --git a/src/bootstrap/src/utils/render_tests.rs b/src/bootstrap/src/utils/render_tests.rs index 3f58328a5b594..f10eae7e4fa34 100644 --- a/src/bootstrap/src/utils/render_tests.rs +++ b/src/bootstrap/src/utils/render_tests.rs @@ -167,6 +167,7 @@ impl<'a> Renderer<'a> { if let Outcome::Ignored { reason } = outcome { self.ignored_tests += 1; // Keep this in sync with the "up-to-date" ignore message inserted by compiletest. + // FIXME: sync me if reason == Some("up-to-date") { self.up_to_date_tests += 1; } diff --git a/src/tools/tidy/src/watcher_list.json b/src/tools/tidy/src/watcher_list.json index 5890f9a49341c..cc958245b5fb6 100644 --- a/src/tools/tidy/src/watcher_list.json +++ b/src/tools/tidy/src/watcher_list.json @@ -201,6 +201,56 @@ "tag": "tidy-ticket-sess-time-item_types_checking" } ] + }, + { + "name": "group_14", + "tags": [ + { + "path": "library/core/src/panicking.rs", + "hash": "b5387987dd6c927acf5ddfa33fdf3090", + "tag": "tidy-ticket-panic-message-nounwind" + }, + { + "path": "library/core/src/panicking.rs", + "hash": "f07f9a5af83a08e7287cd81226be8834", + "tag": "tidy-ticket-panic-message-nobacktrace" + }, + { + "path": "compiler/rustc_middle/src/mir/terminator.rs", + "hash": "110baa63da1da4d6ae54938b4bbd070f", + "tag": "tidy-ticket-panic-message" + } + ] + }, + { + "name": "group_15", + "tags": [ + { + "path": "compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs", + "hash": "50a549340456169ab3119d1dfecb6f96", + "tag": "tidy-ticket-evaluate_host_effect_for_destruct_goal" + }, + { + "path": "compiler/rustc_trait_selection/src/traits/effects.rs", + "hash": "a280510e2a7424dd874f14ad2180a938", + "tag": "tidy-ticket-evaluate_host_effect_for_destruct_goal" + } + ] + }, + { + "name": "group_16", + "tags": [ + { + "path": "compiler/rustc_metadata/src/native_libs.rs", + "hash": "332941877827af57790ac82c2a40177f", + "tag": "tidy-ticket-copy_third_party_objects" + }, + { + "path": "src/bootstrap/src/core/build_steps/compile.rs", + "hash": "ea843d88787238a509fdc5cb4ad3915b", + "tag": "tidy-ticket-copy_third_party_objects" + } + ] } ] } \ No newline at end of file From 1d4c9a14b385ae50eb61203fa1235b642fcd7e80 Mon Sep 17 00:00:00 2001 From: klensy Date: Fri, 7 Feb 2025 12:47:21 +0300 Subject: [PATCH 7/8] pacify Unrecognized tidy directive lint --- src/tools/tidy/src/style.rs | 6 ++++-- src/tools/tidy/src/watcher/tests.rs | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index 21b513629ed8d..4ff50927efe3e 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -507,8 +507,10 @@ pub fn check(path: &Path, bad: &mut bool) { .any(|directive| matches!(directive, Directive::Ignore(_))); let has_alphabetical_directive = line.contains("tidy-alphabetical-start") || line.contains("tidy-alphabetical-end"); - let has_recognized_directive = - has_recognized_ignore_directive || has_alphabetical_directive; + let has_tidy_watcher_directive = line.contains("tidy-keep-sync-with"); + let has_recognized_directive = has_recognized_ignore_directive + || has_alphabetical_directive + || has_tidy_watcher_directive; if contains_potential_directive && (!has_recognized_directive) { err("Unrecognized tidy directive") } diff --git a/src/tools/tidy/src/watcher/tests.rs b/src/tools/tidy/src/watcher/tests.rs index a097bc3944048..0cc46a17de532 100644 --- a/src/tools/tidy/src/watcher/tests.rs +++ b/src/tools/tidy/src/watcher/tests.rs @@ -35,10 +35,10 @@ fn test_span_hash_has_some_text_in_line_before_second_tag() { let source = r#" RUN ./build-clang.sh ENV CC=clang CXX=clang++ -# tidy-ticket-perf-commit +# tidy-keep-sync-with=tidy-ticket-perf-commit # rustc-perf version from 2023-05-30 ENV PERF_COMMIT 8b2ac3042e1ff2c0074455a0a3618adef97156b1 -# tidy-ticket-perf-commit +# tidy-keep-sync-with=tidy-ticket-perf-commit RUN curl -LS -o perf.zip https://github.com/rust-lang/rustc-perf/archive/$PERF_COMMIT.zip && \ unzip perf.zip && \ mv rustc-perf-$PERF_COMMIT rustc-perf && \ From 09aa084a828eb9a5c7ebe687e6b2badcea5731f9 Mon Sep 17 00:00:00 2001 From: klensy Date: Fri, 7 Feb 2025 12:51:38 +0300 Subject: [PATCH 8/8] bless --- src/tools/tidy/src/watcher_list.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/tidy/src/watcher_list.json b/src/tools/tidy/src/watcher_list.json index cc958245b5fb6..a1f359f7d1569 100644 --- a/src/tools/tidy/src/watcher_list.json +++ b/src/tools/tidy/src/watcher_list.json @@ -150,7 +150,7 @@ }, { "path": "compiler/rustc_ty_utils/src/instance.rs", - "hash": "a51a6022efb405c5ee86acdf49ec222d", + "hash": "3da2773f10aef680bf9880a5adba29c6", "tag": "tidy-ticket-resolve_associated_item-UserDefined" } ] @@ -164,7 +164,7 @@ "tag": "tidy-ticket-static_assert_expected_bounds_for_metadata" }, { - "path": "library/core/tests/ptr.rs", + "path": "library/coretests/tests/ptr.rs", "hash": "d8c47e54b871d72dfdce56e6a89b5c31", "tag": "tidy-ticket-static_assert_expected_bounds_for_metadata" }