Stop ICEing on impossible predicates.

This commit is contained in:
Camille GILLOT 2024-06-26 14:21:13 +00:00
parent d7c59370ce
commit 61ede075bf

View file

@ -846,9 +846,10 @@ fn register_children<'tcx>(
if let ty::Ref(_, ref_ty, _) | ty::RawPtr(ref_ty, _) = ty.kind()
&& let ty::Slice(..) = ref_ty.kind()
// The user may have written a predicate like `[T]: Sized` in their where clauses,
// which makes slices scalars.
&& self.places[place].value_index.is_none()
{
assert!(self.places[place].value_index.is_none(), "slices are not scalars");
// Prepend new child to the linked list.
let len = self.places.push(PlaceInfo::new(Some(TrackElem::DerefLen)));
self.places[len].next_sibling = self.places[place].first_child;