-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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: Failing to compile gfx-backend-metal: Unexpected type for constructor #89393
Comments
Can also reproduce this when compiling on an Intel Macbook |
I've encountered the same error on a different platform (x86_64) when compiling this crate. The project doesn't use cargo so repro is nontrivial, but from our CI I can see that the ICE started occurring at 6df1d82 which is a rollup of #88950. Error output
Backtrace
|
Also seems to be hitting starlark-rust, https://github.com/facebookexperimental/starlark-rust, as per https://github.com/facebookexperimental/starlark-rust/runs/3764656763?check_suite_focus=true |
Somewhat minimized standalone testcase: pub trait Resources2 {
type BufferArray;
}
pub enum RenderCommand2<R: Resources2> {
BindBuffers { buffers: R::BufferArray },
}
pub struct Ref2;
impl<'a> Resources2 for &'a Ref2 {
type BufferArray = (&'a u32, &'a u32);
}
pub fn own_render2(com: RenderCommand2<&Ref2>) -> u32 {
match com {
RenderCommand2::BindBuffers {
buffers: (_buffers, _offsets),
} => 0,
}
} Builds on stable, fails on nightly. cc @Nadrieril |
Thanks for the minimization! Seems like we've hit #72476 again, but through a different code path. I'm investigating. |
I think #89448 might be another duplicate of this, triggered when compiling the |
This provides a child `raw` module that exposes a SymbolId representing the inner value of each of the static newtypes. This is needed in situations where the type must match and the type of the static symbol is not important. In particular, when comparing against runtime-allocated symbols in `match` expressions. It is also worth noting that this commit managed to hit a bug in Rustc that was fixed on 10/1/2021. We use nightly, and it doesn't seem that this occurred in stable, from bug reports. - rust-lang/rust#89393 - rust-lang/rust@5ab1245 - Original issue: rust-lang/rust#72476 The error was: compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs:1191:22: Unexpected type for `Single` constructor: <u32 as sym::symbol::SymbolIndexSize>::NonZero thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1146:9 This occurred because we were trying to use `SymbolId` as the type, which uses a projected type as its inner value: `SymbolId<Ix: SymbolIndexSize>(Ix::NonZero)`. This was not a problem with the static newtypes because their inner type was simply `SymbolId<Ix>`, which is not projected. This is one of the risks of using nightly. But, the point is: if you receive this error, upgrade your toolchain.
Repro
When compiling on an Apple M1 processor:
git clone https://github.com/gfx-rs/gfx.git cd gfx/src/backend/metal RUST_BACKTRACE=1 cargo check
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: