Skip to content

Commit de8b9e3

Browse files
committed
MVP of tidy watcher
1 parent 46455dc commit de8b9e3

File tree

37 files changed

+276
-8
lines changed

37 files changed

+276
-8
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5463,6 +5463,7 @@ dependencies = [
54635463
"cargo_metadata 0.15.4",
54645464
"ignore",
54655465
"lazy_static",
5466+
"md-5",
54665467
"miropt-test-tools",
54675468
"regex",
54685469
"semver",

compiler/rustc_ast/src/token.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ impl Lit {
104104
}
105105
}
106106

107+
// tidy-ticket-ast-from_token
107108
/// Keep this in sync with `Token::can_begin_literal_or_bool` excluding unary negation.
108109
pub fn from_token(token: &Token) -> Option<Lit> {
109110
match token.uninterpolate().kind {
@@ -118,6 +119,7 @@ impl Lit {
118119
_ => None,
119120
}
120121
}
122+
// tidy-ticket-ast-from_token
121123
}
122124

123125
impl fmt::Display for Lit {
@@ -571,6 +573,7 @@ impl Token {
571573
///
572574
/// In other words, would this token be a valid start of `parse_literal_maybe_minus`?
573575
///
576+
// tidy-ticket-ast-can_begin_literal_maybe_minus
574577
/// Keep this in sync with and `Lit::from_token`, excluding unary negation.
575578
pub fn can_begin_literal_maybe_minus(&self) -> bool {
576579
match self.uninterpolate().kind {
@@ -590,6 +593,7 @@ impl Token {
590593
_ => false,
591594
}
592595
}
596+
// tidy-ticket-ast-can_begin_literal_maybe_minus
593597

594598
/// A convenience function for matching on identifiers during parsing.
595599
/// Turns interpolated identifier (`$i: ident`) or lifetime (`$l: lifetime`) token

compiler/rustc_builtin_macros/src/assert/context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ impl<'cx, 'a> Context<'cx, 'a> {
290290
}
291291
// Expressions that are not worth or can not be captured.
292292
//
293+
// tidy-ticket-all-expr-kinds
293294
// Full list instead of `_` to catch possible future inclusions and to
294295
// sync with the `rfc-2011-nicer-assert-messages/all-expr-kinds.rs` test.
295296
ExprKind::Assign(_, _, _)
@@ -321,6 +322,7 @@ impl<'cx, 'a> Context<'cx, 'a> {
321322
| ExprKind::Yeet(_)
322323
| ExprKind::Become(_)
323324
| ExprKind::Yield(_) => {}
325+
// tidy-ticket-all-expr-kinds
324326
}
325327
}
326328

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ impl<B: WriteBackendMethods> WorkItem<B> {
711711
}
712712
}
713713

714+
// tidy-ticket-short_description
714715
/// Generate a short description of this work item suitable for use as a thread name.
715716
fn short_description(&self) -> String {
716717
// `pthread_setname()` on *nix ignores anything beyond the first 15
@@ -758,6 +759,7 @@ impl<B: WriteBackendMethods> WorkItem<B> {
758759
WorkItem::LTO(m) => desc("lto", "LTO module", m.name()),
759760
}
760761
}
762+
// tidy-ticket-short_description
761763
}
762764

763765
/// A result produced by the backend.

compiler/rustc_const_eval/src/interpret/projection.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ where
167167
None => {
168168
// For unsized types with an extern type tail we perform no adjustments.
169169
// NOTE: keep this in sync with `PlaceRef::project_field` in the codegen backend.
170+
// FIXME: that one? compiler/rustc_codegen_ssa/src/mir/place.rs
170171
assert!(matches!(base_meta, MemPlaceMeta::None));
171172
(base_meta, offset)
172173
}

compiler/rustc_const_eval/src/interpret/validity.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
511511
Ok(true)
512512
}
513513
ty::Float(_) | ty::Int(_) | ty::Uint(_) => {
514+
// tidy-ticket-try_visit_primitive
514515
// NOTE: Keep this in sync with the array optimization for int/float
515516
// types below!
516517
self.read_scalar(
@@ -522,6 +523,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
522523
},
523524
)?;
524525
Ok(true)
526+
// tidy-ticket-try_visit_primitive
525527
}
526528
ty::RawPtr(..) => {
527529
let place =
@@ -784,6 +786,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
784786
}
785787
};
786788

789+
// tidy-ticket-visit_value
787790
// Optimization: we just check the entire range at once.
788791
// NOTE: Keep this in sync with the handling of integer and float
789792
// types above, in `visit_primitive`.
@@ -820,6 +823,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
820823
}
821824
}
822825
}
826+
// tidy-ticket-visit_value
823827
}
824828
// Fast path for arrays and slices of ZSTs. We only need to check a single ZST element
825829
// of an array and not all of them, because there's only a single value of a specific

compiler/rustc_data_structures/src/profiling.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ bitflags::bitflags! {
125125
}
126126
}
127127

128+
// tidy-ticket-self-profile-events
128129
// keep this in sync with the `-Z self-profile-events` help message in rustc_session/options.rs
129130
const EVENT_FILTERS_BY_NAME: &[(&str, EventFilter)] = &[
130131
("none", EventFilter::empty()),
@@ -142,6 +143,7 @@ const EVENT_FILTERS_BY_NAME: &[(&str, EventFilter)] = &[
142143
("incr-result-hashing", EventFilter::INCR_RESULT_HASHING),
143144
("artifact-sizes", EventFilter::ARTIFACT_SIZES),
144145
];
146+
// tidy-ticket-self-profile-events
145147

146148
/// Something that uniquely identifies a query invocation.
147149
pub struct QueryInvocationId(pub u32);

compiler/rustc_errors/src/json.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,8 @@ struct FutureIncompatReport {
322322
future_incompat_report: Vec<FutureBreakageItem>,
323323
}
324324

325+
// tidy-ticket-UnusedExterns
326+
// FIXME: where it located in cargo?
325327
// NOTE: Keep this in sync with the equivalent structs in rustdoc's
326328
// doctest component (as well as cargo).
327329
// We could unify this struct the one in rustdoc but they have different
@@ -333,6 +335,7 @@ struct UnusedExterns<'a, 'b, 'c> {
333335
/// List of unused externs by their names.
334336
unused_extern_names: &'b [&'c str],
335337
}
338+
// tidy-ticket-UnusedExterns
336339

337340
impl Diagnostic {
338341
fn from_errors_diagnostic(diag: &crate::Diagnostic, je: &JsonEmitter) -> Diagnostic {

compiler/rustc_hir_analysis/src/check/region.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h
119119
visitor.cx.var_parent = visitor.cx.parent;
120120

121121
{
122+
// FIXME: sync with exactly where?
122123
// This block should be kept approximately in sync with
123124
// `intravisit::walk_block`. (We manually walk the block, rather
124125
// than call `walk_block`, in order to maintain precise

compiler/rustc_hir_analysis/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,12 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
206206
tcx.hir().try_par_for_each_module(|module| tcx.ensure().check_mod_type_wf(module))
207207
});
208208

209+
// tidy-ticket-sess-time-item_types_checking
209210
// NOTE: This is copy/pasted in librustdoc/core.rs and should be kept in sync.
210211
tcx.sess.time("item_types_checking", || {
211212
tcx.hir().for_each_module(|module| tcx.ensure().check_mod_item_types(module))
212213
});
214+
// tidy-ticket-sess-time-item_types_checking
213215

214216
// HACK: `check_mod_type_wf` may spuriously emit errors due to `delay_span_bug`, even if those errors
215217
// only actually get emitted in `check_mod_item_types`.

0 commit comments

Comments
 (0)