Skip to content

Commit 3b9ade0

Browse files
committed
Tests for issue 5997 failure and success conditions.
Closes rust-lang#5997.
1 parent 903fbd2 commit 3b9ade0

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
// error-pattern: missing type param `Z` in the substitution of `Z`
12+
13+
fn f<Z>() -> bool {
14+
enum E { V(Z) }
15+
16+
true
17+
}
18+
19+
fn main() {
20+
let b = f::<int>();
21+
assert!(b);
22+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
fn f<T>() -> bool {
12+
struct S(T); //~ ERROR use of undeclared type name `T`
13+
//~^ ERROR attempt to use a type argument out of scope
14+
15+
true
16+
}
17+
18+
fn main() {
19+
let b = f::<int>();
20+
assert!(b);
21+
}

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
fn f<T>() -> bool {
12+
enum E<T> { V(T) }
13+
14+
struct S<T>(T);
15+
16+
true
17+
}
18+
19+
fn main() {
20+
let b = f::<int>();
21+
assert!(b);
22+
}

0 commit comments

Comments
 (0)