rust
rust copied to clipboard
Reject overly generic assoc const binding types
Split off from #119385 to make #119385 easier to review.
In the instantiated type of assoc const bindings
- reject early-bound generic params
- Provide a rich error message instead of ICE'ing (#108271).
- This is a temporary and semi-artificial restriction until the arrival of generic const generics.
- It's quite possible that rustc could already perfectly support this subset of generic const generics if we just removed some checks (some
.no_bound_vars().expect(…)) but even if that was the case, I'd rather gate it behind a new feature flag. Reporting an error instead of ICE'ing is a good first step towards an eventual feature gate error.
- reject escaping late-bound generic params
- They lead to ICEs before & I'm pretty sure that they remain incorrect even in a world with generic const generics
https://github.com/rust-lang/rust/labels/S-waiting-on-author: I'd like to add more comments explaining why this approach was taken (why rustc_hir_analysis over rustc_resolve, why mod type_of was chosen over e.g. mod resolve_bound_vars, etc.) and I still need to get rid of some FIXMEs.
Together with #118668 (merged) & #119385, this supersedes #118360. Fixes #108271.
:umbrella: The latest upstream changes (presumably #122190) made this pull request unmergeable. Please resolve the merge conflicts.
Cool 👍
@bors r+
:pushpin: Commit 0b2fb8db6540b0548230cd335e7b2a845686f7ea has been approved by compiler-errors
It is now in the queue for this repository.