Skip to content

Commit

Permalink
add few more items to sync list. NB: not every entry is checked if co…
Browse files Browse the repository at this point in the history
…de actually in sync, should be reviewed
  • Loading branch information
klensy committed Oct 2, 2023
1 parent 3a0ea27 commit e4c6a7c
Show file tree
Hide file tree
Showing 31 changed files with 137 additions and 9 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ impl Lit {
}
}

// 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 @@ -120,6 +121,7 @@ impl Lit {
_ => None,
}
}
// tidy-ticket-ast-from_token
}

impl fmt::Display for Lit {
Expand Down Expand Up @@ -545,6 +547,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
/// 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 @@ -564,6 +567,7 @@ impl Token {
_ => false,
}
}
// 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
2 changes: 2 additions & 0 deletions compiler/rustc_builtin_macros/src/assert/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ impl<'cx, 'a> Context<'cx, 'a> {
}
// Expressions that are not worth or can not be captured.
//
// 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 @@ -323,6 +324,7 @@ impl<'cx, 'a> Context<'cx, 'a> {
| ExprKind::Yeet(_)
| ExprKind::Become(_)
| ExprKind::Yield(_) => {}
// tidy-ticket-all-expr-kinds
}
}

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

// 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 @@ -761,6 +762,7 @@ impl<B: WriteBackendMethods> WorkItem<B> {
WorkItem::LTO(m) => desc("lto", "LTO module", m.name()),
}
}
// tidy-ticket-short_description
}

/// A result produced by the backend.
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_const_eval/src/interpret/projection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ where
None => {
// For unsized types with an extern type tail we perform no adjustments.
// NOTE: keep this in sync with `PlaceRef::project_field` in the codegen backend.
// FIXME: that one? compiler/rustc_codegen_ssa/src/mir/place.rs
assert!(matches!(base_meta, MemPlaceMeta::None));
(base_meta, offset)
}
Expand Down
6 changes: 5 additions & 1 deletion compiler/rustc_const_eval/src/interpret/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,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
// NOTE: Keep this in sync with the array optimization for int/float
// types below!
self.read_scalar(
Expand All @@ -516,6 +517,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
},
)?;
Ok(true)
// tidy-ticket-try_visit_primitive
}
ty::RawPtr(..) => {
let place =
Expand Down Expand Up @@ -778,9 +780,10 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
}
};

// 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`.
// In run-time mode, we accept pointers in here. This is actually more
// permissive than a per-element check would be, e.g., we accept
// a &[u8] that contains a pointer even though bytewise checking would
Expand Down Expand Up @@ -820,6 +823,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
}
}
}
// 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
2 changes: 2 additions & 0 deletions compiler/rustc_data_structures/src/profiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ bitflags::bitflags! {
}
}

// 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 @@ -142,6 +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

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

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

impl Diagnostic {
fn from_errors_diagnostic(diag: &crate::Diagnostic, je: &JsonEmitter) -> Diagnostic {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir_analysis/src/check/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h
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
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_hir_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,12 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
});
})?;

// 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

// Freeze definitions as we don't add new ones at this point. This improves performance by
// allowing lock-free access to them.
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_middle/src/ty/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ impl<'tcx> TyCtxt<'tcx> {
&& !self.is_foreign_item(def_id)
}

// 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 @@ -665,6 +666,7 @@ impl<'tcx> TyCtxt<'tcx> {
Ty::new_imm_ref(self, self.lifetimes.re_static, static_ty)
}
}
// 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 @@ -674,7 +676,9 @@ impl<'tcx> TyCtxt<'tcx> {
self.type_of(def_id).instantiate_identity(),
);

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

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

// 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 @@ -702,6 +703,7 @@ impl<'tcx> Constructor<'tcx> {
Or => bug!("The `Or` constructor doesn't have a fixed arity"),
}
}
// 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 these
Expand Down Expand Up @@ -749,6 +751,7 @@ impl<'tcx> Constructor<'tcx> {
}
}

// tidy-ticket-is_covered_by
/// 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,
/// this checks for inclusion.
Expand Down Expand Up @@ -802,7 +805,9 @@ impl<'tcx> Constructor<'tcx> {
),
}
}
// tidy-ticket-is_covered_by

// tidy-ticket-is_covered_by_any
/// Faster version of `is_covered_by` when applied to many constructors. `used_ctors` is
/// assumed to be built from `matrix.head_ctors()` with wildcards and opaques filtered out,
/// and `self` is assumed to have been split from a wildcard.
Expand Down Expand Up @@ -835,6 +840,7 @@ impl<'tcx> Constructor<'tcx> {
}
}
}
// tidy-ticket-is_covered_by_any
}

/// A wildcard constructor that we split relative to the constructors in the matrix, as explained
Expand Down Expand Up @@ -1144,6 +1150,7 @@ impl<'p, 'tcx> Fields<'p, 'tcx> {
})
}

// 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 @@ -1188,6 +1195,7 @@ impl<'p, 'tcx> Fields<'p, 'tcx> {
debug!(?ret);
ret
}
// tidy-ticket-wildcards

/// Returns the list of patterns.
pub(super) fn iter_patterns<'a>(
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_monomorphize/src/partitioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,13 +473,16 @@ 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
// 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.
let suffix = format!("{index:0num_digits$}");
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
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2081,6 +2081,7 @@ impl<'a> Parser<'a> {
}
}

// 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 @@ -2097,6 +2098,7 @@ impl<'a> Parser<'a> {
Ok(expr)
}
}
// 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
1 change: 1 addition & 0 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,7 @@ pub const fn default_lib_output() -> CrateType {

fn default_configuration(sess: &Session) -> CrateConfig {
// NOTE: This should be kept in sync with `CrateCheckConfig::fill_well_known` below.
// FIXME: what exactly sync there?
let end = &sess.target.endian;
let arch = &sess.target.arch;
let wordsz = sess.target.pointer_width.to_string();
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_session/src/config/sigpipe.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// 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 @@ -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-ticket-sigpipe
9 changes: 6 additions & 3 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1749,12 +1749,15 @@ 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-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, 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-ticket-self-profile-events

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

// 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 All @@ -234,6 +235,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_callable<'tcx>(
Err(NoSolution)
}
}

// keep this in sync with assemble_fn_pointer_candidates until the old solver is removed.
ty::FnPtr(sig) => {
if sig.is_fn_trait_compatible() {
Expand Down Expand Up @@ -291,6 +293,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_callable<'tcx>(
}
}
}
// 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
2 changes: 2 additions & 0 deletions compiler/rustc_trait_selection/src/solve/eval_ctxt/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ fn rematch_impl<'tcx>(
Ok(Some(ImplSource::UserDefined(ImplSourceUserDefinedData { impl_def_id, args, nested })))
}

// 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 @@ -377,6 +378,7 @@ fn rematch_unsize<'tcx>(
}
}
}
// tidy-ticket-rematch_unsize

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

// tidy-ticket-consider_builtin_unsize_candidate
fn consider_unsize_to_dyn_candidate(
ecx: &mut EvalCtxt<'_, 'tcx>,
goal: Goal<'tcx, Self>,
Expand Down Expand Up @@ -463,6 +464,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

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

let eligible = match &impl_source {
// 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 @@ -1782,6 +1783,8 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
}
}
}
// 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
// be known. Any type with multiple potential associated types is therefore
Expand Down
Loading

0 comments on commit e4c6a7c

Please sign in to comment.