Closed
Description
const F: &'static dyn PartialEq<u32> = &7u32;
fn main() {
let a: &dyn PartialEq<u32> = &7u32;
match a {
F => panic!(),
_ => {}
}
}
causes an ICE on the current nightly
error: internal compiler error: src/librustc_mir_build/hair/pattern/_match.rs:363: cannot deref ByRef {
alloc: Allocation {
bytes: [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
],
relocations: Relocations(
SortedMap {
data: [
(
Size {
raw: 0,
},
(
(),
a2,
),
),
(
Size {
raw: 8,
},
(
(),
a4,
),
),
],
},
),
init_mask: InitMask {
blocks: [
65535,
],
len: Size {
raw: 16,
},
},
size: Size {
raw: 16,
},
align: Align {
pow2: 3,
},
mutability: Not,
extra: (),
},
offset: Size {
raw: 0,
},
}, dyn std::cmp::PartialEq<u32> -> dyn std::cmp::PartialEq<u32>
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:907:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Afaik this is caused by ty_is_partial_eq
being slightly too permissive
rust/src/librustc_mir_build/hair/pattern/const_to_pat.rs
Lines 143 to 157 in 997d953
See #71038 (comment) for more details.
Metadata
Metadata
Assignees
Labels
Relating to patterns and pattern matchingCategory: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.