-
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: assertion failure: Size(0 bytes
/ 8 bytes)
rustc_const_eval/src/interpret/place.rs
#112623
Comments
Regression in nightly-2022-05-28
|
The issue seems to be that #![feature(const_trait_impl)]
#[const_trait]
trait Func {
fn trigger(self) -> usize;
}
struct Cls;
impl const Func for Cls {
fn trigger(&self, a: usize) -> usize {
0
}
}
enum Bug<T = [(); Cls.trigger()]> {
V(T),
} This ICEs with a mismatch in the number of args
|
Fixed on the latest nightly, marking as E-needs-test (or, feel free to close if we have a sufficient regression test) |
auto-reduced (treereduce-rust): #![feature(const_trait_impl, effects)]
#[const_trait]
trait Value {
fn value() -> u32;
}
const fn get_value<T: ~const Value>() -> u32 {
T::value()
}
struct FortyTwo;
impl const Value for FortyTwo {
fn value() -> i64 {
42
}
}
const FORTY_TWO: u32 = get_value::<FortyTwo>();
fn main() {
assert_eq!(FORTY_TWO, 42);
}
original: // Tests that a const default trait impl can be specialized by another const
// trait impl and that the specializing impl will be used during const-eval.
// run-pass
#![feature(const_trait_impl, effects)]
#![feature(min_specialization)]
#[const_trait]
trait Value {
fn value() -> u32;
}
const fn get_value<T: ~const Value>() -> u32 {
T::value()
}
impl<T> const Value for T {
default fn value() -> u32 {
0
}
}
struct FortyTwo;
impl const Value for FortyTwo {
fn value() -> i64 {
42
}
}
const ZERO: u32 = get_value::<()>();
const FORTY_TWO: u32 = get_value::<FortyTwo>();
fn main() {
assert_eq!(ZERO, 0);
assert_eq!(FORTY_TWO, 42);
} Version information
Command: Program output
|
Code
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: