Filter non-const impls when we expect a const one

This commit is contained in:
Deadbeef
2021-07-23 00:01:47 +08:00
parent 32390a0df6
commit 4c8b6a20a9
2 changed files with 23 additions and 6 deletions

View File

@@ -144,7 +144,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// Instead, we select the right impl now but report "`Bar` does
// not implement `Clone`".
if candidates.len() == 1 {
return self.filter_negative_and_reservation_impls(candidates.pop().unwrap());
return self.filter_impls(candidates.pop().unwrap(), stack.obligation);
}
// Winnow, but record the exact outcome of evaluation, which
@@ -217,7 +217,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}
// Just one candidate left.
self.filter_negative_and_reservation_impls(candidates.pop().unwrap().candidate)
self.filter_impls(candidates.pop().unwrap().candidate, stack.obligation)
}
pub(super) fn assemble_candidates<'o>(