ICE in object_safety.rs due to method receiver not having a layout #57276
Labels
C-bug
Category: This is a bug.
F-arbitrary_self_types
`#![feature(arbitrary_self_types)]`
F-dispatch_from_dyn
`#![feature(dispatch_from_dyn)]`
glacier
ICE tracked in rust-lang/glacier.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
requires-nightly
This issue requires a nightly compiler in some way.
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.
The following code causes an ICE,
Error: the type `T` has an unknown layout
:Similar to #56806,
receiver_is_dispatchable
succeeds, and then there is an ICE during the layout sanity checks. In this case, it is because the method receiver is a type parameter and has no layout.receiver_is_dispatchable
checks that the following predicate holds:In this case, it reduces to
T: DispatchFromDyn<T>
, which is provided by a where clause. In #56806, it reduced toBox<dyn Trait>: DispatchFromDyn<Box<dyn Trait>>
. The check passes in both cases, and then there is an ICE during the layout sanity checks.One way to fix both of these cases would be to add an extra requirement to
receiver_is_dispatchable
: thatReceiver
andReceiver[Self => U]
are not the same type. I'm not sure if there are any edge cases that that doesn't cover.cc @varkor #57229
The text was updated successfully, but these errors were encountered: