1
Fork 0

Make negative trait bounds work with the old trait solver

This commit is contained in:
Michael Goulet 2023-04-25 06:37:24 +00:00
parent 40a63cb06f
commit 03469c3f2e
5 changed files with 36 additions and 14 deletions

View file

@ -701,6 +701,16 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
let mut dup_bindings = FxHashMap::default();
for binding in &assoc_bindings {
// Don't register additional associated type bounds for negative bounds,
// since we should have emitten an error for them earlier, and they will
// not be well-formed!
if polarity == ty::ImplPolarity::Negative {
self.tcx()
.sess
.delay_span_bug(binding.span, "negative trait bounds should not have bindings");
continue;
}
// Specify type to assert that error was already reported in `Err` case.
let _: Result<_, ErrorGuaranteed> = self.add_predicates_for_ast_type_binding(
hir_id,