Skip to content

Commit cccd2ce

Browse files
committed
cleanup: Add main functions to some UI tests
1 parent f1b506a commit cccd2ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+94
-171
lines changed

src/test/ui/enum/enum-discrim-autosizing.rs

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ enum Eu64 {
1818
Bu64 = 0x8000_0000_0000_0000 //~ERROR already exists
1919
}
2020

21+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
error[E0601]: `main` function not found in crate `enum_discrim_autosizing`
2-
|
3-
= note: consider adding a `main` function to `$DIR/enum-discrim-autosizing.rs`
4-
51
error[E0081]: discriminant value `0` already exists
62
--> $DIR/enum-discrim-autosizing.rs:18:12
73
|
@@ -10,7 +6,6 @@ LL | Au64 = 0,
106
LL | Bu64 = 0x8000_0000_0000_0000 //~ERROR already exists
117
| ^^^^^^^^^^^^^^^^^^^^^ enum already has `0`
128

13-
error: aborting due to 2 previous errors
9+
error: aborting due to previous error
1410

15-
Some errors occurred: E0081, E0601.
16-
For more information about an error, try `rustc --explain E0081`.
11+
For more information about this error, try `rustc --explain E0081`.

src/test/ui/gated-bad-feature.rs

+2
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@
2020
#![feature = "foo"] //~ ERROR: malformed feature
2121

2222
#![feature(test_removed_feature)] //~ ERROR: feature has been removed
23+
24+
fn main() {}

src/test/ui/gated-bad-feature.stderr

+2-6
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ error[E0557]: feature has been removed
2828
LL | #![feature(test_removed_feature)] //~ ERROR: feature has been removed
2929
| ^^^^^^^^^^^^^^^^^^^^
3030

31-
error[E0601]: `main` function not found in crate `gated_bad_feature`
32-
|
33-
= note: consider adding a `main` function to `$DIR/gated-bad-feature.rs`
34-
35-
error: aborting due to 6 previous errors
31+
error: aborting due to 5 previous errors
3632

37-
Some errors occurred: E0555, E0556, E0557, E0601.
33+
Some errors occurred: E0555, E0556, E0557.
3834
For more information about an error, try `rustc --explain E0555`.

src/test/ui/hygiene/generate-mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,5 @@ fn check_legacy() {
5555
struct FromOutside;
5656
genmod_legacy!();
5757
}
58+
59+
fn main() {}

src/test/ui/hygiene/generate-mod.stderr

+2-7
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ LL | type Inner = Outer; //~ ERROR cannot find type `Outer` in this scop
4646
LL | genmod_legacy!();
4747
| ----------------- in this macro invocation
4848

49-
error[E0601]: `main` function not found in crate `generate_mod`
50-
|
51-
= note: consider adding a `main` function to `$DIR/generate-mod.rs`
52-
53-
error: aborting due to 7 previous errors
49+
error: aborting due to 6 previous errors
5450

55-
Some errors occurred: E0412, E0601.
56-
For more information about an error, try `rustc --explain E0412`.
51+
For more information about this error, try `rustc --explain E0412`.

src/test/ui/hygiene/no_implicit_prelude.rs

+2
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ mod bar {
2323
}
2424
fn f() { ::foo::m!(); }
2525
}
26+
27+
fn main() {}

src/test/ui/hygiene/no_implicit_prelude.stderr

+2-6
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ LL | fn f() { ::bar::m!(); }
77
LL | Vec::new(); //~ ERROR failed to resolve
88
| ^^^ Use of undeclared type or module `Vec`
99

10-
error[E0601]: `main` function not found in crate `no_implicit_prelude`
11-
|
12-
= note: consider adding a `main` function to `$DIR/no_implicit_prelude.rs`
13-
1410
error[E0599]: no method named `clone` found for type `()` in the current scope
1511
--> $DIR/no_implicit_prelude.rs:22:12
1612
|
@@ -24,7 +20,7 @@ LL | ().clone() //~ ERROR no method named `clone` found
2420
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
2521
`use std::clone::Clone;`
2622

27-
error: aborting due to 3 previous errors
23+
error: aborting due to 2 previous errors
2824

29-
Some errors occurred: E0433, E0599, E0601.
25+
Some errors occurred: E0433, E0599.
3026
For more information about an error, try `rustc --explain E0433`.

src/test/ui/imports/import-glob-circular.rs

+2
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ mod test {
2525

2626
fn test() { f1066(); } //~ ERROR cannot find function `f1066` in this scope
2727
}
28+
29+
fn main() {}

src/test/ui/imports/import-glob-circular.stderr

+2-7
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ error[E0425]: cannot find function `f1066` in this scope
44
LL | fn test() { f1066(); } //~ ERROR cannot find function `f1066` in this scope
55
| ^^^^^ not found in this scope
66

7-
error[E0601]: `main` function not found in crate `import_glob_circular`
8-
|
9-
= note: consider adding a `main` function to `$DIR/import-glob-circular.rs`
10-
11-
error: aborting due to 2 previous errors
7+
error: aborting due to previous error
128

13-
Some errors occurred: E0425, E0601.
14-
For more information about an error, try `rustc --explain E0425`.
9+
For more information about this error, try `rustc --explain E0425`.

src/test/ui/imports/import-loop-2.rs

+2
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ mod b {
1919

2020
fn main() { let y = x; }
2121
}
22+
23+
fn main() {}

src/test/ui/imports/import-loop-2.stderr

+2-12
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ error[E0432]: unresolved import `a::x`
44
LL | pub use a::x;
55
| ^^^^ no `x` in `a`
66

7-
error[E0601]: `main` function not found in crate `import_loop_2`
8-
|
9-
= note: the main function must be defined at the crate level but you have one or more functions named 'main' that are not defined at the crate level. Either move the definition or attach the `#[main]` attribute to override this behavior.
10-
note: here is a function named 'main'
11-
--> $DIR/import-loop-2.rs:20:5
12-
|
13-
LL | fn main() { let y = x; }
14-
| ^^^^^^^^^^^^^^^^^^^^^^^^
15-
16-
error: aborting due to 2 previous errors
7+
error: aborting due to previous error
178

18-
Some errors occurred: E0432, E0601.
19-
For more information about an error, try `rustc --explain E0432`.
9+
For more information about this error, try `rustc --explain E0432`.

src/test/ui/invalid_crate_type_syntax.rs

+2
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212
#![crate_type(lib)] //~ ERROR `crate_type` requires a value
1313

1414
fn my_lib_fn() {}
15+
16+
fn main() {}

src/test/ui/invalid_crate_type_syntax.stderr

+1-6
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,5 @@ LL | #![crate_type(lib)] //~ ERROR `crate_type` requires a value
66
|
77
= note: for example: `#![crate_type="lib"]`
88

9-
error[E0601]: `main` function not found in crate `invalid_crate_type_syntax`
10-
|
11-
= note: consider adding a `main` function to `$DIR/invalid_crate_type_syntax.rs`
12-
13-
error: aborting due to 2 previous errors
9+
error: aborting due to previous error
1410

15-
For more information about this error, try `rustc --explain E0601`.

src/test/ui/issues/issue-38715.rs

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ macro_rules! foo { ($i:ident) => {} }
1414
#[macro_export]
1515
macro_rules! foo { () => {} } //~ ERROR a macro named `foo` has already been exported
1616
//~| WARN this was previously accepted
17+
18+
fn main() {}

src/test/ui/issues/issue-38715.stderr

+1-6
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,5 @@ note: previous macro export is now shadowed
1313
LL | macro_rules! foo { ($i:ident) => {} }
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1515

16-
error[E0601]: `main` function not found in crate `issue_38715`
17-
|
18-
= note: consider adding a `main` function to `$DIR/issue-38715.rs`
19-
20-
error: aborting due to 2 previous errors
16+
error: aborting due to previous error
2117

22-
For more information about this error, try `rustc --explain E0601`.

src/test/ui/issues/issue-42755.rs

+2
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ macro_rules! foo {
1515
}
1616

1717
foo!(a);
18+
19+
fn main() {}

src/test/ui/issues/issue-42755.stderr

+1-6
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,5 @@ error: repetition matches empty token tree
44
LL | ($($p:vis)*) => {} //~ ERROR repetition matches empty token tree
55
| ^^^^^^^^
66

7-
error[E0601]: `main` function not found in crate `issue_42755`
8-
|
9-
= note: consider adding a `main` function to `$DIR/issue-42755.rs`
10-
11-
error: aborting due to 2 previous errors
7+
error: aborting due to previous error
128

13-
For more information about this error, try `rustc --explain E0601`.

src/test/ui/issues/issue-43784-associated-type.rs

+2
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ impl<T> Partial<T> for T::Assoc where
2323
impl<T> Complete for T { //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied
2424
type Assoc = T;
2525
}
26+
27+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
error[E0601]: `main` function not found in crate `issue_43784_associated_type`
2-
|
3-
= note: consider adding a `main` function to `$DIR/issue-43784-associated-type.rs`
4-
51
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
62
--> $DIR/issue-43784-associated-type.rs:23:9
73
|
@@ -10,7 +6,6 @@ LL | impl<T> Complete for T { //~ ERROR the trait bound `T: std::marker::Copy` i
106
|
117
= help: consider adding a `where T: std::marker::Copy` bound
128

13-
error: aborting due to 2 previous errors
9+
error: aborting due to previous error
1410

15-
Some errors occurred: E0277, E0601.
16-
For more information about an error, try `rustc --explain E0277`.
11+
For more information about this error, try `rustc --explain E0277`.

src/test/ui/issues/issue-43784-supertrait.rs

+2
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ pub trait Complete: Partial {
1616

1717
impl<T> Partial for T where T: Complete {}
1818
impl<T> Complete for T {} //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied
19+
20+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
error[E0601]: `main` function not found in crate `issue_43784_supertrait`
2-
|
3-
= note: consider adding a `main` function to `$DIR/issue-43784-supertrait.rs`
4-
51
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
62
--> $DIR/issue-43784-supertrait.rs:18:9
73
|
@@ -10,7 +6,6 @@ LL | impl<T> Complete for T {} //~ ERROR the trait bound `T: std::marker::Copy`
106
|
117
= help: consider adding a `where T: std::marker::Copy` bound
128

13-
error: aborting due to 2 previous errors
9+
error: aborting due to previous error
1410

15-
Some errors occurred: E0277, E0601.
16-
For more information about an error, try `rustc --explain E0277`.
11+
For more information about this error, try `rustc --explain E0277`.

src/test/ui/macros/macro-use-bad-args-1.rs

+2
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313
#[allow(unused_extern_crates)]
1414
#[macro_use(foo(bar))] //~ ERROR bad macro import
1515
extern crate std;
16+
17+
fn main() {}

src/test/ui/macros/macro-use-bad-args-1.stderr

+2-7
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ error[E0466]: bad macro import
44
LL | #[macro_use(foo(bar))] //~ ERROR bad macro import
55
| ^^^^^^^^
66

7-
error[E0601]: `main` function not found in crate `macro_use_bad_args_1`
8-
|
9-
= note: consider adding a `main` function to `$DIR/macro-use-bad-args-1.rs`
10-
11-
error: aborting due to 2 previous errors
7+
error: aborting due to previous error
128

13-
Some errors occurred: E0466, E0601.
14-
For more information about an error, try `rustc --explain E0466`.
9+
For more information about this error, try `rustc --explain E0466`.

src/test/ui/macros/macro-use-bad-args-2.rs

+2
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313
#[allow(unused_extern_crates)]
1414
#[macro_use(foo="bar")] //~ ERROR bad macro import
1515
extern crate std;
16+
17+
fn main() {}

src/test/ui/macros/macro-use-bad-args-2.stderr

+2-7
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ error[E0466]: bad macro import
44
LL | #[macro_use(foo="bar")] //~ ERROR bad macro import
55
| ^^^^^^^^^
66

7-
error[E0601]: `main` function not found in crate `macro_use_bad_args_2`
8-
|
9-
= note: consider adding a `main` function to `$DIR/macro-use-bad-args-2.rs`
10-
11-
error: aborting due to 2 previous errors
7+
error: aborting due to previous error
128

13-
Some errors occurred: E0466, E0601.
14-
For more information about an error, try `rustc --explain E0466`.
9+
For more information about this error, try `rustc --explain E0466`.

src/test/ui/nested-ty-params.rs

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ fn hd<U>(v: Vec<U> ) -> U {
1414

1515
return hd1(v);
1616
}
17+
18+
fn main() {}

src/test/ui/nested-ty-params.stderr

+2-7
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ LL | fn hd1(w: [U]) -> U { return w[0]; }
1818
| |
1919
| help: try using a local type parameter instead: `hd1<U>`
2020

21-
error[E0601]: `main` function not found in crate `nested_ty_params`
22-
|
23-
= note: consider adding a `main` function to `$DIR/nested-ty-params.rs`
24-
25-
error: aborting due to 3 previous errors
21+
error: aborting due to 2 previous errors
2622

27-
Some errors occurred: E0401, E0601.
28-
For more information about an error, try `rustc --explain E0401`.
23+
For more information about this error, try `rustc --explain E0401`.

src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.rs

+2
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313
// error-pattern:cannot depend on a crate that needs a panic runtime
1414

1515
extern crate depends;
16+
17+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
error: the crate `depends` cannot depend on a crate that needs a panic runtime, but it depends on `needs_panic_runtime`
22

3-
error[E0601]: `main` function not found in crate `runtime_depend_on_needs_runtime`
4-
|
5-
= note: consider adding a `main` function to `$DIR/runtime-depend-on-needs-runtime.rs`
3+
error: aborting due to previous error
64

7-
error: aborting due to 2 previous errors
8-
9-
For more information about this error, try `rustc --explain E0601`.

src/test/ui/repr/repr-transparent-other-items.rs

+2
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ fn cant_repr_this() {}
3636

3737
#[repr(transparent)] //~ ERROR should be applied to struct
3838
static CANT_REPR_THIS: u32 = 0;
39+
40+
fn main() {}

src/test/ui/repr/repr-transparent-other-items.stderr

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
error[E0601]: `main` function not found in crate `repr_transparent_other_items`
2-
|
3-
= note: consider adding a `main` function to `$DIR/repr-transparent-other-items.rs`
4-
51
error[E0517]: attribute should be applied to struct
62
--> $DIR/repr-transparent-other-items.rs:13:8
73
|
@@ -67,7 +63,7 @@ LL | #[repr(transparent)] //~ ERROR unsupported representation for zero-variant
6763
LL | enum Void {} //~| ERROR should be applied to struct
6864
| ------------ zero-variant enum
6965

70-
error: aborting due to 8 previous errors
66+
error: aborting due to 7 previous errors
7167

72-
Some errors occurred: E0084, E0517, E0601.
68+
Some errors occurred: E0084, E0517.
7369
For more information about an error, try `rustc --explain E0084`.

src/test/ui/repr/repr-transparent-other-reprs.rs

+2
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ struct TransparentPlusAlign(u8);
2626
#[repr(transparent)] //~ ERROR cannot have other repr
2727
#[repr(C)]
2828
struct SeparateAttributes(*mut u8);
29+
30+
fn main() {}

src/test/ui/repr/repr-transparent-other-reprs.stderr

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
error[E0601]: `main` function not found in crate `repr_transparent_other_reprs`
2-
|
3-
= note: consider adding a `main` function to `$DIR/repr-transparent-other-reprs.rs`
4-
51
error[E0692]: transparent struct cannot have other repr hints
62
--> $DIR/repr-transparent-other-reprs.rs:15:8
73
|
@@ -28,7 +24,6 @@ LL | #[repr(transparent)] //~ ERROR cannot have other repr
2824
LL | #[repr(C)]
2925
| ^
3026

31-
error: aborting due to 5 previous errors
27+
error: aborting due to 4 previous errors
3228

33-
Some errors occurred: E0601, E0692.
34-
For more information about an error, try `rustc --explain E0601`.
29+
For more information about this error, try `rustc --explain E0692`.

src/test/ui/repr/repr-transparent.rs

+2
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,5 @@ struct ZstAlign32<T>(PhantomData<T>);
4848

4949
#[repr(transparent)]
5050
struct GenericAlign<T>(ZstAlign32<T>, u32); //~ ERROR alignment larger than 1
51+
52+
fn main() {}

src/test/ui/repr/repr-transparent.stderr

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
error[E0601]: `main` function not found in crate `repr_transparent`
2-
|
3-
= note: consider adding a `main` function to `$DIR/repr-transparent.rs`
4-
51
error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0
62
--> $DIR/repr-transparent.rs:21:1
73
|
@@ -70,7 +66,7 @@ error[E0691]: zero-sized field in transparent struct has alignment larger than 1
7066
LL | struct GenericAlign<T>(ZstAlign32<T>, u32); //~ ERROR alignment larger than 1
7167
| ^^^^^^^^^^^^^
7268

73-
error: aborting due to 9 previous errors
69+
error: aborting due to 8 previous errors
7470

75-
Some errors occurred: E0601, E0690, E0691.
76-
For more information about an error, try `rustc --explain E0601`.
71+
Some errors occurred: E0690, E0691.
72+
For more information about an error, try `rustc --explain E0690`.

src/test/ui/resolve/resolve-unknown-trait.rs

+2
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ impl SomeNonExistentTrait for isize {}
1717

1818
fn f<T:SomeNonExistentTrait>() {}
1919
//~^ ERROR cannot find trait `SomeNonExistentTrait` in this scope
20+
21+
fn main() {}

0 commit comments

Comments
 (0)