Skip to content

Commit f205295

Browse files
committed
---
yaml --- r: 173831 b: refs/heads/auto c: ff6085f h: refs/heads/master i: 173829: a4e34a3 173827: 6451b2d 173823: 400506a v: v3
1 parent d3b96d5 commit f205295

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
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: b92ec6a78a980b567ec8e6c034e3b37caea81aaa
13+
refs/heads/auto: ff6085f401844bc5cb07b804f0d2258bb5c2b9a8
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/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)