Skip to content

Commit 3be2d85

Browse files
authored
Rollup merge of #164528 - fmease:cta-renamings, r=chenyukang
Complete the various renamings of terms belonging to feature `checked_type_aliases` Various terms used in the context of feature `checked_type_aliases` have undergone renamings. See PRs #140249 and #158758. However, these PRs didn't update every single occurrence. This PR rectifies that. For context, the renamings are 1. weak (alias (type)) → free (alias (type)) 2. lazy (type alias) → checked (type alias), LTA → CTA 3. eager (type alias) → unchecked (type alias) Moreover, I've renamed `tests/ui/checked-type-alias/` to `tests/ui/checked-type-aliases/` in accordance with the name of the feature, `checked_type_aliases`. <sub>(No LLM was or will be used by me during the entire creation process of this PR)</sub>
2 parents 59ded9f + fe64545 commit 3be2d85

85 files changed

Lines changed: 151 additions & 169 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎compiler/rustc_hir_analysis/src/check/wfcheck.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,15 +2199,15 @@ fn report_bivariance<'tcx>(
21992199
);
22002200

22012201
if !usage_spans.is_empty() {
2202-
// First, check if the ADT/LTA is (probably) cyclical. We say probably here, since we're
2202+
// First, check if the ADT is (probably) cyclical. We say probably here, since we're
22032203
// not actually looking into substitutions, just walking through fields / the "RHS".
22042204
// We don't recurse into the hidden types of opaques or anything else fancy.
22052205
let item_def_id = item.owner_id.to_def_id();
22062206
let is_probably_cyclical =
22072207
IsProbablyCyclical { tcx, item_def_id, seen: Default::default() }
22082208
.visit_def(item_def_id)
22092209
.is_break();
2210-
// If the ADT/LTA is cyclical, then if at least one usage of the type parameter or
2210+
// If the ADT is cyclical, then if at least one usage of the type parameter or
22112211
// the `Self` alias is present in the, then it's probably a cyclical struct/ type
22122212
// alias, and we should call those parameter usages recursive rather than just saying
22132213
// they're unused...
@@ -2247,8 +2247,8 @@ fn report_bivariance<'tcx>(
22472247
}
22482248
}
22492249

2250-
/// Detects cases where an ADT/LTA is trivially cyclical -- we want to detect this so
2251-
/// we only mention that its parameters are used cyclically if the ADT/LTA is truly
2250+
/// Detects cases where an ADT is trivially cyclical -- we want to detect this so
2251+
/// we only mention that its parameters are used cyclically if the ADT is truly
22522252
/// cyclical.
22532253
///
22542254
/// Notably, we don't consider substitutions here, so this may have false positives.

‎compiler/rustc_hir_analysis/src/coherence/orphan.rs‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,6 @@ pub(crate) fn orphan_check_impl(
9797
);
9898

9999
if tcx.trait_is_auto(trait_def_id) {
100-
// Expand free alias types (e.g. lazy type aliases) so that the checks below operate
101-
// on the type the alias resolves to rather than the alias itself. Otherwise an impl
102-
// whose self type is an alias expanding to an otherwise valid nominal type would be
103-
// wrongly rejected, e.g. `unsafe impl Sync for Alias {}` where `type Alias = Local;`.
104-
// Expansion also reveals genuinely problematic self types (trait objects, opaque
105-
// types, type parameters), so those keep being rejected. See issue #157756.
106100
let self_ty = tcx.expand_free_alias_tys(trait_ref.self_ty());
107101

108102
// If the impl is in the same crate as the auto-trait, almost anything

‎compiler/rustc_hir_analysis/src/outlives/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub(super) fn inferred_outlives_of(
4747
}
4848

4949
pub(super) fn inferred_outlives_crate(tcx: TyCtxt<'_>, (): ()) -> CrateClausesMap<'_> {
50-
// Compute a map from each ADT (struct/enum/union) and lazy type alias to
50+
// Compute a map from each ADT (struct/enum/union) and checked type alias to
5151
// the **explicit** outlives clauses (`T: 'a`, `'a: 'b`) that the user wrote.
5252
// Typically there won't be many of these, except in older code where
5353
// they were mandatory. Nonetheless, we have to ensure that every such

‎compiler/rustc_middle/src/queries.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ rustc_queries! {
308308

309309
/// Returns the *type* of the definition given by `DefId`.
310310
///
311-
/// For type aliases (whether eager or lazy) and associated types, this returns
311+
/// For type aliases (whether unchecked or checked) and associated types, this returns
312312
/// the underlying aliased type (not the corresponding [alias type]).
313313
///
314314
/// For opaque types, this returns and thus reveals the hidden type! If you

‎tests/ui/README.md‎

Lines changed: 1 addition & 1 deletion

‎tests/ui/associated-inherent-types/type-alias-bounds.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
// FIXME(inherent_associated_types):
88
// While we currently do take some clauses of the ParamEnv into consideration
99
// when performing IAT selection, we do not perform full well-formedness checking
10-
// for (eager) type alias definition and usage sites.
10+
// for (unchecked) type alias definition and usage sites.
1111
//
1212
// Therefore it's *correct* for lint `type_alias_bounds` to fire here despite the
1313
// fact that removing `Bound` from `T` in `Alias` would lead to an error!
1414
//
1515
// Obviously, the present situation isn't ideal and we should fix it in one way
1616
// or another. Either we somehow delay IAT selection until after HIR ty lowering
17-
// to avoid the need to specify any bounds inside (eager) type aliases or we
18-
// force the overarching type alias to be *lazy* (similar to TAITs) which would
17+
// to avoid the need to specify any bounds inside (unchecked) type aliases or we
18+
// force the overarching type alias to be *checked* (similar to TAITs) which would
1919
// automatically lead to full wfchecking and lint TAB getting suppressed.
2020

2121
pub type Alias<T: Bound> = (Source<T>::Assoc,);

‎tests/ui/checked-type-alias/extern-crate-has-lazy-type-aliases.rs‎

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/ui/checked-type-alias/auto-trait-impls.rs renamed to tests/ui/checked-type-aliases/auto-trait-impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Auto-trait impls whose self type is a free (lazy) type alias are checked against the
1+
//! Auto-trait impls whose self type is a free alias type are checked against the
22
//! type the alias *expands* to, not the alias itself. An alias resolving to an otherwise
33
//! valid nominal type is accepted, just as if the underlying type had been written
44
//! directly; an alias resolving to a problematic type is still rejected.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)