Skip to content

Conversation

BoxyUwU
Copy link
Member

@BoxyUwU BoxyUwU commented Dec 4, 2024

The type_of query for anon consts in the type system is actually implemented by feeding the return value during hir ty lowering, not the hir-based logic in const_arg_anon_type_of. The HIR based logic is incomplete (doesn't handle all hir nodes) and also generally wrong to call (re-lowers HIR or invokes typeck which can result in query cycles).

r? @compiler-errors

@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 Dec 4, 2024
@@ -1,6 +1,7 @@
//@ check-pass

// Regression test for #128176.
// Regression test for #128176. Previously we would call `type_of` on the `1` anon const
Copy link
Member Author

Choose a reason for hiding this comment

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

This test being an example of the hir-based logic being wrong resulting in an ICE, which was fixed by no longer calling type_of before the anon const had been lowered

@@ -3,8 +3,6 @@
trait X {
fn test() -> Self::Assoc<{ async {} }>;
//~^ ERROR associated type `Assoc` not found for `Self`
//~| ERROR associated type `Assoc` not found for `Self`
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the "const args in unresolved paths will not have type_of fed", previously we would attempt to use the hir based logic which re-lowered the hir path resulting in a second error, now we just use TyKind::Error.

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 4, 2024

📌 Commit 52d1c30 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 Dec 4, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 4, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#133737 (Include LLDB and GDB visualizers in MSVC distribution)
 - rust-lang#133774 (Make CoercePointee errors translatable)
 - rust-lang#133831 (Don't try and handle unfed `type_of` on anon consts)
 - rust-lang#133847 (Remove `-Zshow-span`.)
 - rust-lang#133849 (coverage: Use a separate counter type and simplification step during counter creation)
 - rust-lang#133850 (Avoid `opaque type not constrained` errors in the presence of other errors)
 - rust-lang#133851 (Stop git from merging generated files)
 - rust-lang#133856 (Update sysinfo version to 0.33.0)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e6d7ab2 into rust-lang:master Dec 4, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 4, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 4, 2024
Rollup merge of rust-lang#133831 - BoxyUwU:ice_on_unfed_type_of, r=compiler-errors

Don't try and handle unfed `type_of` on anon consts

The `type_of` query for anon consts in the type system is actually implemented by feeding the return value during hir ty lowering, not the hir-based logic in `const_arg_anon_type_of`. The HIR based logic is incomplete (doesn't handle all hir nodes) and also generally wrong to call (re-lowers HIR or invokes typeck which can result in query cycles).

r? `@compiler-errors`
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants