Skip to content

Commit c48a1ab

Browse files
committed
changes to tests
1 parent 1d500cf commit c48a1ab

File tree

11 files changed

+60
-141
lines changed

11 files changed

+60
-141
lines changed

src/librustc/middle/typeck/check/vtable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ pub fn check_object_safety(tcx: &ty::ctxt, object_trait: &ty::TyTrait, span: Spa
196196
let check_for_self_ty = |ty| {
197197
if ty::type_has_self(ty) {
198198
Some(format!(
199-
"cannot call a method (`{}`) whose type (`{}`) contains \
200-
a self-type through a trait object",
199+
"cannot call a method (`{}`) whose type contains \
200+
a self-type (`{}`) through a trait object",
201201
method_name, ty_to_string(tcx, ty)))
202202
} else {
203203
None

src/libstd/io/extensions.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 {
172172
mod test {
173173
use prelude::*;
174174
use io;
175-
use io::{MemReader, MemWriter};
175+
use io::{MemReader, MemWriter, BytesReader};
176176

177177
struct InitialZeroByteReader {
178178
count: int,
@@ -189,6 +189,7 @@ mod test {
189189
}
190190
}
191191
}
192+
impl BytesReader for InitialZeroByteReader {}
192193

193194
struct EofReader;
194195

@@ -197,6 +198,7 @@ mod test {
197198
Err(io::standard_error(io::EndOfFile))
198199
}
199200
}
201+
impl BytesReader for EofReader {}
200202

201203
struct ErroringReader;
202204

@@ -205,6 +207,7 @@ mod test {
205207
Err(io::standard_error(io::InvalidInput))
206208
}
207209
}
210+
impl BytesReader for ErroringReader {}
208211

209212
struct PartialReader {
210213
count: int,

src/libstd/io/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ impl<T: Iterator<u8>> Reader for IterReader<T> {
265265

266266
#[cfg(test)]
267267
mod test {
268-
use io::{MemReader, MemWriter, BufReader};
268+
use io::{MemReader, MemWriter, BufReader, AsRefReader};
269269
use io;
270270
use boxed::Box;
271271
use super::*;

src/test/compile-fail/selftype-traittype.rs

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
trait Foo {
12+
fn foo(self);
13+
}
14+
15+
trait Bar {
16+
fn bar(&self, x: &Self);
17+
}
18+
19+
trait Baz {
20+
fn baz<T>(&self, x: &T);
21+
}
22+
23+
impl Foo for int {
24+
fn foo(self) {}
25+
}
26+
27+
impl Bar for int {
28+
fn bar(&self, _x: &int) {}
29+
}
30+
31+
impl Baz for int {
32+
fn baz<T>(&self, _x: &T) {}
33+
}
34+
35+
fn main() {
36+
let _: &Foo = &42i; //~ ERROR cannot convert to a trait object
37+
let _: &Bar = &42i; //~ ERROR cannot convert to a trait object
38+
let _: &Baz = &42i; //~ ERROR cannot convert to a trait object
39+
40+
let _ = &42i as &Foo; //~ ERROR cannot convert to a trait object
41+
let _ = &42i as &Bar; //~ ERROR cannot convert to a trait object
42+
let _ = &42i as &Baz; //~ ERROR cannot convert to a trait object
43+
}

src/test/compile-fail/trait-test-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ impl bar for uint { fn dup(&self) -> uint { *self } fn blah<X>(&self) {} }
1616
fn main() {
1717
10i.dup::<int>(); //~ ERROR does not take type parameters
1818
10i.blah::<int, int>(); //~ ERROR incorrect number of type parameters
19-
(box 10i as Box<bar>).dup(); //~ ERROR contains a self-type
19+
(box 10i as Box<bar>).dup(); //~ ERROR cannot convert to a trait object
2020
}

src/test/run-pass/by-value-self-objects.rs

Lines changed: 0 additions & 77 deletions
This file was deleted.

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212

1313
struct Empty;
1414

15-
impl Iterator<int> for Empty {
15+
trait T<U> {
16+
fn next(&mut self) -> Option<U>;
17+
}
18+
impl T<int> for Empty {
1619
fn next(&mut self) -> Option<int> { None }
1720
}
1821

19-
fn do_something_with(a : &mut Iterator<int>) {
22+
fn do_something_with(a : &mut T<int>) {
2023
println!("{}", a.next())
2124
}
2225

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@ fn dd() -> Result<int, int> {
6060
}
6161

6262
trait A {
63-
fn aaa(self) -> int {
63+
fn aaa(&self) -> int {
6464
3
6565
}
66-
fn bbb(self) -> int {
66+
fn bbb(&self) -> int {
6767
return 3;
6868
}
69-
fn ccc(self) -> Result<int, int> {
69+
fn ccc(&self) -> Result<int, int> {
7070
Ok(3)
7171
}
72-
fn ddd(self) -> Result<int, int> {
72+
fn ddd(&self) -> Result<int, int> {
7373
return Ok(3);
7474
}
7575
}

src/test/run-pass/trait-cast-generic.rs

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/test/run-pass/trait-default-method-xc.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ pub fn main() {
7272
assert_eq!(g(0i, 3.14f64, 1i), (3.14f64, 1i));
7373
assert_eq!(g(false, 3.14f64, 1i), (3.14, 1));
7474

75-
let obj = box 0i as Box<A>;
76-
assert_eq!(obj.h(), 11);
77-
7875

7976
// Trying out a real one
8077
assert!(12i.test_neq(&10i));

0 commit comments

Comments
 (0)