Adjust computation of place types to detect more invalid places
This commit is contained in:
parent
dae5c842fc
commit
2f4a7a0742
2 changed files with 12 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue