Skip to content

Remove weak alias terminology #140249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BoxyUwU
Copy link
Member

@BoxyUwU BoxyUwU commented Apr 24, 2025

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 ^^'

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Apr 24, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 24, 2025

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

changes to the core type system

cc @compiler-errors, @lcnr

changes to the core type system

cc @compiler-errors, @lcnr

HIR ty lowering was modified

cc @fmease

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

@BoxyUwU BoxyUwU force-pushed the remove_weak_alias_terminology branch from d095938 to 56d0c1c Compare April 24, 2025 10:44
@BoxyUwU
Copy link
Member Author

BoxyUwU commented Apr 24, 2025

I tried to just grep for weak anywhere in the compiler/tooling and see if its related to weak aliases or some unrelated usage like the Weak std type, the many places its used for weak aliases in linking, as part of the word tweak, etc. I might have missed some occurances though

@oli-obk
Copy link
Contributor

oli-obk commented Apr 24, 2025

which do not exist

Right. My assumption was that we would want to differentiate from strong type aliases that other languages have.

The rename seems fine to me tho, I find it unlikely we'll ever have strong type aliases

@BoxyUwU
Copy link
Member Author

BoxyUwU commented Apr 24, 2025

That distinction would be meaningful for all of our alias kinds right? Like AliasKind::Projection/Inherent are also not strong type aliases from other languages and are kind of "weak" aliases in some sense. I would imagine that if we were to have a weak/strong distinction it wouldnt be with an AliasKind::Strong but a separate axis that any of our existing aliases could either be weak or strong. Maybe I'm a little off base here though, I'm happy to be wrong here I just want to wind up at a state where I can make whatever naming scheme we have "seem intuitive" to contributors

@rust-log-analyzer

This comment has been minimized.

@BoxyUwU BoxyUwU force-pushed the remove_weak_alias_terminology branch from 56d0c1c to bdfeb8f Compare April 24, 2025 10:59
@oli-obk
Copy link
Contributor

oli-obk commented Apr 24, 2025

I don't think strong aliases make sense as sth for inherent or associated types. Strong aliases would be more like an adt that has its trait impls inferred from its aliased type. I have not seen any design for that which would work in Rust. I think the newtype pattern is more effective as it gives all the control and none of the issues, albeit requiring manual trait impls.

@lcnr
Copy link
Contributor

lcnr commented Apr 24, 2025

using free alias seems clearer to me, so 👍

@oli-obk
Copy link
Contributor

oli-obk commented Apr 28, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 28, 2025

📌 Commit bdfeb8f has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 28, 2025
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Apr 28, 2025
…ogy, 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 ^^'
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 28, 2025
…llaumeGomez

Rollup of 7 pull requests

Successful merges:

 - rust-lang#140056 (Fix a wrong error message in 2024 edition)
 - rust-lang#140220 (Fix detection of main function if there are expressions around it)
 - rust-lang#140249 (Remove `weak` alias terminology)
 - rust-lang#140316 (Introduce `BoxMarker` to improve pretty-printing correctness)
 - rust-lang#140347 (ci: clean more disk space in codebuild)
 - rust-lang#140349 (ci: use aws codebuild for the `dist-x86_64-linux` job)
 - rust-lang#140379 (rustc-dev-guide subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 28, 2025
…llaumeGomez

Rollup of 7 pull requests

Successful merges:

 - rust-lang#140056 (Fix a wrong error message in 2024 edition)
 - rust-lang#140220 (Fix detection of main function if there are expressions around it)
 - rust-lang#140249 (Remove `weak` alias terminology)
 - rust-lang#140316 (Introduce `BoxMarker` to improve pretty-printing correctness)
 - rust-lang#140347 (ci: clean more disk space in codebuild)
 - rust-lang#140349 (ci: use aws codebuild for the `dist-x86_64-linux` job)
 - rust-lang#140379 (rustc-dev-guide subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants