Skip to content

Commit cd2a50e

Browse files
committed
cleaned up some tests
Additionally, remove unused `tests/ui/auxiliary/svh-*` crates that are duplicates of `tests/ui/svh/auxiliary/svh-*`.
1 parent dcbae2c commit cd2a50e

27 files changed

+160
-96
lines changed

tests/ui/auxiliary/svh-a-base.rs

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

tests/ui/auxiliary/svh-b.rs

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

tests/ui/cast/cast-enum-to-primitive-error.fixed

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
//! This test verifies that a direct non-primitive cast from an enum to an integer type
2+
//! is correctly disallowed, even when a `From` implementation exists for that enum.
3+
14
//@ run-rustfix
5+
26
#![allow(dead_code, unused_variables)]
7+
38
enum NonNullary {
49
Nullary,
510
Other(isize),
@@ -16,5 +21,7 @@ impl From<NonNullary> for isize {
1621

1722
fn main() {
1823
let v = NonNullary::Nullary;
19-
let val = isize::from(v); //~ ERROR non-primitive cast: `NonNullary` as `isize` [E0605]
24+
let val = isize::from(v);
25+
//~^ ERROR non-primitive cast: `NonNullary` as `isize` [E0605]
26+
//~| HELP consider using the `From` trait instead
2027
}

tests/ui/cast/cast-enum-to-primitive-error.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
//! This test verifies that a direct non-primitive cast from an enum to an integer type
2+
//! is correctly disallowed, even when a `From` implementation exists for that enum.
3+
14
//@ run-rustfix
5+
26
#![allow(dead_code, unused_variables)]
7+
38
enum NonNullary {
49
Nullary,
510
Other(isize),
@@ -16,5 +21,7 @@ impl From<NonNullary> for isize {
1621

1722
fn main() {
1823
let v = NonNullary::Nullary;
19-
let val = v as isize; //~ ERROR non-primitive cast: `NonNullary` as `isize` [E0605]
24+
let val = v as isize;
25+
//~^ ERROR non-primitive cast: `NonNullary` as `isize` [E0605]
26+
//~| HELP consider using the `From` trait instead
2027
}

tests/ui/cast/cast-enum-to-primitive-error.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0605]: non-primitive cast: `NonNullary` as `isize`
2-
--> $DIR/tag-variant-cast-non-nullary.rs:19:15
2+
--> $DIR/cast-enum-to-primitive-error.rs:24:15
33
|
44
LL | let val = v as isize;
55
| ^^^^^^^^^^ an `as` expression can be used to convert enum types to numeric types only if the enum type is unit-only or field-less

tests/ui/cast/coercion-as-explicit-cast.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
//! This test checks that various forms of "trivial" casts and coercions
2+
//! can be explicitly performed using the `as` keyword without compilation errors.
3+
14
//@ run-pass
2-
// Test that all coercions can actually be done using casts (modulo the lints).
35

46
#![allow(trivial_casts, trivial_numeric_casts)]
57

tests/ui/cast/coercion-as-explicit-cast.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: method `foo` is never used
2-
--> $DIR/trivial_casts-rpass.rs:7:8
2+
--> $DIR/coercion-as-explicit-cast.rs:9:8
33
|
44
LL | trait Foo {
55
| --- method in this trait
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
enum Quux<T> { Bar }
2-
//~^ ERROR: parameter `T` is never used
1+
//! This test checks that unused generics are rejected by compiler
32
4-
fn foo(c: Quux) { assert!((false)); } //~ ERROR missing generics for enum `Quux`
3+
enum Quux<T> {
4+
//~^ ERROR: parameter `T` is never used
5+
Bar,
6+
}
57

6-
fn main() { panic!(); }
8+
fn foo(c: Quux) {
9+
//~^ ERROR missing generics for enum `Quux`
10+
assert!((false));
11+
}
12+
13+
fn main() {
14+
panic!();
15+
}

tests/ui/generics/generic-enum-errors.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
error[E0392]: type parameter `T` is never used
2-
--> $DIR/tag-type-args.rs:1:11
2+
--> $DIR/generic-enum-errors.rs:3:11
33
|
4-
LL | enum Quux<T> { Bar }
4+
LL | enum Quux<T> {
55
| ^ unused type parameter
66
|
77
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
88
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
99

1010
error[E0107]: missing generics for enum `Quux`
11-
--> $DIR/tag-type-args.rs:4:11
11+
--> $DIR/generic-enum-errors.rs:8:11
1212
|
13-
LL | fn foo(c: Quux) { assert!((false)); }
13+
LL | fn foo(c: Quux) {
1414
| ^^^^ expected 1 generic argument
1515
|
1616
note: enum defined here, with 1 generic parameter: `T`
17-
--> $DIR/tag-type-args.rs:1:6
17+
--> $DIR/generic-enum-errors.rs:3:6
1818
|
19-
LL | enum Quux<T> { Bar }
19+
LL | enum Quux<T> {
2020
| ^^^^ -
2121
help: add missing generic argument
2222
|
23-
LL | fn foo(c: Quux<T>) { assert!((false)); }
23+
LL | fn foo(c: Quux<T>) {
2424
| +++
2525

2626
error: aborting due to 2 previous errors
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Check path resolution using `super`
2+
13
//@ run-pass
24

35
#![allow(dead_code)]
@@ -6,10 +8,9 @@ pub mod a {
68
pub fn f() {}
79
pub mod b {
810
fn g() {
9-
super::f();
11+
super::f(); // Accessing `f` from module `a` (parent of `b`)
1012
}
1113
}
1214
}
1315

14-
pub fn main() {
15-
}
16+
pub fn main() {}

0 commit comments

Comments
 (0)