-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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: expected wide pointer extra data (e.g. slice length or trait object vtable)
#127742
Comments
Minimized: struct Vtable(dyn Cap); // missing lifetime
trait Cap<'a> {}
union Transmute {
t: u64, // ICEs with u64, u128, or usize. Correctly errors with u32.
u: &'static Vtable,
}
const G: &'static Vtable = unsafe { Transmute { t: 1 }.u }; |
searched nightlies: from nightly-2023-11-11 to nightly-2024-07-15 (both the original and the minimized version) |
@rustbot claim |
The error originates from layout miscalculation of ill-formed type. rust/compiler/rustc_ty_utils/src/layout.rs Lines 204 to 205 in 176e545
|
A more detailed analysis: rust/compiler/rustc_const_eval/src/interpret/place.rs Lines 407 to 414 in e57f309
rust/compiler/rustc_const_eval/src/interpret/operand.rs Lines 107 to 110 in e57f309
Our resulting const value is a Scalar , allocated according to its layout. So its layout calculation must go wrong.As I mentioned in previous comment, it mistook the pointee(trait object wrapper) as sized. The cause is that our trait object type contains error, more specifically its region contains error. rust/compiler/rustc_ty_utils/src/ty.rs Lines 97 to 99 in 176e545
And is_trivially_sized thinks ty::Error is sized.rust/compiler/rustc_middle/src/ty/sty.rs Lines 1805 to 1806 in 176e545
|
The analysis is based on the minimized code above and the trait object I'm talking about is |
Code
Meta
rustc --version --verbose
:Error output
Backtrace
Note
ICE location
rust/compiler/rustc_const_eval/src/interpret/place.rs
Lines 33 to 42 in fcaa6fd
The text was updated successfully, but these errors were encountered: