Skip to content

Commit 0600d22

Browse files
committed
---
yaml --- r: 170454 b: refs/heads/try c: 67dab2a h: refs/heads/master v: v3
1 parent 20624be commit 0600d22

File tree

3 files changed

+44
-8
lines changed

3 files changed

+44
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 73a25f55ad748b4d3516417c711b99ce446591af
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 5b3cd3900ceda838f5798c30ab96ceb41f962534
5-
refs/heads/try: 9675488ef9480365c2d26e23bfd649128037880f
5+
refs/heads/try: 67dab2af81ba64023c526dc96315863a9f7e9e40
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5449,8 +5449,15 @@ pub fn predicates_for_trait_ref<'tcx>(tcx: &ctxt<'tcx>,
54495449
.map(|poly_trait_ref| ty::Binder(poly_trait_ref.0.subst(tcx, trait_ref.substs())))
54505450
.collect();
54515451

5452-
debug!("bounds_for_trait_ref: trait_bounds={}",
5453-
trait_bounds.repr(tcx));
5452+
let projection_bounds: Vec<_> =
5453+
trait_def.bounds.projection_bounds
5454+
.iter()
5455+
.map(|poly_proj| ty::Binder(poly_proj.0.subst(tcx, trait_ref.substs())))
5456+
.collect();
5457+
5458+
debug!("bounds_for_trait_ref: trait_bounds={} projection_bounds={}",
5459+
trait_bounds.repr(tcx),
5460+
projection_bounds.repr(tcx));
54545461

54555462
// The region bounds and builtin bounds do not currently introduce
54565463
// binders so we can just substitute in a straightforward way here.
@@ -5463,11 +5470,7 @@ pub fn predicates_for_trait_ref<'tcx>(tcx: &ctxt<'tcx>,
54635470
trait_bounds: trait_bounds,
54645471
region_bounds: region_bounds,
54655472
builtin_bounds: builtin_bounds,
5466-
5467-
// FIXME(#19451) -- if a trait has a bound like `trait Foo :
5468-
// Bar<T=X>`, we should probably be returning that, but this
5469-
// code here will just ignore it.
5470-
projection_bounds: Vec::new(),
5473+
projection_bounds: projection_bounds,
54715474
};
54725475

54735476
predicates(tcx, trait_ref.self_ty(), &bounds)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright 2014 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+
// Test that we correctly handle projection bounds appearing in the
12+
// supertrait list (and in conjunction with overloaded operators). In
13+
// this case, the `Result=Self` binding in the supertrait listing of
14+
// `Int` was being ignored.
15+
16+
#![feature(associated_types)]
17+
18+
trait Not {
19+
type Result;
20+
21+
fn not(self) -> Self::Result;
22+
}
23+
24+
trait Int: Not<Result=Self> {
25+
fn count_ones(self) -> uint;
26+
fn count_zeros(self) -> uint {
27+
// neither works
28+
let x: Self = self.not();
29+
0
30+
}
31+
}
32+
33+
fn main() { }

0 commit comments

Comments
 (0)