1
Fork 0

Add some more assertions for type relations not used during coherence

This commit is contained in:
Oli Scherer 2022-11-17 09:58:22 +00:00
parent 7301cd7844
commit 11adf03790
5 changed files with 13 additions and 8 deletions

View file

@ -548,7 +548,7 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
} }
fn mark_ambiguous(&mut self) { fn mark_ambiguous(&mut self) {
self.infcx.tcx.sess.delay_span_bug(self.cause.span, "opaque types are handled in `tys`"); 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");
} }
fn binders<T>( fn binders<T>(
@ -818,7 +818,8 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
} }
fn intercrate(&self) -> bool { fn intercrate(&self) -> bool {
self.infcx.intercrate assert!(!self.infcx.intercrate);
false
} }
fn param_env(&self) -> ty::ParamEnv<'tcx> { fn param_env(&self) -> ty::ParamEnv<'tcx> {

View file

@ -2938,7 +2938,8 @@ impl<'tcx> TypeRelation<'tcx> for SameTypeModuloInfer<'_, 'tcx> {
} }
fn intercrate(&self) -> bool { fn intercrate(&self) -> bool {
self.0.intercrate assert!(!self.0.intercrate);
false
} }
fn param_env(&self) -> ty::ParamEnv<'tcx> { fn param_env(&self) -> ty::ParamEnv<'tcx> {

View file

@ -31,7 +31,8 @@ impl<'tcx> TypeRelation<'tcx> for Glb<'_, '_, 'tcx> {
} }
fn intercrate(&self) -> bool { fn intercrate(&self) -> bool {
self.fields.infcx.intercrate assert!(!self.fields.infcx.intercrate);
false
} }
fn tcx(&self) -> TyCtxt<'tcx> { fn tcx(&self) -> TyCtxt<'tcx> {
@ -47,7 +48,7 @@ impl<'tcx> TypeRelation<'tcx> for Glb<'_, '_, 'tcx> {
} }
fn mark_ambiguous(&mut self) { fn mark_ambiguous(&mut self) {
self.fields.mark_ambiguous(); bug!("mark_ambiguous used outside of coherence");
} }
fn relate_with_variance<T: Relate<'tcx>>( fn relate_with_variance<T: Relate<'tcx>>(

View file

@ -31,7 +31,8 @@ impl<'tcx> TypeRelation<'tcx> for Lub<'_, '_, 'tcx> {
} }
fn intercrate(&self) -> bool { fn intercrate(&self) -> bool {
self.fields.infcx.intercrate assert!(!self.fields.infcx.intercrate);
false
} }
fn tcx(&self) -> TyCtxt<'tcx> { fn tcx(&self) -> TyCtxt<'tcx> {
@ -47,7 +48,7 @@ impl<'tcx> TypeRelation<'tcx> for Lub<'_, '_, 'tcx> {
} }
fn mark_ambiguous(&mut self) { fn mark_ambiguous(&mut self) {
self.fields.mark_ambiguous(); bug!("mark_ambiguous used outside of coherence");
} }
fn relate_with_variance<T: Relate<'tcx>>( fn relate_with_variance<T: Relate<'tcx>>(

View file

@ -914,7 +914,8 @@ where
} }
fn intercrate(&self) -> bool { fn intercrate(&self) -> bool {
self.infcx.intercrate assert!(!self.infcx.intercrate);
false
} }
fn param_env(&self) -> ty::ParamEnv<'tcx> { fn param_env(&self) -> ty::ParamEnv<'tcx> {