note for ty::Error.

This commit is contained in:
Bastian Kauschke 2020-05-12 23:35:29 +02:00
parent 038523963a
commit ecab35b45a

View File

@ -187,8 +187,7 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
| ty::Uint(_)
| ty::Float(_)
| ty::Str
| ty::Never
| ty::Error => {
| ty::Never => {
// These primitive types are always structural match.
//
// `Never` is kind of special here, but as it is not inhabitable, this should be fine.
@ -200,17 +199,25 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
| ty::Ref(..)
| ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::Tuple(..)
| ty::Projection(..)
| ty::UnnormalizedProjection(..)
| ty::Opaque(..)
| ty::Bound(..)
| ty::Placeholder(_)
| ty::Infer(_) => {
| ty::GeneratorWitness(..) => {
ty.super_visit_with(self);
return false;
}
| ty::Infer(_)
| ty::Placeholder(_)
| ty::UnnormalizedProjection(..)
| ty::Bound(..) => {
bug!("unexpected type during structural-match checking: {:?}", ty);
}
ty::Error => {
self.tcx().delay_span_bug(self.span, "ty::Error in structural-match check");
// We still want to check other types after encountering an error,
// as this may still emit relevant errors.
return false;
}
};
if !self.seen.insert(adt_def.did) {