Rollup merge of #140249 - BoxyUwU:remove_weak_alias_terminology, r=oli-obk

Remove `weak` alias terminology

I find the "weak" alias terminology to be quite confusing. It implies the existence of "strong" aliases (which do not exist) and I'm not really sure what about weak aliases is "weak". I much prefer "free alias" as the term. I think it's much more obvious what it means as "free function" is a well defined term that already exists in rust.

It's also a little confusing given "weak alias" is already a term in linker/codegen spaces which are part of the compiler too. Though I'm not particularly worried about that as it's usually very obvious if you're talking about the type system or not lol. I'm also currently trying to write documentation about aliases and it's somewhat awkward/confusing to be talking about *weak* aliases, when I'm not really sure what the basis for that as the term actually *is*.

I would also be happy to just find out there's a nice meaning behind calling them "weak" aliases :-)

r? `@oli-obk`

maybe we want a types MCP to decide on a specific naming here? or maybe we think its just too late to go back on this naming decision ^^'
This commit is contained in:
Guillaume Gomez
2025-04-28 13:30:45 +02:00
committed by GitHub
47 changed files with 106 additions and 106 deletions

View File

@@ -2019,7 +2019,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:?}"),
@@ -2251,7 +2251,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 {