Skip to content

Commit bad694e

Browse files
committed
---
yaml --- r: 64673 b: refs/heads/snap-stage3 c: 387df4e h: refs/heads/master i: 64671: a59e9c7 v: v3
1 parent 942de45 commit bad694e

File tree

7 files changed

+54
-15
lines changed

7 files changed

+54
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: ffc879c2e46c8ffd7dc35b9d3169286fca609bc3
4+
refs/heads/snap-stage3: 387df4e1277ed09002bb050caac5a86d126a1339
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/test/auxiliary/issue_3979_traits.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
#[crate_type = "lib"];
1515

1616
trait Positioned {
17-
fn SetX(&self, int);
17+
fn SetX(&mut self, int);
1818
fn X(&self) -> int;
1919
}
2020

2121
trait Movable: Positioned {
22-
fn translate(&self, dx: int) {
23-
self.SetX(self.X() + dx);
22+
fn translate(&mut self, dx: int) {
23+
let x = self.X() + dx;
24+
self.SetX(x);
2425
}
2526
}

branches/snap-stage3/src/test/run-pass/issue-3979-2.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// xfail-test
12-
1311
trait A {
1412
fn a_method(&self);
1513
}

branches/snap-stage3/src/test/run-pass/issue-3979-generics.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// xfail-test FIXME #5946
1211
trait Positioned<S> {
1312
fn SetX(&mut self, S);
1413
fn X(&self) -> S;
1514
}
1615

17-
trait Movable<S, T>: Positioned<T> {
18-
fn translate(&self, dx: T) {
19-
self.SetX(self.X() + dx);
16+
trait Movable<S: Add<S, S>>: Positioned<S> {
17+
fn translate(&mut self, dx: S) {
18+
let x = self.X() + dx;
19+
self.SetX(x);
2020
}
2121
}
2222

@@ -31,10 +31,10 @@ impl Positioned<int> for Point {
3131
}
3232
}
3333

34-
impl Movable<int, int> for Point;
34+
impl Movable<int> for Point;
3535

3636
pub fn main() {
37-
let p = Point{ x: 1, y: 2};
37+
let mut p = Point{ x: 1, y: 2};
3838
p.translate(3);
3939
assert_eq!(p.X(), 4);
4040
}

branches/snap-stage3/src/test/run-pass/issue-3979-xcrate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// xfail-test // tjc: ???
11+
// xfail-fast
1212
// aux-build:issue_3979_traits.rs
1313
extern mod issue_3979_traits;
1414
use issue_3979_traits::*;

branches/snap-stage3/src/test/run-pass/issue-3979.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// xfail-test
2-
// Reason: ICE with explicit self
31

42
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
53
// file at the top-level directory of this distribution and at
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright 2012 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+
// There is some other borrowck bug, so we make the stuff not mut.
12+
13+
trait Positioned<S> {
14+
fn SetX(&mut self, S);
15+
fn X(&self) -> S;
16+
}
17+
18+
trait Movable<S: Add<S, S>>: Positioned<S> {
19+
fn translate(&mut self, dx: S) {
20+
let x = self.X() + dx;
21+
self.SetX(x);
22+
}
23+
}
24+
25+
struct Point<S> { x: S, y: S }
26+
27+
impl<S: Clone> Positioned<S> for Point<S> {
28+
fn SetX(&mut self, x: S) {
29+
self.x = x;
30+
}
31+
fn X(&self) -> S {
32+
self.x.clone()
33+
}
34+
}
35+
36+
impl<S: Clone + Add<S, S>> Movable<S> for Point<S>;
37+
38+
pub fn main() {
39+
let mut p = Point{ x: 1, y: 2};
40+
p.translate(3);
41+
assert_eq!(p.X(), 4);
42+
}

0 commit comments

Comments
 (0)