Delay a bug when indexing unsized slices

This commit is contained in:
Michael Goulet 2025-01-31 00:11:55 +00:00
parent a6434ef9c0
commit d6e8c7f7a0
3 changed files with 48 additions and 1 deletions

View file

@ -634,7 +634,12 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
Rvalue::RawPtr(RawPtrKind::FakeForPtrMetadata, place) => {
// These are only inserted for slice length, so the place must already be indirect.
// This implies we do not have to worry about whether the borrow escapes.
assert!(place.is_indirect(), "fake borrows are always indirect");
if !place.is_indirect() {
self.tcx.dcx().span_delayed_bug(
self.body.source_info(location).span,
"fake borrows are always indirect",
);
}
}
Rvalue::Cast(