Avoid overflow in is_impossible_method
This commit is contained in:
parent
9c20b2a8cc
commit
c4a5b14211
2 changed files with 29 additions and 3 deletions
|
@ -571,9 +571,16 @@ fn is_impossible_method<'tcx>(
|
|||
});
|
||||
|
||||
tcx.infer_ctxt().ignoring_regions().enter(|ref infcx| {
|
||||
let mut fulfill_ctxt = <dyn TraitEngine<'_>>::new(tcx);
|
||||
fulfill_ctxt.register_predicate_obligations(infcx, predicates_for_trait);
|
||||
!fulfill_ctxt.select_all_or_error(infcx).is_empty()
|
||||
for obligation in predicates_for_trait {
|
||||
// Ignore overflow error, to be conservative.
|
||||
if let Ok(result) = infcx.evaluate_obligation(&obligation)
|
||||
&& !result.may_apply()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
})
|
||||
}
|
||||
|
||||
|
|
19
src/test/rustdoc/issue-100620.rs
Normal file
19
src/test/rustdoc/issue-100620.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
pub trait Bar<S> {}
|
||||
|
||||
pub trait Qux<T> {}
|
||||
|
||||
pub trait Foo<T, S> {
|
||||
fn bar()
|
||||
where
|
||||
T: Bar<S>,
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Concrete;
|
||||
|
||||
impl<S> Foo<(), S> for Concrete {}
|
||||
|
||||
impl<T, S> Bar<S> for T where S: Qux<T> {}
|
||||
|
||||
impl<T, S> Qux<T> for S where T: Bar<S> {}
|
Loading…
Add table
Add a link
Reference in a new issue