-
Notifications
You must be signed in to change notification settings - Fork 13.4k
ICE: did not expect inference variables here
(wfck)
#137813
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
Closed
matthiaskrgr opened this issue
Feb 28, 2025
· 6 comments
· Fixed by #140553 · May be fixed by #137972
Closed
ICE: did not expect inference variables here
(wfck)
#137813
matthiaskrgr opened this issue
Feb 28, 2025
· 6 comments
· Fixed by #140553 · May be fixed by #137972
Labels
C-bug
Category: This is a bug.
F-associated_const_equality
`#![feature(associated_const_equality)]`
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
S-bug-has-test
Status: This bug is tracked inside the repo by a `known-bug` test.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
seems to bisect to #132090 |
smaller struct A;
trait B<C> {
const D: u8;
}
impl<C> B<C> for A {
const D: u8 = 1;
}
trait E<F> {}
impl<F, G> E for G where G: B<F, D = {}> {}
impl<F> H where A: E<F> {} |
A bit more conceptually simpler:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Another example that triggers this bug: #![feature(associated_const_equality)]
pub trait NeedsDrop {
const NEEDS_DROP: bool;
}
impl<T> NeedsDrop for T {
const NEEDS_DROP: bool = std::mem::needs_drop::<T>();
}
pub trait Foo {}
impl<T> Foo for T where T: NeedsDrop<NEEDS_DROP = false> {}
fn foo(x: impl Foo) {}
fn bar() {
foo(32);
} |
compiler-errors
pushed a commit
to compiler-errors/rust
that referenced
this issue
May 23, 2025
…mpiler-errors Defer evaluating type system constants when they use infers or params Split out of rust-lang#137972, the parts necessary for associated const equality and min generic const args to make progress and have correct semantics around when CTFE is invoked. According to a [previous perf run](https://perf.rust-lang.org/compare.html?start=93257e2d20809d82d1bc0fcc1942480d1a66d7cd&end=01b4cbf0f47c3f782330db88fa5ba199bba1f8a2&stat=instructions:u) of adding the new `const_arg_kind` query we should expect minor regressions here. I think this is acceptable as we should be able to remove this query relatively soon once mgca is more complete as we'll then be able to implement GCE in terms of mgca and rip out `GCEConst` at which point it's trivial to determine what kind of anon const we're dealing with (either it has generics and is a repeat expr hack, or it doesnt and is a normal anon const). This should only affect unstable code as we handle repeat exprs specially and those are the only kinds of type system consts that are allowed to make use of generic parameters. Fixes rust-lang#133066 Fixes rust-lang#133199 Fixes rust-lang#136894 Fixes rust-lang#137813 r? compiler-errors
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: This is a bug.
F-associated_const_equality
`#![feature(associated_const_equality)]`
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
S-bug-has-test
Status: This bug is tracked inside the repo by a `known-bug` test.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
auto-reduced (treereduce-rust):
original code
original:
Version information
Possibly related line of code:
rust/compiler/rustc_middle/src/mir/interpret/queries.rs
Lines 99 to 111 in 2f58193
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zincremental-verify-ich=yes -Cincremental=<dir> -Cdebuginfo=2 -Clink-dead-code=true -Zvalidate-mir --edition=2024
Program output
The text was updated successfully, but these errors were encountered: