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 1
1
---
2
- refs/heads/master: b92ec6a78a980b567ec8e6c034e3b37caea81aaa
2
+ refs/heads/master: ff6085f401844bc5cb07b804f0d2258bb5c2b9a8
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 210f0dcf007104240b2e286ed0b80cb4a61d7bae
5
5
refs/heads/try: 957472483d3a2f43c0e4f7c2056280a1022af93c
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