Skip to content

Commit 1764e20

Browse files
committed
Add even more tests
Closes #8248 Closes #8249 Closes #8398 Closes #8401
1 parent 443bf93 commit 1764e20

File tree

5 files changed

+105
-0
lines changed

5 files changed

+105
-0
lines changed

src/test/auxiliary/issue_8401.rs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2013 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+
// for this issue, this code must be built in a library
12+
13+
use std::cast;
14+
15+
trait A {}
16+
struct B;
17+
impl A for B {}
18+
19+
fn bar<T>(_: &mut A, _: &T) {}
20+
21+
fn foo<T>(t: &T) {
22+
let b = B;
23+
bar(unsafe { cast::transmute(&b as &A) }, t)
24+
}
25+

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

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2013 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 A {}
12+
struct B;
13+
impl A for B {}
14+
15+
fn foo(_: &mut A) {}
16+
17+
fn main() {
18+
let mut b = B;
19+
foo(&mut b as &mut A);
20+
}
21+

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

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2013 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 A {}
12+
struct B;
13+
impl A for B {}
14+
15+
struct C<'self> {
16+
foo: &'self mut A,
17+
}
18+
19+
fn foo(a: &mut A) {
20+
C{ foo: a };
21+
}
22+
23+
fn main() {
24+
}
25+

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

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2013 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+
use std::rt::io;
12+
13+
fn foo(a: &mut io::Writer) {
14+
a.write([])
15+
}
16+
17+
fn main(){}
18+

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

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2013 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+
// aux-build:issue_8401.rs
12+
// xfail-fast
13+
14+
extern mod issue_8401;
15+
16+
pub fn main() {}

0 commit comments

Comments
 (0)