-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 In rustc_mir::monomorphize::collector
#86469
Comments
significantly reduced: use std::ptr;
trait Context {
type BindGroupLayoutId;
}
pub struct C;
pub struct BindGroupLayout {
id: <C as Context>::BindGroupLayoutId,
}
impl Context for C {
type BindGroupLayoutId = ();
}
pub fn main() {
let y: *const BindGroupLayout = ptr::null();
let mut hasher = std::collections::hash_map::DefaultHasher::default();
std::ptr::hash(y, &mut hasher);
} |
Without using trait Trait {
type Associated;
}
pub struct T;
impl Trait for T {
type Associated = ();
}
pub struct Struct {
_field: <T as Trait>::Associated,
}
struct H;
impl core::hash::Hasher for H {
fn finish(&self) -> u64 {
todo!()
}
fn write(&mut self, _: &[u8]) {
todo!()
}
}
pub fn main() {
let y: *const Struct = core::ptr::null();
core::hash::Hash::hash(&y, &mut H);
} |
Unwrapping the #![feature(ptr_metadata)]
use core::ptr::Pointee;
trait Trait {
type Associated;
}
pub struct T;
impl Trait for T {
type Associated = ();
}
pub struct Struct {
_field: <T as Trait>::Associated,
}
struct H;
impl core::hash::Hasher for H {
fn finish(&self) -> u64 {
todo!()
}
fn write(&mut self, _: &[u8]) {
todo!()
}
}
fn panic<T>() -> T {
panic!()
}
pub fn main() {
use core::hash::Hash;
let metadata: <Struct as Pointee>::Metadata = panic();
metadata.hash(&mut H);
} Or using something other than #![feature(ptr_metadata)]
use core::ptr::Pointee;
trait Trait {
type Associated;
}
pub struct T;
impl Trait for T {
type Associated = ();
}
pub struct Struct {
_field: <T as Trait>::Associated,
}
fn panic<T>() -> T {
panic!()
}
pub fn main() {
let metadata: <Struct as Pointee>::Metadata = panic();
metadata == metadata;
} With no usage at all, the ICE changes: #![feature(ptr_metadata)]
use core::ptr::Pointee;
trait Trait {
type Associated;
}
pub struct T;
impl Trait for T {
type Associated = ();
}
pub struct Struct {
_field: <T as Trait>::Associated,
}
pub fn main() {
let _x: <Struct as Pointee>::Metadata;
}
|
Bisecting #86469 (comment), regression at: d1462d8, which is #81172, cc @SimonSapin. This issue is a recent regression (stable @rustbot label -E-needs-mcve, regression-from-stable-to-stable. |
This comment has been minimized.
This comment has been minimized.
Looks like this is a duplicate of #85447 |
I'm getting an ICE when compiling some of my code.
Unfortunately, it has resisted all my attempts at producing a smaller code sample. It's very finicky.
I have uploaded a reproducible repo here: https://github.com/HalfVoxel/graphica/tree/rustc-replicate, unfortunately it's quite a lot of code. The code that seems to trigger it is this:
However, I have been unable to replicate it in a smaller project.
Meta
rustc --version --verbose
:The bug exists both in the current nightly compiler and the current stable compiler.
Error output
This is the location in rustc where it crashes:
Backtrace
The text was updated successfully, but these errors were encountered: