Skip to content

Commit e858709

Browse files
committed
---
yaml --- r: 182171 b: refs/heads/beta c: ff6085f h: refs/heads/master i: 182169: c42011b 182167: e03e695 v: v3
1 parent a69c6c5 commit e858709

File tree

3 files changed

+59
-2
lines changed

3 files changed

+59
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: b92ec6a78a980b567ec8e6c034e3b37caea81aaa
34+
refs/heads/beta: ff6085f401844bc5cb07b804f0d2258bb5c2b9a8
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: eb836bf767aa1d8d4cba488a9091cde3c0ab4b2f

branches/beta/src/librustc/middle/ty.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2604,12 +2604,17 @@ impl FlagComputation {
26042604

26052605
&ty_projection(ref data) => {
26062606
self.add_flags(HAS_PROJECTION);
2607-
self.add_substs(data.trait_ref.substs);
2607+
self.add_projection_ty(data);
26082608
}
26092609

26102610
&ty_trait(box TyTrait { ref principal, ref bounds }) => {
26112611
let mut computation = FlagComputation::new();
26122612
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+
}
26132618
self.add_bound_computation(&computation);
26142619

26152620
self.add_bounds(bounds);
@@ -2673,6 +2678,15 @@ impl FlagComputation {
26732678
}
26742679
}
26752680

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+
26762690
fn add_substs(&mut self, substs: &Substs) {
26772691
self.add_tys(substs.types.as_slice());
26782692
match substs.regions {
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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() {}

0 commit comments

Comments
 (0)