Skip to content

Commit 5a7d658

Browse files
authored
fail loudly on unsized by-ref invariants (#1644)
replace the remaining todo!() paths for unsized by-ref values in src/value_and_place.rs with explicit bug!() failures. This makes invariant violations fail loudly instead of panicking via unfinished code paths,and without claiming support for unsized by-ref handling that is not actually implemented.
1 parent 8635445 commit 5a7d658

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/value_and_place.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ impl<'tcx> CValue<'tcx> {
204204
let (field_ptr, field_layout) = codegen_field(fx, ptr, None, layout, field);
205205
CValue::by_ref(field_ptr, field_layout)
206206
}
207-
CValueInner::ByRef(_, Some(_)) => todo!(),
207+
CValueInner::ByRef(_, Some(_)) => {
208+
bug!("value_field for unsized by-ref value not supported")
209+
}
208210
}
209211
}
210212

@@ -655,7 +657,13 @@ impl<'tcx> CPlace<'tcx> {
655657
flags,
656658
);
657659
}
658-
CValueInner::ByRef(_, Some(_)) => todo!(),
660+
CValueInner::ByRef(_from_ptr, Some(_extra)) => {
661+
bug!(
662+
"write_cvalue for unsized by-ref value not allowed: dst={:?} src={:?}",
663+
dst_layout.ty,
664+
from.layout().ty
665+
);
666+
}
659667
}
660668
}
661669
}

0 commit comments

Comments
 (0)