1
Fork 0

Adjust computation of place types to detect more invalid places

This commit is contained in:
Jakob Degen 2022-03-24 18:25:37 -04:00
parent dae5c842fc
commit 2f4a7a0742
2 changed files with 12 additions and 1 deletions

View file

@ -76,6 +76,9 @@ impl<'tcx> PlaceTy<'tcx> {
V: ::std::fmt::Debug,
T: ::std::fmt::Debug + Copy,
{
if self.variant_index.is_some() && !matches!(elem, ProjectionElem::Field(..)) {
bug!("cannot use non field projection on downcasted place")
}
let answer = match *elem {
ProjectionElem::Deref => {
let ty = self