File tree 2 files changed +29
-3
lines changed
compiler/rustc_trait_selection/src/traits
2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -571,9 +571,16 @@ fn is_impossible_method<'tcx>(
571
571
} ) ;
572
572
573
573
tcx. infer_ctxt ( ) . ignoring_regions ( ) . enter ( |ref infcx| {
574
- let mut fulfill_ctxt = <dyn TraitEngine < ' _ > >:: new ( tcx) ;
575
- fulfill_ctxt. register_predicate_obligations ( infcx, predicates_for_trait) ;
576
- !fulfill_ctxt. select_all_or_error ( infcx) . is_empty ( )
574
+ for obligation in predicates_for_trait {
575
+ // Ignore overflow error, to be conservative.
576
+ if let Ok ( result) = infcx. evaluate_obligation ( & obligation)
577
+ && !result. may_apply ( )
578
+ {
579
+ return true ;
580
+ }
581
+ }
582
+
583
+ false
577
584
} )
578
585
}
579
586
Original file line number Diff line number Diff line change
1
+ pub trait Bar < S > { }
2
+
3
+ pub trait Qux < T > { }
4
+
5
+ pub trait Foo < T , S > {
6
+ fn bar ( )
7
+ where
8
+ T : Bar < S > ,
9
+ {
10
+ }
11
+ }
12
+
13
+ pub struct Concrete ;
14
+
15
+ impl < S > Foo < ( ) , S > for Concrete { }
16
+
17
+ impl < T , S > Bar < S > for T where S : Qux < T > { }
18
+
19
+ impl < T , S > Qux < T > for S where T : Bar < S > { }
You can’t perform that action at this time.
0 commit comments