Skip to content

Rename lazy_type_alias feature gate to checked_type_aliases #158758

Open
josetorrs wants to merge 4 commits into
rust-lang:mainfrom
josetorrs:rename-lazy-type-alias
Open

Rename lazy_type_alias feature gate to checked_type_aliases #158758
josetorrs wants to merge 4 commits into
rust-lang:mainfrom
josetorrs:rename-lazy-type-alias

Conversation

@josetorrs

@josetorrs josetorrs commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

there's not an open issue for it, though happy to create one if desired, but this is the zulip thread. basically just did a cmd+shift+F on VSCode

r? @lcnr

cc: @BoxyUwU

@rustbot rustbot added A-rustc-dev-guide Area: rustc-dev-guide S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rust-analyzer Relevant to the rust-analyzer 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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jul 4, 2026
Comment on lines 1 to 2
#![feature(checked_free_type_aliases)]

@josetorrs josetorrs Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for these, the directory is tests/ui/lazy-type-alias/... but I wasn't sure if I should rename this TBH

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, yes, since I named this directory after the feature name. It currently exercises both the "checkedness" and the "laziness" ("retainedness") of LTA.

@josetorrs josetorrs changed the title Rename lazy_type_alias to checked_free_type_aliases Rename lazy_type_alias feature gate to checked_free_type_aliases Jul 4, 2026
@josetorrs josetorrs marked this pull request as ready for review July 4, 2026 03:13
@rustbot

rustbot commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

HIR ty lowering was modified

cc @fmease

rustc-dev-guide is developed in its own repository. If possible, consider making this change to rust-lang/rustc-dev-guide instead.

cc @BoxyUwU, @tshepang

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 4, 2026
let ty = tcx.type_of(def_id).instantiate_identity();
let span = tcx.def_span(def_id);
if tcx.type_alias_is_lazy(def_id) {
if tcx.type_alias_is_free(def_id) {

@fmease fmease Jul 4, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All type aliases are free, that's their very nature. This function is returning (1) whether to check the type alias for well-formedness (2) whether to lower its use sites to an alias type instead of eagerly expanding them to the aliased type during HIR ty lowering.

This should probably say type_alias_is_checked.

If I split this feature into unchecked & checked in the future I guess I need to come up with a new way of expressing eager vs. lazy, maybe unretained vs. retained 🤔

View changes since the review

}
self.check_type_no_bounds(bounds, "this context");

if self.features.lazy_type_alias() {

@fmease fmease Jul 4, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Personally speaking, I'm voting for checked_type_aliases, cc #t-types/lazy-type-alias > name bikeshed @ 💬)

View changes since the review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the poll is unanimous with renaming to checked_type_alias. I think I should be good with changing it along with renaming the test directory per #158758 (comment) to tests/ui/checked-type-alias/... (?) and this rename

I didn't vote in the poll as I didn't want to pretend I 100% fully understood everything haha

Comment on lines 1 to 2
#![feature(checked_free_type_aliases)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, yes, since I named this directory after the feature name. It currently exercises both the "checkedness" and the "laziness" ("retainedness") of LTA.

deny_since: None,
},
Lint {
label: "lazy_type_alias",

@ChayimFriedman2 ChayimFriedman2 Jul 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not change this file. It is auto-generated.

View changes since the review

@ShoyuVanilla ShoyuVanilla Jul 7, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please remove the changes to this file completely, e.g., by interactive rebase-editing the commit 49c4377 or squashing commits rather than adding another commit undoing it?
We do sync this repository with rust-lang/rust-analyzer bidirectionally and the cleaner history helps it being done automatically without hassle 😄

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 4, 2026
@rustbot

rustbot commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@josetorrs josetorrs force-pushed the rename-lazy-type-alias branch from 06051f4 to e47a599 Compare July 7, 2026 02:04
@rustbot

This comment has been minimized.

@josetorrs josetorrs force-pushed the rename-lazy-type-alias branch from e47a599 to d6a0757 Compare July 7, 2026 02:09
@rust-log-analyzer

This comment has been minimized.

@josetorrs josetorrs force-pushed the rename-lazy-type-alias branch from d6a0757 to c3cbfbe Compare July 7, 2026 12:18
@rust-bors

This comment has been minimized.

@josetorrs josetorrs force-pushed the rename-lazy-type-alias branch from c3cbfbe to 583deec Compare July 13, 2026 14:19
@rustbot

rustbot commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@josetorrs josetorrs changed the title Rename lazy_type_alias feature gate to checked_free_type_aliases Rename lazy_type_alias feature gate to checked_type_aliases Jul 13, 2026
@josetorrs josetorrs force-pushed the rename-lazy-type-alias branch from 6e62d29 to a8d4284 Compare July 13, 2026 15:59
@josetorrs

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 13, 2026
@rust-bors

rust-bors Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #159293) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

@lcnr lcnr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me after minor issue

View changes since this review

Comment thread tests/ui/README.md

## `tests/ui/checked-type-alias/`

Tests for `#![feature(checked_type_aliases)]`. See [Tracking issue for lazy type aliases #112792](https://github.com/rust-lang/rust/issues/112792).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Tests for `#![feature(checked_type_aliases)]`. See [Tracking issue for lazy type aliases #112792](https://github.com/rust-lang/rust/issues/112792).
Tests for `#![feature(checked_type_aliases)]`. See [Tracking issue for checked type aliases](https://github.com/rust-lang/rust/issues/112792).

@lcnr

lcnr commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

also needs a rebase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustc-dev-guide Area: rustc-dev-guide 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-rust-analyzer Relevant to the rust-analyzer 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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. 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.

7 participants