Test generalization during coherence
This commit is contained in:
parent
11adf03790
commit
c16a90f5e3
2 changed files with 18 additions and 1 deletions
|
@ -548,7 +548,7 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
|
|||
}
|
||||
|
||||
fn mark_ambiguous(&mut self) {
|
||||
self.infcx.tcx.sess.delay_span_bug(self.cause.span, "we only generalize opaque types in situations where we already error for them elsewhere in coherence");
|
||||
span_bug!(self.cause.span, "opaque types are handled in `tys`");
|
||||
}
|
||||
|
||||
fn binders<T>(
|
||||
|
@ -675,6 +675,10 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
|
|||
// relatable.
|
||||
Ok(t)
|
||||
}
|
||||
ty::Opaque(def_id, substs) => {
|
||||
let s = self.relate(substs, substs)?;
|
||||
Ok(if s == substs { t } else { self.infcx.tcx.mk_opaque(def_id, s) })
|
||||
}
|
||||
_ => relate::super_relate_tys(self, t, t),
|
||||
}?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue