Skip to content

Commit b07b36b

Browse files
committed
test: Fix tests
1 parent f41a510 commit b07b36b

10 files changed

+26
-24
lines changed

doc/rust.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -830,12 +830,12 @@ An example of re-exporting:
830830
~~~~
831831
# fn main() { }
832832
mod quux {
833+
pub use quux::foo::*;
834+
833835
pub mod foo {
834836
pub fn bar() { }
835837
pub fn baz() { }
836838
}
837-
838-
pub use quux::foo::*;
839839
}
840840
~~~~
841841

@@ -2008,8 +2008,8 @@ then the expression completes.
20082008
Some examples of call expressions:
20092009

20102010
~~~~
2011-
# fn add(x: int, y: int) -> int { 0 }
20122011
# use core::from_str::FromStr::from_str;
2012+
# fn add(x: int, y: int) -> int { 0 }
20132013
20142014
let x: int = add(1, 2);
20152015
let pi = from_str::<f32>("3.14");

doc/tutorial.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -2054,9 +2054,9 @@ name and a double colon. The compiler uses type inference to decide which
20542054
implementation to use.
20552055

20562056
~~~~
2057-
trait Shape { fn new(area: float) -> Self; }
20582057
# use core::float::consts::pi;
20592058
# use core::float::sqrt;
2059+
trait Shape { fn new(area: float) -> Self; }
20602060
struct Circle { radius: float }
20612061
struct Square { length: float }
20622062
@@ -2211,11 +2211,11 @@ trait Circle : Shape { fn radius(&self) -> float; }
22112211
Now, we can implement `Circle` on a type only if we also implement `Shape`.
22122212

22132213
~~~~
2214+
# use core::float::consts::pi;
2215+
# use core::float::sqrt;
22142216
# trait Shape { fn area(&self) -> float; }
22152217
# trait Circle : Shape { fn radius(&self) -> float; }
22162218
# struct Point { x: float, y: float }
2217-
# use core::float::consts::pi;
2218-
# use core::float::sqrt;
22192219
# fn square(x: float) -> float { x * x }
22202220
struct CircleStruct { center: Point, radius: float }
22212221
impl Circle for CircleStruct {
@@ -2247,10 +2247,10 @@ fn radius_times_area<T: Circle>(c: T) -> float {
22472247
Likewise, supertrait methods may also be called on trait objects.
22482248

22492249
~~~ {.xfail-test}
2250-
# trait Shape { fn area(&self) -> float; }
2251-
# trait Circle : Shape { fn radius(&self) -> float; }
22522250
# use core::float::consts::pi;
22532251
# use core::float::sqrt;
2252+
# trait Shape { fn area(&self) -> float; }
2253+
# trait Circle : Shape { fn radius(&self) -> float; }
22542254
# struct Point { x: float, y: float }
22552255
# struct CircleStruct { center: Point, radius: float }
22562256
# impl Circle for CircleStruct { fn radius(&self) -> float { sqrt(self.area() / pi) } }

src/test/auxiliary/pub_use_mods_xcrate.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
// except according to those terms.
1010

1111
pub mod a {
12+
pub use a::b::c;
13+
1214
pub mod b {
1315
pub mod c {
1416
fn f(){}
1517
fn g(){}
1618
}
1719
}
18-
19-
pub use a::b::c;
2020
}
2121

src/test/bench/shootout-binarytrees.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extern mod std;
1212
use std::arena;
1313
use methods = std::arena::Arena;
1414

15-
enum tree {
15+
enum tree<'self> {
1616
nil,
1717
node(&'self tree<'self>, &'self tree<'self>, int),
1818
}
@@ -26,9 +26,10 @@ fn item_check(t: &tree) -> int {
2626
}
2727
}
2828

29-
fn bottom_up_tree(arena: &'r arena::Arena,
30-
item: int,
31-
depth: int) -> &'r tree<'r> {
29+
fn bottom_up_tree<'r>(arena: &'r arena::Arena,
30+
item: int,
31+
depth: int)
32+
-> &'r tree<'r> {
3233
if depth > 0 {
3334
return arena.alloc(
3435
|| node(bottom_up_tree(arena, 2 * item - 1, depth - 1),

src/test/compile-fail/issue-4366.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
// ensures that 'use foo:*' doesn't import non-public 'use' statements in the
1414
// module 'foo'
1515

16+
use m1::*;
17+
1618
mod foo {
1719
pub fn foo() {}
1820
}
@@ -31,7 +33,6 @@ mod a {
3133
mod m1 {
3234
fn foo() {}
3335
}
34-
use m1::*;
3536

3637
fn main() {
3738
foo(); //~ ERROR: unresolved name: `foo`

src/test/compile-fail/regions-in-enums.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010

1111
enum yes0<'lt> {
1212
// This will eventually be legal (and in fact the only way):
13-
X3(&'lt uint) //~ ERROR Illegal lifetime 'lt: this lifetime must be declared
13+
X3(&'lt uint) //~ ERROR Illegal lifetime 'lt: only 'self is allowed
1414
}
1515

1616
enum yes1<'self> {
1717
X4(&'self uint)
1818
}
1919

2020
enum yes2 {
21-
X5(&'foo uint) //~ ERROR Illegal lifetime 'foo: this lifetime must be declared
21+
X5(&'foo uint) //~ ERROR Illegal lifetime 'foo: only 'self is allowed
2222
}
2323

2424
fn main() {}

src/test/compile-fail/regions-in-type-items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct item_ty_yes1<'self> {
1717
}
1818

1919
struct item_ty_yes2 {
20-
x: &'a uint //~ ERROR this lifetime must be declared
20+
x: &'a uint //~ ERROR only 'self is allowed
2121
}
2222

2323
fn main() {}

src/test/run-pass/issue-2904.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

1313
/// Map representation
1414
15-
use core::io::ReaderUtil;
16-
1715
extern mod std;
1816

17+
use core::io::ReaderUtil;
18+
1919
enum square {
2020
bot,
2121
wall,

src/test/run-pass/trait-inheritance-num.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
// option. This file may not be copied, modified, or distributed
1111
// except according to those terms.
1212

13+
extern mod std;
14+
1315
use core::cmp::{Eq, Ord};
1416
use core::num::NumCast::from;
15-
16-
extern mod std;
1717
use std::cmp::FuzzyEq;
1818

1919
pub trait NumExt: NumCast + Eq + Ord {}

src/test/run-pass/trait-inheritance-num2.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

1313
// A more complex example of numeric extensions
1414

15+
extern mod std;
16+
1517
use core::cmp::{Eq, Ord};
1618
use core::num::NumCast::from;
17-
18-
extern mod std;
1919
use std::cmp::FuzzyEq;
2020

2121
pub trait TypeExt {}

0 commit comments

Comments
 (0)