Skip to content

Commit

Permalink
Rollup merge of rust-lang#53622 - petrochenkov:nomain, r=oli-obk
Browse files Browse the repository at this point in the history
cleanup: Add main functions to some UI tests
  • Loading branch information
kennytm committed Aug 28, 2018
2 parents b8594d9 + cccd2ce commit 0ad879d
Show file tree
Hide file tree
Showing 50 changed files with 94 additions and 171 deletions.
1 change: 1 addition & 0 deletions src/test/ui/enum/enum-discrim-autosizing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ enum Eu64 {
Bu64 = 0x8000_0000_0000_0000 //~ERROR already exists
}

fn main() {}
9 changes: 2 additions & 7 deletions src/test/ui/enum/enum-discrim-autosizing.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
error[E0601]: `main` function not found in crate `enum_discrim_autosizing`
|
= note: consider adding a `main` function to `$DIR/enum-discrim-autosizing.rs`

error[E0081]: discriminant value `0` already exists
--> $DIR/enum-discrim-autosizing.rs:18:12
|
Expand All @@ -10,7 +6,6 @@ LL | Au64 = 0,
LL | Bu64 = 0x8000_0000_0000_0000 //~ERROR already exists
| ^^^^^^^^^^^^^^^^^^^^^ enum already has `0`

error: aborting due to 2 previous errors
error: aborting due to previous error

Some errors occurred: E0081, E0601.
For more information about an error, try `rustc --explain E0081`.
For more information about this error, try `rustc --explain E0081`.
2 changes: 2 additions & 0 deletions src/test/ui/gated-bad-feature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@
#![feature = "foo"] //~ ERROR: malformed feature

#![feature(test_removed_feature)] //~ ERROR: feature has been removed

fn main() {}
8 changes: 2 additions & 6 deletions src/test/ui/gated-bad-feature.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ error[E0557]: feature has been removed
LL | #![feature(test_removed_feature)] //~ ERROR: feature has been removed
| ^^^^^^^^^^^^^^^^^^^^

error[E0601]: `main` function not found in crate `gated_bad_feature`
|
= note: consider adding a `main` function to `$DIR/gated-bad-feature.rs`

error: aborting due to 6 previous errors
error: aborting due to 5 previous errors

Some errors occurred: E0555, E0556, E0557, E0601.
Some errors occurred: E0555, E0556, E0557.
For more information about an error, try `rustc --explain E0555`.
2 changes: 2 additions & 0 deletions src/test/ui/hygiene/generate-mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ fn check_legacy() {
struct FromOutside;
genmod_legacy!();
}

fn main() {}
9 changes: 2 additions & 7 deletions src/test/ui/hygiene/generate-mod.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ LL | type Inner = Outer; //~ ERROR cannot find type `Outer` in this scop
LL | genmod_legacy!();
| ----------------- in this macro invocation

error[E0601]: `main` function not found in crate `generate_mod`
|
= note: consider adding a `main` function to `$DIR/generate-mod.rs`

error: aborting due to 7 previous errors
error: aborting due to 6 previous errors

Some errors occurred: E0412, E0601.
For more information about an error, try `rustc --explain E0412`.
For more information about this error, try `rustc --explain E0412`.
2 changes: 2 additions & 0 deletions src/test/ui/hygiene/no_implicit_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ mod bar {
}
fn f() { ::foo::m!(); }
}

fn main() {}
8 changes: 2 additions & 6 deletions src/test/ui/hygiene/no_implicit_prelude.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ LL | fn f() { ::bar::m!(); }
LL | Vec::new(); //~ ERROR failed to resolve
| ^^^ Use of undeclared type or module `Vec`

error[E0601]: `main` function not found in crate `no_implicit_prelude`
|
= note: consider adding a `main` function to `$DIR/no_implicit_prelude.rs`

error[E0599]: no method named `clone` found for type `()` in the current scope
--> $DIR/no_implicit_prelude.rs:22:12
|
Expand All @@ -24,7 +20,7 @@ LL | ().clone() //~ ERROR no method named `clone` found
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
`use std::clone::Clone;`

error: aborting due to 3 previous errors
error: aborting due to 2 previous errors

Some errors occurred: E0433, E0599, E0601.
Some errors occurred: E0433, E0599.
For more information about an error, try `rustc --explain E0433`.
2 changes: 2 additions & 0 deletions src/test/ui/imports/import-glob-circular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ mod test {

fn test() { f1066(); } //~ ERROR cannot find function `f1066` in this scope
}

fn main() {}
9 changes: 2 additions & 7 deletions src/test/ui/imports/import-glob-circular.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ error[E0425]: cannot find function `f1066` in this scope
LL | fn test() { f1066(); } //~ ERROR cannot find function `f1066` in this scope
| ^^^^^ not found in this scope

error[E0601]: `main` function not found in crate `import_glob_circular`
|
= note: consider adding a `main` function to `$DIR/import-glob-circular.rs`

error: aborting due to 2 previous errors
error: aborting due to previous error

Some errors occurred: E0425, E0601.
For more information about an error, try `rustc --explain E0425`.
For more information about this error, try `rustc --explain E0425`.
2 changes: 2 additions & 0 deletions src/test/ui/imports/import-loop-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ mod b {

fn main() { let y = x; }
}

fn main() {}
14 changes: 2 additions & 12 deletions src/test/ui/imports/import-loop-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ error[E0432]: unresolved import `a::x`
LL | pub use a::x;
| ^^^^ no `x` in `a`

error[E0601]: `main` function not found in crate `import_loop_2`
|
= 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.
note: here is a function named 'main'
--> $DIR/import-loop-2.rs:20:5
|
LL | fn main() { let y = x; }
| ^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors
error: aborting due to previous error

Some errors occurred: E0432, E0601.
For more information about an error, try `rustc --explain E0432`.
For more information about this error, try `rustc --explain E0432`.
2 changes: 2 additions & 0 deletions src/test/ui/invalid_crate_type_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
#![crate_type(lib)] //~ ERROR `crate_type` requires a value

fn my_lib_fn() {}

fn main() {}
7 changes: 1 addition & 6 deletions src/test/ui/invalid_crate_type_syntax.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@ LL | #![crate_type(lib)] //~ ERROR `crate_type` requires a value
|
= note: for example: `#![crate_type="lib"]`

error[E0601]: `main` function not found in crate `invalid_crate_type_syntax`
|
= note: consider adding a `main` function to `$DIR/invalid_crate_type_syntax.rs`

error: aborting due to 2 previous errors
error: aborting due to previous error

For more information about this error, try `rustc --explain E0601`.
2 changes: 2 additions & 0 deletions src/test/ui/issues/issue-38715.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ macro_rules! foo { ($i:ident) => {} }
#[macro_export]
macro_rules! foo { () => {} } //~ ERROR a macro named `foo` has already been exported
//~| WARN this was previously accepted

fn main() {}
7 changes: 1 addition & 6 deletions src/test/ui/issues/issue-38715.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,5 @@ note: previous macro export is now shadowed
LL | macro_rules! foo { ($i:ident) => {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0601]: `main` function not found in crate `issue_38715`
|
= note: consider adding a `main` function to `$DIR/issue-38715.rs`

error: aborting due to 2 previous errors
error: aborting due to previous error

For more information about this error, try `rustc --explain E0601`.
2 changes: 2 additions & 0 deletions src/test/ui/issues/issue-42755.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ macro_rules! foo {
}

foo!(a);

fn main() {}
7 changes: 1 addition & 6 deletions src/test/ui/issues/issue-42755.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,5 @@ error: repetition matches empty token tree
LL | ($($p:vis)*) => {} //~ ERROR repetition matches empty token tree
| ^^^^^^^^

error[E0601]: `main` function not found in crate `issue_42755`
|
= note: consider adding a `main` function to `$DIR/issue-42755.rs`

error: aborting due to 2 previous errors
error: aborting due to previous error

For more information about this error, try `rustc --explain E0601`.
2 changes: 2 additions & 0 deletions src/test/ui/issues/issue-43784-associated-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ impl<T> Partial<T> for T::Assoc where
impl<T> Complete for T { //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied
type Assoc = T;
}

fn main() {}
9 changes: 2 additions & 7 deletions src/test/ui/issues/issue-43784-associated-type.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
error[E0601]: `main` function not found in crate `issue_43784_associated_type`
|
= note: consider adding a `main` function to `$DIR/issue-43784-associated-type.rs`

error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/issue-43784-associated-type.rs:23:9
|
Expand All @@ -10,7 +6,6 @@ LL | impl<T> Complete for T { //~ ERROR the trait bound `T: std::marker::Copy` i
|
= help: consider adding a `where T: std::marker::Copy` bound

error: aborting due to 2 previous errors
error: aborting due to previous error

Some errors occurred: E0277, E0601.
For more information about an error, try `rustc --explain E0277`.
For more information about this error, try `rustc --explain E0277`.
2 changes: 2 additions & 0 deletions src/test/ui/issues/issue-43784-supertrait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ pub trait Complete: Partial {

impl<T> Partial for T where T: Complete {}
impl<T> Complete for T {} //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied

fn main() {}
9 changes: 2 additions & 7 deletions src/test/ui/issues/issue-43784-supertrait.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
error[E0601]: `main` function not found in crate `issue_43784_supertrait`
|
= note: consider adding a `main` function to `$DIR/issue-43784-supertrait.rs`

error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/issue-43784-supertrait.rs:18:9
|
Expand All @@ -10,7 +6,6 @@ LL | impl<T> Complete for T {} //~ ERROR the trait bound `T: std::marker::Copy`
|
= help: consider adding a `where T: std::marker::Copy` bound

error: aborting due to 2 previous errors
error: aborting due to previous error

Some errors occurred: E0277, E0601.
For more information about an error, try `rustc --explain E0277`.
For more information about this error, try `rustc --explain E0277`.
2 changes: 2 additions & 0 deletions src/test/ui/macros/macro-use-bad-args-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
#[allow(unused_extern_crates)]
#[macro_use(foo(bar))] //~ ERROR bad macro import
extern crate std;

fn main() {}
9 changes: 2 additions & 7 deletions src/test/ui/macros/macro-use-bad-args-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ error[E0466]: bad macro import
LL | #[macro_use(foo(bar))] //~ ERROR bad macro import
| ^^^^^^^^

error[E0601]: `main` function not found in crate `macro_use_bad_args_1`
|
= note: consider adding a `main` function to `$DIR/macro-use-bad-args-1.rs`

error: aborting due to 2 previous errors
error: aborting due to previous error

Some errors occurred: E0466, E0601.
For more information about an error, try `rustc --explain E0466`.
For more information about this error, try `rustc --explain E0466`.
2 changes: 2 additions & 0 deletions src/test/ui/macros/macro-use-bad-args-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
#[allow(unused_extern_crates)]
#[macro_use(foo="bar")] //~ ERROR bad macro import
extern crate std;

fn main() {}
9 changes: 2 additions & 7 deletions src/test/ui/macros/macro-use-bad-args-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ error[E0466]: bad macro import
LL | #[macro_use(foo="bar")] //~ ERROR bad macro import
| ^^^^^^^^^

error[E0601]: `main` function not found in crate `macro_use_bad_args_2`
|
= note: consider adding a `main` function to `$DIR/macro-use-bad-args-2.rs`

error: aborting due to 2 previous errors
error: aborting due to previous error

Some errors occurred: E0466, E0601.
For more information about an error, try `rustc --explain E0466`.
For more information about this error, try `rustc --explain E0466`.
2 changes: 2 additions & 0 deletions src/test/ui/nested-ty-params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ fn hd<U>(v: Vec<U> ) -> U {

return hd1(v);
}

fn main() {}
9 changes: 2 additions & 7 deletions src/test/ui/nested-ty-params.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ LL | fn hd1(w: [U]) -> U { return w[0]; }
| |
| help: try using a local type parameter instead: `hd1<U>`

error[E0601]: `main` function not found in crate `nested_ty_params`
|
= note: consider adding a `main` function to `$DIR/nested-ty-params.rs`

error: aborting due to 3 previous errors
error: aborting due to 2 previous errors

Some errors occurred: E0401, E0601.
For more information about an error, try `rustc --explain E0401`.
For more information about this error, try `rustc --explain E0401`.
2 changes: 2 additions & 0 deletions src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
// error-pattern:cannot depend on a crate that needs a panic runtime

extern crate depends;

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
error: the crate `depends` cannot depend on a crate that needs a panic runtime, but it depends on `needs_panic_runtime`

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

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0601`.
2 changes: 2 additions & 0 deletions src/test/ui/repr/repr-transparent-other-items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ fn cant_repr_this() {}

#[repr(transparent)] //~ ERROR should be applied to struct
static CANT_REPR_THIS: u32 = 0;

fn main() {}
8 changes: 2 additions & 6 deletions src/test/ui/repr/repr-transparent-other-items.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
error[E0601]: `main` function not found in crate `repr_transparent_other_items`
|
= note: consider adding a `main` function to `$DIR/repr-transparent-other-items.rs`

error[E0517]: attribute should be applied to struct
--> $DIR/repr-transparent-other-items.rs:13:8
|
Expand Down Expand Up @@ -67,7 +63,7 @@ LL | #[repr(transparent)] //~ ERROR unsupported representation for zero-variant
LL | enum Void {} //~| ERROR should be applied to struct
| ------------ zero-variant enum

error: aborting due to 8 previous errors
error: aborting due to 7 previous errors

Some errors occurred: E0084, E0517, E0601.
Some errors occurred: E0084, E0517.
For more information about an error, try `rustc --explain E0084`.
2 changes: 2 additions & 0 deletions src/test/ui/repr/repr-transparent-other-reprs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ struct TransparentPlusAlign(u8);
#[repr(transparent)] //~ ERROR cannot have other repr
#[repr(C)]
struct SeparateAttributes(*mut u8);

fn main() {}
9 changes: 2 additions & 7 deletions src/test/ui/repr/repr-transparent-other-reprs.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
error[E0601]: `main` function not found in crate `repr_transparent_other_reprs`
|
= note: consider adding a `main` function to `$DIR/repr-transparent-other-reprs.rs`

error[E0692]: transparent struct cannot have other repr hints
--> $DIR/repr-transparent-other-reprs.rs:15:8
|
Expand All @@ -28,7 +24,6 @@ LL | #[repr(transparent)] //~ ERROR cannot have other repr
LL | #[repr(C)]
| ^

error: aborting due to 5 previous errors
error: aborting due to 4 previous errors

Some errors occurred: E0601, E0692.
For more information about an error, try `rustc --explain E0601`.
For more information about this error, try `rustc --explain E0692`.
2 changes: 2 additions & 0 deletions src/test/ui/repr/repr-transparent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ struct ZstAlign32<T>(PhantomData<T>);

#[repr(transparent)]
struct GenericAlign<T>(ZstAlign32<T>, u32); //~ ERROR alignment larger than 1

fn main() {}
10 changes: 3 additions & 7 deletions src/test/ui/repr/repr-transparent.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
error[E0601]: `main` function not found in crate `repr_transparent`
|
= note: consider adding a `main` function to `$DIR/repr-transparent.rs`

error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0
--> $DIR/repr-transparent.rs:21:1
|
Expand Down Expand Up @@ -70,7 +66,7 @@ error[E0691]: zero-sized field in transparent struct has alignment larger than 1
LL | struct GenericAlign<T>(ZstAlign32<T>, u32); //~ ERROR alignment larger than 1
| ^^^^^^^^^^^^^

error: aborting due to 9 previous errors
error: aborting due to 8 previous errors

Some errors occurred: E0601, E0690, E0691.
For more information about an error, try `rustc --explain E0601`.
Some errors occurred: E0690, E0691.
For more information about an error, try `rustc --explain E0690`.
2 changes: 2 additions & 0 deletions src/test/ui/resolve/resolve-unknown-trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ impl SomeNonExistentTrait for isize {}

fn f<T:SomeNonExistentTrait>() {}
//~^ ERROR cannot find trait `SomeNonExistentTrait` in this scope

fn main() {}
Loading

0 comments on commit 0ad879d

Please sign in to comment.