File tree Expand file tree Collapse file tree 3 files changed +59
-2
lines changed Expand file tree Collapse file tree 3 files changed +59
-2
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
31
31
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
32
32
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
33
33
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34
- refs/heads/beta: b92ec6a78a980b567ec8e6c034e3b37caea81aaa
34
+ refs/heads/beta: ff6085f401844bc5cb07b804f0d2258bb5c2b9a8
35
35
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
36
36
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
37
37
refs/heads/tmp: eb836bf767aa1d8d4cba488a9091cde3c0ab4b2f
Original file line number Diff line number Diff line change @@ -2604,12 +2604,17 @@ impl FlagComputation {
2604
2604
2605
2605
& ty_projection( ref data) => {
2606
2606
self . add_flags ( HAS_PROJECTION ) ;
2607
- self . add_substs ( data. trait_ref . substs ) ;
2607
+ self . add_projection_ty ( data) ;
2608
2608
}
2609
2609
2610
2610
& ty_trait( box TyTrait { ref principal, ref bounds } ) => {
2611
2611
let mut computation = FlagComputation :: new ( ) ;
2612
2612
computation. add_substs ( principal. 0 . substs ) ;
2613
+ for projection_bound in bounds. projection_bounds . iter ( ) {
2614
+ let mut proj_computation = FlagComputation :: new ( ) ;
2615
+ proj_computation. add_projection_predicate ( & projection_bound. 0 ) ;
2616
+ computation. add_bound_computation ( & proj_computation) ;
2617
+ }
2613
2618
self . add_bound_computation ( & computation) ;
2614
2619
2615
2620
self . add_bounds ( bounds) ;
@@ -2673,6 +2678,15 @@ impl FlagComputation {
2673
2678
}
2674
2679
}
2675
2680
2681
+ fn add_projection_predicate ( & mut self , projection_predicate : & ProjectionPredicate ) {
2682
+ self . add_projection_ty ( & projection_predicate. projection_ty ) ;
2683
+ self . add_ty ( projection_predicate. ty ) ;
2684
+ }
2685
+
2686
+ fn add_projection_ty ( & mut self , projection_ty : & ProjectionTy ) {
2687
+ self . add_substs ( projection_ty. trait_ref . substs ) ;
2688
+ }
2689
+
2676
2690
fn add_substs ( & mut self , substs : & Substs ) {
2677
2691
self . add_tys ( substs. types . as_slice ( ) ) ;
2678
2692
match substs. regions {
Original file line number Diff line number Diff line change
1
+ // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // Corrected regression test for #20831. The original did not compile.
12
+ // When fixed, it revealed another problem concerning projections that
13
+ // appear in associated type bindings in object types, which were not
14
+ // being properly flagged.
15
+
16
+ use std:: ops:: { Shl , Shr } ;
17
+ use std:: cell:: RefCell ;
18
+
19
+ pub trait Subscriber {
20
+ type Input ;
21
+ }
22
+
23
+ pub trait Publisher < ' a > {
24
+ type Output ;
25
+ fn subscribe ( & mut self , Box < Subscriber < Input =Self :: Output > + ' a > ) ;
26
+ }
27
+
28
+ pub trait Processor < ' a > : Subscriber + Publisher < ' a > { }
29
+
30
+ impl < ' a , P > Processor < ' a > for P where P : Subscriber + Publisher < ' a > { }
31
+
32
+ struct MyStruct < ' a > {
33
+ sub : Box < Subscriber < Input =u64 > + ' a >
34
+ }
35
+
36
+ impl < ' a > Publisher < ' a > for MyStruct < ' a > {
37
+ type Output = u64 ;
38
+ fn subscribe ( & mut self , t : Box < Subscriber < Input =u64 > + ' a > ) {
39
+ self . sub = t;
40
+ }
41
+ }
42
+
43
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments