1
Fork 0

Rollup merge of #136325 - compiler-errors:indirectly, r=RalfJung

Delay a bug when indexing unsized slices

Fixes #136298

r? RalfJung or reassign
This commit is contained in:
Matthias Krüger 2025-01-31 12:28:18 +01:00 committed by GitHub
commit f1daf9e2c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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(