Rollup merge of #89147 - b-naber:refs_in_check_const_value_eq, r=oli-obk
add case for checking const refs in check_const_value_eq Previously in `check_const_value_eq` we destructured `ConstValue::ByRef` instances, this didn't account for `ty::Ref`s however, which led to an ICE. Fixes https://github.com/rust-lang/rust/issues/88876 Fixes https://github.com/rust-lang/rust/issues/88384 r? `@oli-obk`
This commit is contained in:
commit
a3e6c19acf
4 changed files with 57 additions and 0 deletions
|
@ -639,6 +639,15 @@ fn check_const_value_eq<R: TypeRelation<'tcx>>(
|
|||
get_slice_bytes(&tcx, a_val) == get_slice_bytes(&tcx, b_val)
|
||||
}
|
||||
|
||||
(ConstValue::ByRef { alloc: alloc_a, .. }, ConstValue::ByRef { alloc: alloc_b, .. })
|
||||
if a.ty.is_ref() || b.ty.is_ref() =>
|
||||
{
|
||||
if a.ty.is_ref() && b.ty.is_ref() {
|
||||
alloc_a == alloc_b
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
(ConstValue::ByRef { .. }, ConstValue::ByRef { .. }) => {
|
||||
let a_destructured = tcx.destructure_const(relation.param_env().and(a));
|
||||
let b_destructured = tcx.destructure_const(relation.param_env().and(b));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue