-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
ICE on inline const pattern using const generic parameter #90150
Labels
A-const-generics
Area: const generics (parameters and arguments)
C-bug
Category: This is a bug.
F-generic_const_exprs
`#![feature(generic_const_exprs)]`
F-inline_const
Inline constants (aka: const blocks, const expressions, anonymous constants)
glacier
ICE tracked in rust-lang/glacier.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
Esper89
added
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Oct 22, 2021
@rustbot label +A-const-generics |
rustbot
added
the
A-const-generics
Area: const generics (parameters and arguments)
label
Oct 22, 2021
JohnTitor
added
F-generic_const_exprs
`#![feature(generic_const_exprs)]`
F-inline_const
Inline constants (aka: const blocks, const expressions, anonymous constants)
requires-nightly
This issue requires a nightly compiler in some way.
labels
Oct 22, 2021
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Nov 23, 2021
Split inline const to two feature gates and mark expression position inline const complete This PR splits inline const in pattern position into its own `#![feature(inline_const_pat)]` feature gate, and make the usage in expression position complete. I think I have resolved most outstanding issues related to `inline_const` with rust-lang#89561 and other PRs. The only thing left that I am aware of is rust-lang#90150 and the lack of lifetime checks when inline const is used in pattern position (FIXME in rust-lang#89561). Implementation-wise when used in pattern position it has to be lowered during MIR building while in expression position it's evaluated only when monomorphizing (just like normal consts), so it makes some sense to separate it into two feature gates so one can progress without being blocked by another. `@rustbot` label: T-compiler F-inline_const
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Nov 23, 2021
Split inline const to two feature gates and mark expression position inline const complete This PR splits inline const in pattern position into its own `#![feature(inline_const_pat)]` feature gate, and make the usage in expression position complete. I think I have resolved most outstanding issues related to `inline_const` with rust-lang#89561 and other PRs. The only thing left that I am aware of is rust-lang#90150 and the lack of lifetime checks when inline const is used in pattern position (FIXME in rust-lang#89561). Implementation-wise when used in pattern position it has to be lowered during MIR building while in expression position it's evaluated only when monomorphizing (just like normal consts), so it makes some sense to separate it into two feature gates so one can progress without being blocked by another. ``@rustbot`` label: T-compiler F-inline_const
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Dec 8, 2021
Evaluate inline const pat early and report error if too generic Fix rust-lang#90150 `@rustbot` label: T-compiler F-inline_const
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Dec 8, 2021
Evaluate inline const pat early and report error if too generic Fix rust-lang#90150 ``@rustbot`` label: T-compiler F-inline_const
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Dec 8, 2021
Evaluate inline const pat early and report error if too generic Fix rust-lang#90150 ```@rustbot``` label: T-compiler F-inline_const
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-const-generics
Area: const generics (parameters and arguments)
C-bug
Category: This is a bug.
F-generic_const_exprs
`#![feature(generic_const_exprs)]`
F-inline_const
Inline constants (aka: const blocks, const expressions, anonymous constants)
glacier
ICE tracked in rust-lang/glacier.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Using a const parameter in an inline const pattern causes an ICE, but only when you don't directly use the parameter. This seems to be the same problem as #82518, although under different circumstances.
Code
Using
const { N }
instead ofconst { foo(N) }
givesDisappointing, but undoubtedly the intended behavior.
The above example wouldn't be easy to come across naturally, but if the const parameter was (for example) an array and you tried to index it, the compiler would tell you to use a
const fn
to do that. This code causes the same ICE:I should note that this issue is only present with the
inline_const
feature and thegeneric_const_exprs
feature.Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: