Revert "Do not need to account for overflow in predicate_can_apply"

This reverts commit cbe9328018.
This commit is contained in:
Michael Goulet 2022-11-26 22:15:51 +00:00
parent c285218f43
commit 4149923ff0
3 changed files with 1 additions and 31 deletions

View File

@ -2544,10 +2544,7 @@ fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
let obligation =
Obligation::new(self.tcx, ObligationCause::dummy(), param_env, cleaned_pred);
// We don't use `InferCtxt::predicate_may_hold` because that
// will re-run predicates that overflow locally, which ends up
// taking a really long time to compute.
self.evaluate_obligation(&obligation).map_or(false, |eval| eval.may_apply())
self.predicate_may_hold(&obligation)
})
}

View File

@ -1,6 +0,0 @@
fn f<B>(x: Vec<[[[B; 1]; 1]; 1]>) -> impl PartialEq<B> {
//~^ ERROR can't compare `Vec<[[[B; 1]; 1]; 1]>` with `B`
x
}
fn main() {}

View File

@ -1,21 +0,0 @@
error[E0277]: can't compare `Vec<[[[B; 1]; 1]; 1]>` with `B`
--> $DIR/predicate_can_apply-hang.rs:1:38
|
LL | fn f<B>(x: Vec<[[[B; 1]; 1]; 1]>) -> impl PartialEq<B> {
| ^^^^^^^^^^^^^^^^^ no implementation for `Vec<[[[B; 1]; 1]; 1]> == B`
LL |
LL | x
| - return type was inferred to be `Vec<[[[B; 1]; 1]; 1]>` here
|
= help: the trait `PartialEq<B>` is not implemented for `Vec<[[[B; 1]; 1]; 1]>`
= help: the following other types implement trait `PartialEq<Rhs>`:
<Vec<T, A1> as PartialEq<Vec<U, A2>>>
<Vec<T, A> as PartialEq<&[U; N]>>
<Vec<T, A> as PartialEq<&[U]>>
<Vec<T, A> as PartialEq<&mut [U]>>
<Vec<T, A> as PartialEq<[U; N]>>
<Vec<T, A> as PartialEq<[U]>>
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.