diff options
| author | Boxy <rust@boxyuwu.dev> | 2025-04-24 11:31:33 +0100 |
|---|---|---|
| committer | Boxy <rust@boxyuwu.dev> | 2025-04-24 11:59:20 +0100 |
| commit | bdfeb8f36bb2716eb8f5aca32ba4f81563a6818b (patch) | |
| tree | 4651a63fdf66bd493f20dc9beceab66973ab044a /compiler/rustc_hir_analysis | |
| parent | 7f695232a80fa1833e2282f2577c5e1ff066bf39 (diff) | |
| download | rust-bdfeb8f36bb2716eb8f5aca32ba4f81563a6818b.tar.gz rust-bdfeb8f36bb2716eb8f5aca32ba4f81563a6818b.zip | |
Remove `weak` alias terminology
Diffstat (limited to 'compiler/rustc_hir_analysis')
7 files changed, 14 insertions, 14 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index 33d5a86beb3..425edc0e773 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -1991,7 +1991,7 @@ fn check_variances_for_type_defn<'tcx>( ItemKind::TyAlias(..) => { assert!( tcx.type_alias_is_lazy(item.owner_id), - "should not be computing variance of non-weak type alias" + "should not be computing variance of non-free type alias" ); } kind => span_bug!(item.span, "cannot compute the variances of {kind:?}"), @@ -2223,7 +2223,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for IsProbablyCyclical<'tcx> { fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<(), ()> { let def_id = match ty.kind() { ty::Adt(adt_def, _) => Some(adt_def.did()), - ty::Alias(ty::Weak, alias_ty) => Some(alias_ty.def_id), + ty::Alias(ty::Free, alias_ty) => Some(alias_ty.def_id), _ => None, }; if let Some(def_id) = def_id { diff --git a/compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs b/compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs index c9a9180c5c9..bd25b4a3260 100644 --- a/compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs +++ b/compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs @@ -150,7 +150,7 @@ impl<'tcx> InherentCollect<'tcx> { let id = id.owner_id.def_id; let item_span = self.tcx.def_span(id); let self_ty = self.tcx.type_of(id).instantiate_identity(); - let mut self_ty = self.tcx.peel_off_weak_alias_tys(self_ty); + let mut self_ty = self.tcx.peel_off_free_alias_tys(self_ty); // We allow impls on pattern types exactly when we allow impls on the base type. // FIXME(pattern_types): Figure out the exact coherence rules we want here. while let ty::Pat(base, _) = *self_ty.kind() { @@ -188,7 +188,7 @@ impl<'tcx> InherentCollect<'tcx> { | ty::CoroutineClosure(..) | ty::Coroutine(..) | ty::CoroutineWitness(..) - | ty::Alias(ty::Weak, _) + | ty::Alias(ty::Free, _) | ty::Bound(..) | ty::Placeholder(_) | ty::Infer(_) => { diff --git a/compiler/rustc_hir_analysis/src/coherence/orphan.rs b/compiler/rustc_hir_analysis/src/coherence/orphan.rs index 74ba4ffe25e..c75fef9f716 100644 --- a/compiler/rustc_hir_analysis/src/coherence/orphan.rs +++ b/compiler/rustc_hir_analysis/src/coherence/orphan.rs @@ -189,7 +189,7 @@ pub(crate) fn orphan_check_impl( ty::Projection => "associated type", // type Foo = (impl Sized, bool) // impl AutoTrait for Foo {} - ty::Weak => "type alias", + ty::Free => "type alias", // type Opaque = impl Trait; // impl AutoTrait for Opaque {} ty::Opaque => "opaque type", diff --git a/compiler/rustc_hir_analysis/src/constrained_generic_params.rs b/compiler/rustc_hir_analysis/src/constrained_generic_params.rs index 951eda72ffe..366b3943a05 100644 --- a/compiler/rustc_hir_analysis/src/constrained_generic_params.rs +++ b/compiler/rustc_hir_analysis/src/constrained_generic_params.rs @@ -49,7 +49,7 @@ pub(crate) fn parameters_for<'tcx>( include_nonconstraining: bool, ) -> Vec<Parameter> { let mut collector = ParameterCollector { parameters: vec![], include_nonconstraining }; - let value = if !include_nonconstraining { tcx.expand_weak_alias_tys(value) } else { value }; + let value = if !include_nonconstraining { tcx.expand_free_alias_tys(value) } else { value }; value.visit_with(&mut collector); collector.parameters } @@ -68,9 +68,9 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ParameterCollector { { return; } - // All weak alias types should've been expanded beforehand. - ty::Alias(ty::Weak, _) if !self.include_nonconstraining => { - bug!("unexpected weak alias type") + // All free alias types should've been expanded beforehand. + ty::Alias(ty::Free, _) if !self.include_nonconstraining => { + bug!("unexpected free alias type") } ty::Param(param) => self.parameters.push(Parameter::from(param)), _ => {} diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs index 22162b8b364..8153e6f87f8 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs @@ -958,7 +958,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { // feature `lazy_type_alias` enabled get encoded as a type alias that normalization will // then actually instantiate the where bounds of. let alias_ty = ty::AliasTy::new_from_args(tcx, did, args); - Ty::new_alias(tcx, ty::Weak, alias_ty) + Ty::new_alias(tcx, ty::Free, alias_ty) } else { tcx.at(span).type_of(did).instantiate(tcx, args) } diff --git a/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs b/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs index 780c27d4595..c99eb12efcc 100644 --- a/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs +++ b/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs @@ -157,10 +157,10 @@ fn insert_required_predicates_to_be_wf<'tcx>( ); } - ty::Alias(ty::Weak, alias) => { + ty::Alias(ty::Free, alias) => { // This corresponds to a type like `Type<'a, T>`. // We check inferred and explicit predicates. - debug!("Weak"); + debug!("Free"); check_inferred_predicates( tcx, alias.def_id, diff --git a/compiler/rustc_hir_analysis/src/variance/constraints.rs b/compiler/rustc_hir_analysis/src/variance/constraints.rs index 23223de918c..dc3ce1dd76c 100644 --- a/compiler/rustc_hir_analysis/src/variance/constraints.rs +++ b/compiler/rustc_hir_analysis/src/variance/constraints.rs @@ -107,7 +107,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { let current_item = &CurrentItem { inferred_start }; let ty = tcx.type_of(def_id).instantiate_identity(); - // The type as returned by `type_of` is the underlying type and generally not a weak projection. + // The type as returned by `type_of` is the underlying type and generally not a free alias. // Therefore we need to check the `DefKind` first. if let DefKind::TyAlias = tcx.def_kind(def_id) && tcx.type_alias_is_lazy(def_id) @@ -282,7 +282,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { self.add_constraints_from_invariant_args(current, data.args, variance); } - ty::Alias(ty::Weak, ref data) => { + ty::Alias(ty::Free, ref data) => { self.add_constraints_from_args(current, data.def_id, data.args, variance); } |
