Skip to content

Don't build ParamEnv and do trait solving in ItemCtxts when lowering IATs #140247

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

Merged
merged 5 commits into from
Jun 19, 2025

Conversation

BoxyUwU
Copy link
Member

@BoxyUwU BoxyUwU commented Apr 24, 2025

Fixes #108491

Fixes #125879
This was due to updating inhabited predicate stuff which I had to do to make constructing ADTs with IATs in fields not ICE

Fixes #136678 (but no test added, I don't rly care about weird IAT edge cases under GCE)
Fixes #138131

Avoids doing "fully correct" candidate selection for IATs during hir ty lowering when in item signatures as it almost always leads to a query cycle from trying to build a ParamEnv. I replaced it with a use DeepRejectCtxt which should be able to handle this kind of conservative "could these types unify" while in a context where we don't want to do type equality.

This is a relatively simple scheme and should be forwards compatible with doing something more complex/powerful.

I'm not really sure how this interacts with #126651, though I'm also not really sure its super important to support projecting IATs from IAT self types given we don't even support T::Assoc::Other for trait-associated types so didn't give much thought to how this might fit in with that.

r? @compiler-errors
cc @fmease

@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. labels Apr 24, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 24, 2025

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.

HIR ty lowering was modified

cc @fmease

@bors
Copy link
Collaborator

bors commented Apr 28, 2025

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

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented May 22, 2025

📌 Commit 34ce403 has been approved by compiler-errors

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 May 22, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request May 22, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#135562 (Add ignore value suggestion in closure body)
 - rust-lang#139635 (Finalize repeat expr inference behaviour with inferred repeat counts)
 - rust-lang#139668 (Handle regions equivalent to 'static in non_local_bounds)
 - rust-lang#140218 (HIR ty lowering: Clean up & refactor the lowering of type-relative paths)
 - rust-lang#140435 (use uX::from instead of _ as uX in non - const contexts)
 - rust-lang#141130 (rustc_on_unimplemented cleanups)
 - rust-lang#141286 (Querify `coroutine_hidden_types`)

Failed merges:

 - rust-lang#140247 (Don't build `ParamEnv` and do trait solving in `ItemCtxt`s when lowering IATs)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented May 23, 2025

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

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 23, 2025
@BoxyUwU BoxyUwU force-pushed the iats_no_query_cycles branch 2 times, most recently from aee1a22 to 701d3b8 Compare May 23, 2025 14:25
@BoxyUwU
Copy link
Member Author

BoxyUwU commented May 23, 2025

I should probably update this to use DeepRejectCtxt and handle LTAs correctly like discussed at the all hands 🤔 I was just gonna do it in a followup PR but if I'm having to rebase and figure out new crashes tests then I may aswell just do it all now

@BoxyUwU BoxyUwU force-pushed the iats_no_query_cycles branch from 701d3b8 to 276daf2 Compare May 23, 2025 15:16
@BoxyUwU BoxyUwU force-pushed the iats_no_query_cycles branch from 276daf2 to 5867bb5 Compare May 23, 2025 16:22
@rust-log-analyzer

This comment has been minimized.

@BoxyUwU BoxyUwU force-pushed the iats_no_query_cycles branch from 5867bb5 to 02b87a8 Compare May 23, 2025 18:06
@BoxyUwU BoxyUwU force-pushed the iats_no_query_cycles branch from f4e04a9 to ae65625 Compare June 17, 2025 13:48
Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

nits, then r=me

@lcnr
Copy link
Contributor

lcnr commented Jun 18, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 18, 2025

📌 Commit e280d26 has been approved by lcnr

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 Jun 18, 2025
@rust-log-analyzer

This comment has been minimized.

Kobzol added a commit to Kobzol/rust that referenced this pull request Jun 18, 2025
Don't build `ParamEnv` and do trait solving in `ItemCtxt`s when lowering IATs

Fixes rust-lang#108491

Fixes rust-lang#125879
This was due to updating inhabited predicate stuff which I had to do to make constructing ADTs with IATs in fields not ICE

Fixes rust-lang#136678 (but no test added, I don't rly care about weird IAT edge cases under GCE)
Fixes rust-lang#138131

Avoids doing "fully correct" candidate selection for IATs during hir ty lowering when in item signatures as it almost always leads to a query cycle from trying to build a `ParamEnv`. I replaced it with a use `DeepRejectCtxt` which should be able to handle this kind of conservative "could these types unify" while in a context where we don't want to do type equality.

This is a relatively simple scheme and should be forwards compatible with doing something more complex/powerful.

I'm not really sure how this interacts with rust-lang#126651, though I'm also not really sure its super important to support projecting IATs from IAT self types given we don't even support `T::Assoc::Other` for trait-associated types so didn't give much thought to how this might fit in with that.

r? `@compiler-errors`
cc `@fmease`
@Kobzol
Copy link
Contributor

Kobzol commented Jun 18, 2025

@bors r-

PR CI failed.

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 18, 2025
@BoxyUwU BoxyUwU force-pushed the iats_no_query_cycles branch from e280d26 to 377d8fa Compare June 18, 2025 16:51
@BoxyUwU
Copy link
Member Author

BoxyUwU commented Jun 18, 2025

@bors r=lcnr

@bors
Copy link
Collaborator

bors commented Jun 18, 2025

📌 Commit 377d8fa has been approved by lcnr

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 18, 2025
bors added a commit that referenced this pull request Jun 19, 2025
Rollup of 7 pull requests

Successful merges:

 - #140247 (Don't build `ParamEnv` and do trait solving in `ItemCtxt`s when lowering IATs)
 - #142507 (use `#[align]` attribute for `fn_align`)
 - #142524 (Weekly `cargo update`)
 - #142606 (AsyncDrop trait without sync Drop generates an error)
 - #142639 (Add a missing colon at the end of the panic location details in location-detail-unwrap-multiline.rs)
 - #142654 (library: Increase timeout on mpmc test to reduce flakes)
 - #142692 (Assorted bootstrap cleanups (step 3))

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit cff8e9a into rust-lang:master Jun 19, 2025
10 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Inherent Associated Types (IAT) Jun 19, 2025
@rustbot rustbot added this to the 1.89.0 milestone Jun 19, 2025
rust-timer added a commit that referenced this pull request Jun 19, 2025
Rollup merge of #140247 - BoxyUwU:iats_no_query_cycles, r=lcnr

Don't build `ParamEnv` and do trait solving in `ItemCtxt`s when lowering IATs

Fixes #108491

Fixes #125879
This was due to updating inhabited predicate stuff which I had to do to make constructing ADTs with IATs in fields not ICE

Fixes #136678 (but no test added, I don't rly care about weird IAT edge cases under GCE)
Fixes #138131

Avoids doing "fully correct" candidate selection for IATs during hir ty lowering when in item signatures as it almost always leads to a query cycle from trying to build a `ParamEnv`. I replaced it with a use `DeepRejectCtxt` which should be able to handle this kind of conservative "could these types unify" while in a context where we don't want to do type equality.

This is a relatively simple scheme and should be forwards compatible with doing something more complex/powerful.

I'm not really sure how this interacts with #126651, though I'm also not really sure its super important to support projecting IATs from IAT self types given we don't even support `T::Assoc::Other` for trait-associated types so didn't give much thought to how this might fit in with that.

r? `@compiler-errors`
cc `@fmease`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-inherent_associated_types `#![feature(inherent_associated_types)]` 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.
Projects
8 participants