File tree 2 files changed +38
-2
lines changed
compiler/rustc_hir_analysis/src
2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -54,14 +54,20 @@ impl<'tcx> Bounds<'tcx> {
54
54
span : Span ,
55
55
polarity : ty:: PredicatePolarity ,
56
56
) {
57
- self . clauses . push ( (
57
+ let clause = (
58
58
trait_ref
59
59
. map_bound ( |trait_ref| {
60
60
ty:: ClauseKind :: Trait ( ty:: TraitPredicate { trait_ref, polarity } )
61
61
} )
62
62
. to_predicate ( tcx) ,
63
63
span,
64
- ) ) ;
64
+ ) ;
65
+ // FIXME(-Znext-solver): We can likely remove this hack once the new trait solver lands.
66
+ if tcx. lang_items ( ) . sized_trait ( ) == Some ( trait_ref. def_id ( ) ) {
67
+ self . clauses . insert ( 0 , clause) ;
68
+ } else {
69
+ self . clauses . push ( clause) ;
70
+ }
65
71
}
66
72
67
73
pub fn push_projection_bound (
Original file line number Diff line number Diff line change
1
+ //@ check-pass
2
+ // Regression test due to #123279
3
+
4
+ pub trait Job : AsJob {
5
+ fn run_once ( & self ) ;
6
+ }
7
+
8
+ impl < F : Fn ( ) > Job for F {
9
+ fn run_once ( & self ) {
10
+ todo ! ( )
11
+ }
12
+ }
13
+
14
+ pub trait AsJob { }
15
+
16
+ // Ensure that `T: Sized + Job` by reordering the explicit `Sized` to where
17
+ // the implicit sized pred would go.
18
+ impl < T : Job + Sized > AsJob for T { }
19
+
20
+ pub struct LoopingJobService {
21
+ job : Box < dyn Job > ,
22
+ }
23
+
24
+ impl Job for LoopingJobService {
25
+ fn run_once ( & self ) {
26
+ self . job . run_once ( )
27
+ }
28
+ }
29
+
30
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments