1
Fork 0

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 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for Search<'a, 'tcx> {
| ty::Uint(_) | ty::Uint(_)
| ty::Float(_) | ty::Float(_)
| ty::Str | ty::Str
| ty::Never | ty::Never => {
| ty::Error => {
// These primitive types are always structural match. // These primitive types are always structural match.
// //
// `Never` is kind of special here, but as it is not inhabitable, this should be fine. // `Never` is kind of special here, but as it is not inhabitable, this should be fine.
@ -200,17 +199,25 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for Search<'a, 'tcx> {
| ty::Ref(..) | ty::Ref(..)
| ty::Closure(..) | ty::Closure(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::Tuple(..) | ty::Tuple(..)
| ty::Projection(..) | ty::Projection(..)
| ty::UnnormalizedProjection(..)
| ty::Opaque(..) | ty::Opaque(..)
| ty::Bound(..) | ty::GeneratorWitness(..) => {
| ty::Placeholder(_)
| ty::Infer(_) => {
ty.super_visit_with(self); ty.super_visit_with(self);
return false; 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) { if !self.seen.insert(adt_def.did) {