Skip to content

Commit

Permalink
add tidy-keep-sync-with prefix around
Browse files Browse the repository at this point in the history
  • Loading branch information
klensy committed Nov 2, 2023
1 parent 4d09021 commit 275c2b1
Show file tree
Hide file tree
Showing 28 changed files with 63 additions and 62 deletions.
8 changes: 4 additions & 4 deletions compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl Lit {
}
}

// tidy-ticket-ast-from_token
// tidy-keep-sync-with=tidy-ticket-ast-from_token
/// Keep this in sync with `Token::can_begin_literal_or_bool` excluding unary negation.
pub fn from_token(token: &Token) -> Option<Lit> {
match token.uninterpolate().kind {
Expand All @@ -119,7 +119,7 @@ impl Lit {
_ => None,
}
}
// tidy-ticket-ast-from_token
// tidy-keep-sync-with=tidy-ticket-ast-from_token
}

impl fmt::Display for Lit {
Expand Down Expand Up @@ -573,7 +573,7 @@ impl Token {
///
/// In other words, would this token be a valid start of `parse_literal_maybe_minus`?
///
// tidy-ticket-ast-can_begin_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 {
Expand All @@ -593,7 +593,7 @@ impl Token {
_ => false,
}
}
// tidy-ticket-ast-can_begin_literal_maybe_minus
// tidy-keep-sync-with=tidy-ticket-ast-can_begin_literal_maybe_minus

/// A convenience function for matching on identifiers during parsing.
/// Turns interpolated identifier (`$i: ident`) or lifetime (`$l: lifetime`) token
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_builtin_macros/src/assert/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ impl<'cx, 'a> Context<'cx, 'a> {
}
// Expressions that are not worth or can not be captured.
//
// tidy-ticket-all-expr-kinds
// 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(_, _, _)
Expand Down Expand Up @@ -322,7 +322,7 @@ impl<'cx, 'a> Context<'cx, 'a> {
| ExprKind::Yeet(_)
| ExprKind::Become(_)
| ExprKind::Yield(_) => {}
// tidy-ticket-all-expr-kinds
// tidy-keep-sync-with=tidy-ticket-all-expr-kinds
}
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ impl<B: WriteBackendMethods> WorkItem<B> {
}
}

// tidy-ticket-short_description
// 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
Expand Down Expand Up @@ -759,7 +759,7 @@ impl<B: WriteBackendMethods> WorkItem<B> {
WorkItem::LTO(m) => desc("lto", "LTO module", m.name()),
}
}
// tidy-ticket-short_description
// tidy-keep-sync-with=tidy-ticket-short_description
}

/// A result produced by the backend.
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_const_eval/src/interpret/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
Ok(true)
}
ty::Float(_) | ty::Int(_) | ty::Uint(_) => {
// tidy-ticket-try_visit_primitive
// 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(
Expand All @@ -523,7 +523,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
},
)?;
Ok(true)
// tidy-ticket-try_visit_primitive
// tidy-keep-sync-with=tidy-ticket-try_visit_primitive
}
ty::RawPtr(..) => {
let place =
Expand Down Expand Up @@ -786,7 +786,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
}
};

// tidy-ticket-visit_value
// 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 `try_visit_primitive`.
Expand Down Expand Up @@ -823,7 +823,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
}
}
}
// tidy-ticket-visit_value
// 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
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_data_structures/src/profiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ bitflags::bitflags! {
}
}

// tidy-ticket-self-profile-events
// 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()),
Expand All @@ -143,7 +143,7 @@ const EVENT_FILTERS_BY_NAME: &[(&str, EventFilter)] = &[
("incr-result-hashing", EventFilter::INCR_RESULT_HASHING),
("artifact-sizes", EventFilter::ARTIFACT_SIZES),
];
// tidy-ticket-self-profile-events
// tidy-keep-sync-with=tidy-ticket-self-profile-events

/// Something that uniquely identifies a query invocation.
pub struct QueryInvocationId(pub u32);
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_errors/src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ struct FutureIncompatReport {
future_incompat_report: Vec<FutureBreakageItem>,
}

// tidy-ticket-UnusedExterns
// 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).
Expand All @@ -335,7 +335,7 @@ struct UnusedExterns<'a, 'b, 'c> {
/// List of unused externs by their names.
unused_extern_names: &'b [&'c str],
}
// tidy-ticket-UnusedExterns
// tidy-keep-sync-with=tidy-ticket-UnusedExterns

impl Diagnostic {
fn from_errors_diagnostic(diag: &crate::Diagnostic, je: &JsonEmitter) -> Diagnostic {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
tcx.hir().try_par_for_each_module(|module| tcx.ensure().check_mod_type_wf(module))
});

// tidy-ticket-sess-time-item_types_checking
// tidy-keep-sync-with=tidy-ticket-sess-time-item_types_checking
// NOTE: This is copy/pasted in librustdoc/core.rs and should be kept in sync.
tcx.sess.time("item_types_checking", || {
tcx.hir().for_each_module(|module| tcx.ensure().check_mod_item_types(module))
});
// tidy-ticket-sess-time-item_types_checking
// tidy-keep-sync-with=tidy-ticket-sess-time-item_types_checking

// HACK: `check_mod_type_wf` may spuriously emit errors due to `delay_span_bug`, even if those errors
// only actually get emitted in `check_mod_item_types`.
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_middle/src/ty/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ impl<'tcx> TyCtxt<'tcx> {
&& !self.is_foreign_item(def_id)
}

// tidy-ticket-thread_local_ptr_ty
// 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();
Expand All @@ -666,7 +666,7 @@ impl<'tcx> TyCtxt<'tcx> {
Ty::new_imm_ref(self, self.lifetimes.re_static, static_ty)
}
}
// tidy-ticket-thread_local_ptr_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) -> Ty<'tcx> {
Expand All @@ -676,7 +676,7 @@ impl<'tcx> TyCtxt<'tcx> {
self.type_of(def_id).instantiate_identity(),
);

// tidy-ticket-static_ptr_ty
// 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`.
Expand All @@ -687,7 +687,7 @@ impl<'tcx> TyCtxt<'tcx> {
} else {
Ty::new_imm_ref(self, self.lifetimes.re_erased, static_ty)
}
// tidy-ticket-static_ptr_ty
// tidy-keep-sync-with=tidy-ticket-static_ptr_ty
}

/// Return the set of types that should be taken into account when checking
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ impl<'tcx> Constructor<'tcx> {
}
}

// tidy-ticket-arity
// tidy-keep-sync-with=tidy-ticket-arity
/// The number of fields for this constructor. This must be kept in sync with
/// `Fields::wildcards`.
pub(super) fn arity(&self, pcx: &PatCtxt<'_, '_, 'tcx>) -> usize {
Expand Down Expand Up @@ -737,7 +737,7 @@ impl<'tcx> Constructor<'tcx> {
Or => bug!("The `Or` constructor doesn't have a fixed arity"),
}
}
// tidy-ticket-arity
// tidy-keep-sync-with=tidy-ticket-arity

/// Some constructors (namely `Wildcard`, `IntRange` and `Slice`) actually stand for a set of
/// actual constructors (like variants, integers or fixed-sized slices). When specializing for
Expand Down Expand Up @@ -1307,7 +1307,7 @@ impl<'p, 'tcx> Fields<'p, 'tcx> {
})
}

// tidy-ticket-wildcards
// tidy-keep-sync-with=tidy-ticket-wildcards
/// Creates a new list of wildcard fields for a given constructor. The result must have a
/// length of `constructor.arity()`.
#[instrument(level = "trace")]
Expand Down Expand Up @@ -1354,7 +1354,7 @@ impl<'p, 'tcx> Fields<'p, 'tcx> {
debug!(?ret);
ret
}
// tidy-ticket-wildcards
// tidy-keep-sync-with=tidy-ticket-wildcards

/// Returns the list of patterns.
pub(super) fn iter_patterns<'a>(
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_monomorphize/src/partitioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ 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-ticket-short_description
// 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
Expand All @@ -481,7 +481,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-ticket-short_description
// tidy-keep-sync-with=tidy-ticket-short_description
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2087,7 +2087,7 @@ impl<'a> Parser<'a> {
}
}

// tidy-ticket-rustc_parse-can_begin_literal_maybe_minus
// 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<Expr>> {
Expand All @@ -2104,7 +2104,7 @@ impl<'a> Parser<'a> {
Ok(expr)
}
}
// tidy-ticket-rustc_parse-can_begin_literal_maybe_minus
// 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(_)))
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_session/src/config/sigpipe.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// tidy-ticket-sigpipe
// tidy-keep-sync-with=tidy-ticket-sigpipe
//! NOTE: Keep these constants in sync with `library/std/src/sys/unix/mod.rs`!

/// The default value if `#[unix_sigpipe]` is not specified. This resolves
Expand All @@ -24,4 +24,4 @@ pub const SIG_IGN: u8 = 2;
/// such as `head -n 1`.
#[allow(dead_code)]
pub const SIG_DFL: u8 = 3;
// tidy-ticket-sigpipe
// tidy-keep-sync-with=tidy-ticket-sigpipe
4 changes: 2 additions & 2 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1779,14 +1779,14 @@ written to standard error output)"),
`instructions:u` (retired instructions, userspace-only)
`instructions-minus-irqs:u` (subtracting hardware interrupt counts for extra accuracy)"
),
// tidy-ticket-self-profile-events
// 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<Vec<String>> = (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, query-keys, function-args, args, llvm, incr-result-hashing, artifact-sizes"),
// tidy-ticket-self-profile-events
// tidy-keep-sync-with=tidy-ticket-self-profile-events

share_generics: Option<bool> = (None, parse_opt_bool, [TRACKED],
"make the current crate share its generic instantiations"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ pub(in crate::solve) fn instantiate_constituent_tys_for_copy_clone_trait<'tcx>(
}
}

// tidy-ticket-extract_tupled_inputs_and_output_from_callable
// 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<'tcx>(
tcx: TyCtxt<'tcx>,
Expand Down Expand Up @@ -293,7 +293,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_callable<'tcx>(
}
}
}
// tidy-ticket-extract_tupled_inputs_and_output_from_callable
// tidy-keep-sync-with=tidy-ticket-extract_tupled_inputs_and_output_from_callable

/// 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
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_trait_selection/src/solve/eval_ctxt/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ fn rematch_impl<'tcx>(
Ok(Some(ImplSource::UserDefined(ImplSourceUserDefinedData { impl_def_id, args, nested })))
}

// tidy-ticket-rematch_unsize
// tidy-keep-sync-with=tidy-ticket-rematch_unsize
/// The `Unsize` trait is particularly important to coercion, so we try rematch it.
/// NOTE: This must stay in sync with `consider_builtin_unsize_candidate` in trait
/// goal assembly in the solver, both for soundness and in order to avoid ICEs.
Expand Down Expand Up @@ -378,7 +378,7 @@ fn rematch_unsize<'tcx>(
}
}
}
// tidy-ticket-rematch_unsize
// tidy-keep-sync-with=tidy-ticket-rematch_unsize

fn structurally_normalize<'tcx>(
ty: Ty<'tcx>,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_trait_selection/src/solve/trait_goals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
ecx.evaluate_added_goals_and_make_canonical_response(certainty)
}

// tidy-ticket-consider_builtin_unsize_candidate
// tidy-keep-sync-with=tidy-ticket-consider_builtin_unsize_candidate
fn consider_unsize_to_dyn_candidate(
ecx: &mut EvalCtxt<'_, 'tcx>,
goal: Goal<'tcx, Self>,
Expand Down Expand Up @@ -504,7 +504,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
})
}
// tidy-ticket-consider_builtin_unsize_candidate
// tidy-keep-sync-with=tidy-ticket-consider_builtin_unsize_candidate

/// ```ignore (builtin impl example)
/// trait Trait {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_trait_selection/src/traits/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1741,7 +1741,7 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
};

let eligible = match &impl_source {
// tidy-ticket-assemble_candidates_from_impls-UserDefined
// 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
Expand Down Expand Up @@ -1792,7 +1792,7 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
}
}
}
// tidy-ticket-assemble_candidates_from_impls-UserDefined
// tidy-keep-sync-with=tidy-ticket-assemble_candidates_from_impls-UserDefined

ImplSource::Builtin(BuiltinImplSource::Misc, _) => {
// While a builtin impl may be known to exist, the associated type may not yet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}
}

// tidy-ticket-assemble_fn_pointer_candidates
// 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,
Expand All @@ -327,7 +327,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
candidates.ambiguous = true; // Could wind up being a fn() type.
}

// tidy-ticket-extract_tupled_inputs_and_output_from_callable-FnPtr
// Provide an impl, but only for suitable `fn` pointers.
ty::FnPtr(sig) => {
if sig.is_fn_trait_compatible() {
Expand All @@ -348,7 +347,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
_ => {}
}
}
// tidy-ticket-assemble_fn_pointer_candidates
// tidy-keep-sync-with=tidy-ticket-assemble_fn_pointer_candidates

/// Searches for impls that might apply to `obligation`.
#[instrument(level = "debug", skip(self, candidates))]
Expand Down

0 comments on commit 275c2b1

Please sign in to comment.