Skip to content

Commit 2af240e

Browse files
committed
---
yaml --- r: 138403 b: refs/heads/master c: df714cf h: refs/heads/master i: 138401: 78b9e9b 138399: 0086df1 v: v3
1 parent 7e77c9f commit 2af240e

File tree

6 files changed

+35
-20
lines changed

6 files changed

+35
-20
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 98e237a681c798ef6850395cb8483b82fc844452
2+
refs/heads/master: df714cfda728e201dd6b2227caa425bca3e048c7
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5

trunk/src/librustc/middle/borrowck/graphviz.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ impl<'a, 'tcx> dot::Labeller<'a, Node<'a>, Edge<'a>> for DataflowLabeller<'a, 't
142142
}
143143

144144
impl<'a, 'tcx> dot::GraphWalk<'a, Node<'a>, Edge<'a>> for DataflowLabeller<'a, 'tcx> {
145-
fn nodes(&self) -> dot::Nodes<'a, Node<'a>> { self.inner.nodes() }
146-
fn edges(&self) -> dot::Edges<'a, Edge<'a>> { self.inner.edges() }
147-
fn source(&self, edge: &Edge<'a>) -> Node<'a> { self.inner.source(edge) }
148-
fn target(&self, edge: &Edge<'a>) -> Node<'a> { self.inner.target(edge) }
145+
fn nodes(&'a self) -> dot::Nodes<'a, Node<'a>> { self.inner.nodes() }
146+
fn edges(&'a self) -> dot::Edges<'a, Edge<'a>> { self.inner.edges() }
147+
fn source(&'a self, edge: &Edge<'a>) -> Node<'a> { self.inner.source(edge) }
148+
fn target(&'a self, edge: &Edge<'a>) -> Node<'a> { self.inner.target(edge) }
149149
}

trunk/src/librustc/middle/cfg/graphviz.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,29 +91,29 @@ impl<'a, 'ast> dot::Labeller<'a, Node<'a>, Edge<'a>> for LabelledCFG<'a, 'ast> {
9191
}
9292

9393
impl<'a> dot::GraphWalk<'a, Node<'a>, Edge<'a>> for &'a cfg::CFG {
94-
fn nodes(&self) -> dot::Nodes<'a, Node<'a>> {
94+
fn nodes(&'a self) -> dot::Nodes<'a, Node<'a>> {
9595
let mut v = Vec::new();
9696
self.graph.each_node(|i, nd| { v.push((i, nd)); true });
9797
dot::maybe_owned_vec::Growable(v)
9898
}
99-
fn edges(&self) -> dot::Edges<'a, Edge<'a>> {
99+
fn edges(&'a self) -> dot::Edges<'a, Edge<'a>> {
100100
self.graph.all_edges().iter().collect()
101101
}
102-
fn source(&self, edge: &Edge<'a>) -> Node<'a> {
102+
fn source(&'a self, edge: &Edge<'a>) -> Node<'a> {
103103
let i = edge.source();
104104
(i, self.graph.node(i))
105105
}
106-
fn target(&self, edge: &Edge<'a>) -> Node<'a> {
106+
fn target(&'a self, edge: &Edge<'a>) -> Node<'a> {
107107
let i = edge.target();
108108
(i, self.graph.node(i))
109109
}
110110
}
111111

112112
impl<'a, 'ast> dot::GraphWalk<'a, Node<'a>, Edge<'a>> for LabelledCFG<'a, 'ast>
113113
{
114-
fn nodes(&self) -> dot::Nodes<'a, Node<'a>> { self.cfg.nodes() }
115-
fn edges(&self) -> dot::Edges<'a, Edge<'a>> { self.cfg.edges() }
116-
fn source(&self, edge: &Edge<'a>) -> Node<'a> { self.cfg.source(edge) }
117-
fn target(&self, edge: &Edge<'a>) -> Node<'a> { self.cfg.target(edge) }
114+
fn nodes(&'a self) -> dot::Nodes<'a, Node<'a>> { self.cfg.nodes() }
115+
fn edges(&'a self) -> dot::Edges<'a, Edge<'a>> { self.cfg.edges() }
116+
fn source(&'a self, edge: &Edge<'a>) -> Node<'a> { self.cfg.source(edge) }
117+
fn target(&'a self, edge: &Edge<'a>) -> Node<'a> { self.cfg.target(edge) }
118118
}
119119

trunk/src/test/auxiliary/regions-bounded-method-type-parameters-cross-crate-lib.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
// Check that method bounds declared on traits/impls in a cross-crate
12-
// scenario work. This is the libary portion of the test.
12+
// scenario work. This is the library portion of the test.
1313

1414
pub enum MaybeOwned<'a> {
1515
Owned(int),
@@ -24,10 +24,19 @@ pub struct Inv<'a> { // invariant w/r/t 'a
2424
// trait, so I'll use that as the template for this test.
2525
pub trait IntoMaybeOwned<'a> {
2626
fn into_maybe_owned(self) -> MaybeOwned<'a>;
27+
28+
// Note: without this `into_inv` method, the trait is
29+
// contravariant w/r/t `'a`, since if you look strictly at the
30+
// interface, it only returns `'a`. This complicates the
31+
// downstream test since it wants invariance to force an error.
32+
// Hence we add this method.
33+
fn into_inv(self) -> Inv<'a>;
34+
2735
fn bigger_region<'b:'a>(self, b: Inv<'b>);
2836
}
2937

3038
impl<'a> IntoMaybeOwned<'a> for Inv<'a> {
3139
fn into_maybe_owned(self) -> MaybeOwned<'a> { fail!() }
40+
fn into_inv(self) -> Inv<'a> { fail!() }
3241
fn bigger_region<'b:'a>(self, b: Inv<'b>) { fail!() }
3342
}

trunk/src/test/compile-fail/regions-bounded-method-type-parameters-cross-crate.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ use lib::Inv;
1818
use lib::MaybeOwned;
1919
use lib::IntoMaybeOwned;
2020

21-
fn call_into_maybe_owned<'a,F:IntoMaybeOwned<'a>>(f: F) {
21+
fn call_into_maybe_owned<'x,F:IntoMaybeOwned<'x>>(f: F) {
2222
// Exercise a code path I found to be buggy. We were not encoding
2323
// the region parameters from the receiver correctly on trait
2424
// methods.
2525
f.into_maybe_owned();
2626
}
2727

28-
fn call_bigger_region<'a, 'b>(a: Inv<'a>, b: Inv<'b>) {
29-
// Here the value provided for 'y is 'b, and hence 'b:'a does not hold.
28+
fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) {
29+
// Here the value provided for 'y is 'y, and hence 'y:'x does not hold.
3030
a.bigger_region(b) //~ ERROR cannot infer
3131
}
3232

trunk/src/test/compile-fail/wrong-mul-method-signature.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ impl Mul<f64, i32> for Vec3 {
5858
}
5959

6060
pub fn main() {
61-
Vec1 { x: 1.0 } * 2.0;
62-
Vec2 { x: 1.0, y: 2.0 } * 2.0;
63-
Vec3 { x: 1.0, y: 2.0, z: 3.0 } * 2.0;
61+
// Check that the usage goes from the trait declaration:
62+
63+
let x: Vec1 = Vec1 { x: 1.0 } * 2.0; // this is OK
64+
65+
let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order
66+
//~^ ERROR mismatched types
67+
//~^^ ERROR mismatched types
68+
69+
let x: i32 = Vec3 { x: 1.0, y: 2.0, z: 3.0 } * 2.0;
6470
}

0 commit comments

Comments
 (0)