Assert that MemCategorizationVisitor actually errors when it bails ungracefully
This commit is contained in:
parent
dde8cfa597
commit
5808c5801d
@ -131,9 +131,15 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
|
|||||||
match ty {
|
match ty {
|
||||||
Some(ty) => {
|
Some(ty) => {
|
||||||
let ty = self.resolve_vars_if_possible(ty);
|
let ty = self.resolve_vars_if_possible(ty);
|
||||||
if ty.references_error() || ty.is_ty_var() {
|
if ty.references_error() {
|
||||||
debug!("resolve_type_vars_or_error: error from {:?}", ty);
|
debug!("resolve_type_vars_or_error: error from {:?}", ty);
|
||||||
Err(())
|
Err(())
|
||||||
|
} else if ty.is_ty_var() {
|
||||||
|
debug!("resolve_type_vars_or_error: infer var from {:?}", ty);
|
||||||
|
self.tcx()
|
||||||
|
.dcx()
|
||||||
|
.span_delayed_bug(self.tcx().hir().span(id), "encountered type variable");
|
||||||
|
Err(())
|
||||||
} else {
|
} else {
|
||||||
Ok(ty)
|
Ok(ty)
|
||||||
}
|
}
|
||||||
@ -210,6 +216,9 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
|
|||||||
Some(ty) => Ok(ty),
|
Some(ty) => Ok(ty),
|
||||||
None => {
|
None => {
|
||||||
debug!("By-ref binding of non-derefable type");
|
debug!("By-ref binding of non-derefable type");
|
||||||
|
self.tcx()
|
||||||
|
.dcx()
|
||||||
|
.span_delayed_bug(pat.span, "by-ref binding of non-derefable type");
|
||||||
Err(())
|
Err(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -488,6 +497,10 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
|
|||||||
Some(pointee_ty) => pointee_ty,
|
Some(pointee_ty) => pointee_ty,
|
||||||
None => {
|
None => {
|
||||||
debug!("explicit deref of non-derefable type: {:?}", base_curr_ty);
|
debug!("explicit deref of non-derefable type: {:?}", base_curr_ty);
|
||||||
|
self.tcx().dcx().span_delayed_bug(
|
||||||
|
self.tcx().hir().span(node.hir_id()),
|
||||||
|
"explicit deref of non-derefable type",
|
||||||
|
);
|
||||||
return Err(());
|
return Err(());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -732,6 +745,9 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
|
|||||||
PatKind::Slice(before, ref slice, after) => {
|
PatKind::Slice(before, ref slice, after) => {
|
||||||
let Some(element_ty) = place_with_id.place.ty().builtin_index() else {
|
let Some(element_ty) = place_with_id.place.ty().builtin_index() else {
|
||||||
debug!("explicit index of non-indexable type {:?}", place_with_id);
|
debug!("explicit index of non-indexable type {:?}", place_with_id);
|
||||||
|
self.tcx()
|
||||||
|
.dcx()
|
||||||
|
.span_delayed_bug(pat.span, "explicit index of non-indexable type");
|
||||||
return Err(());
|
return Err(());
|
||||||
};
|
};
|
||||||
let elt_place = self.cat_projection(
|
let elt_place = self.cat_projection(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user