Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move some tests in src/test/compile-fail -> src/test/ui #62177

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions src/test/compile-fail/auxiliary/panic-runtime-lang-items.rs

This file was deleted.

17 changes: 0 additions & 17 deletions src/test/compile-fail/auxiliary/panic-runtime-unwind.rs

This file was deleted.

17 changes: 0 additions & 17 deletions src/test/compile-fail/auxiliary/panic-runtime-unwind2.rs

This file was deleted.

11 changes: 0 additions & 11 deletions src/test/compile-fail/auxiliary/some-panic-impl.rs

This file was deleted.

6 changes: 0 additions & 6 deletions src/test/compile-fail/auxiliary/wants-panic-runtime-unwind.rs

This file was deleted.

File renamed without changes.
11 changes: 11 additions & 0 deletions src/test/ui/asm/asm-src-loc.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error: <inline asm>:1:2: error: invalid instruction mnemonic 'nowayisthisavalidinstruction'
nowayisthisavalidinstruction
^~~~~~~~~~~~~~~~~~~~~~~~~~~~

--> $DIR/asm-src-loc.rs:7:9
|
LL | asm!("nowayisthisavalidinstruction");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

18 changes: 18 additions & 0 deletions src/test/ui/associated-types/issue-23595-1.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
error[E0191]: the value of the associated types `Value` (from the trait `Hierarchy`), `ChildKey` (from the trait `Hierarchy`), `Children` (from the trait `Hierarchy`) must be specified
--> $DIR/issue-23595-1.rs:8:54
|
LL | type Value;
| ----------- `Value` defined here
LL | type ChildKey;
| -------------- `ChildKey` defined here
LL | type Children = dyn Index<Self::ChildKey, Output=dyn Hierarchy>;
| -------------------------------------------------^^^^^^^^^^^^^--
| | |
| | associated type `Value` must be specified
| | associated type `ChildKey` must be specified
| | associated type `Children` must be specified
| `Children` defined here

error: aborting due to previous error

For more information about this error, try `rustc --explain E0191`.
15 changes: 15 additions & 0 deletions src/test/ui/chalkify/chalk_initial_program.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error[E0277]: the trait bound `f32: Foo` is not satisfied
--> $DIR/chalk_initial_program.rs:15:5
|
LL | gimme::<f32>();
| ^^^^^^^^^^^^ the trait `Foo` is not implemented for `f32`
|
note: required by `gimme`
--> $DIR/chalk_initial_program.rs:9:1
|
LL | fn gimme<F: Foo>() { }
| ^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
31 changes: 31 additions & 0 deletions src/test/ui/chalkify/generic_impls.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
error[E0277]: the trait bound `(std::option::Option<T>, f32): Foo` is not satisfied
--> $DIR/generic_impls.rs:12:5
|
LL | gimme::<(Option<T>, f32)>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `(std::option::Option<T>, f32)`
|
= help: the following implementations were found:
<(T, u32) as Foo>
note: required by `gimme`
--> $DIR/generic_impls.rs:7:1
|
LL | fn gimme<F: Foo>() { }
| ^^^^^^^^^^^^^^^^^^

error[E0277]: the trait bound `(i32, f32): Foo` is not satisfied
--> $DIR/generic_impls.rs:17:5
|
LL | gimme::<(i32, f32)>();
| ^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `(i32, f32)`
|
= help: the following implementations were found:
<(T, u32) as Foo>
note: required by `gimme`
--> $DIR/generic_impls.rs:7:1
|
LL | fn gimme<F: Foo>() { }
| ^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
18 changes: 18 additions & 0 deletions src/test/ui/chalkify/type_wf.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
error[E0277]: the trait bound `{float}: Foo` is not satisfied
--> $DIR/type_wf.rs:17:13
|
LL | let s = S {
| ^ the trait `Foo` is not implemented for `{float}`
|
= help: the following implementations were found:
<i32 as Foo>
<std::option::Option<T> as Foo>
note: required by `S`
--> $DIR/type_wf.rs:5:1
|
LL | struct S<T: Foo> {
| ^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
11 changes: 11 additions & 0 deletions src/test/ui/coercion/coerce-unsafe-closure-to-unsafe-fn-ptr.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:2:31
|
LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior

error: aborting due to previous error

For more information about this error, try `rustc --explain E0133`.
File renamed without changes.
32 changes: 32 additions & 0 deletions src/test/ui/consts/const-err3.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
error: this expression will panic at runtime
--> $DIR/const-err3.rs:9:13
|
LL | let b = 200u8 + 200u8 + 200u8;
| ^^^^^^^^^^^^^ attempt to add with overflow
|
note: lint level defined here
--> $DIR/const-err3.rs:2:9
|
LL | #![deny(const_err)]
| ^^^^^^^^^

error: this expression will panic at runtime
--> $DIR/const-err3.rs:11:13
|
LL | let c = 200u8 * 4;
| ^^^^^^^^^ attempt to multiply with overflow

error: this expression will panic at runtime
--> $DIR/const-err3.rs:13:13
|
LL | let d = 42u8 - (42u8 + 1);
| ^^^^^^^^^^^^^^^^^ attempt to subtract with overflow

error: index out of bounds: the len is 1 but the index is 1
--> $DIR/const-err3.rs:15:14
|
LL | let _e = [5u8][1];
| ^^^^^^^^

error: aborting due to 4 previous errors

34 changes: 34 additions & 0 deletions src/test/ui/consts/const-fn-error.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
--> $DIR/const-fn-error.rs:7:14
|
LL | for i in 0..x {
| ^^^^

error[E0019]: constant function contains unimplemented expression type
--> $DIR/const-fn-error.rs:7:14
|
LL | for i in 0..x {
| ^^^^

error[E0019]: constant function contains unimplemented expression type
--> $DIR/const-fn-error.rs:7:5
|
LL | / for i in 0..x {
LL | |
LL | |
LL | |
LL | |
LL | | sum += i;
LL | | }
| |_____^

error[E0080]: evaluation of constant value failed
--> $DIR/const-fn-error.rs:7:14
|
LL | for i in 0..x {
| ^^^^ calling non-const function `<std::ops::Range<usize> as std::iter::IntoIterator>::into_iter`

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0015, E0019, E0080.
For more information about an error, try `rustc --explain E0015`.
File renamed without changes.
55 changes: 55 additions & 0 deletions src/test/ui/consts/issue-52443.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
error[E0308]: mismatched types
--> $DIR/issue-52443.rs:2:10
|
LL | [(); & { loop { continue } } ];
| ^^^^^^^^^^^^^^^^^^^^^^^
| |
| expected usize, found reference
| help: consider removing the borrow: `{ loop { continue } }`
|
= note: expected type `usize`
found type `&_`

error[E0308]: mismatched types
--> $DIR/issue-52443.rs:3:17
|
LL | [(); loop { break }];
| ^^^^^ expected (), found usize
|
= note: expected type `()`
found type `usize`

error[E0019]: constant contains unimplemented expression type
--> $DIR/issue-52443.rs:4:11
|
LL | [(); {while true {break}; 0}];
| ^^^^^^^^^^^^^^^^^^

error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
--> $DIR/issue-52443.rs:5:21
|
LL | [(); { for _ in 0usize.. {}; 0}];
| ^^^^^^^^

error[E0019]: constant contains unimplemented expression type
--> $DIR/issue-52443.rs:5:21
|
LL | [(); { for _ in 0usize.. {}; 0}];
| ^^^^^^^^

error[E0019]: constant contains unimplemented expression type
--> $DIR/issue-52443.rs:5:12
|
LL | [(); { for _ in 0usize.. {}; 0}];
| ^^^^^^^^^^^^^^^^^^^^

error[E0080]: evaluation of constant value failed
--> $DIR/issue-52443.rs:5:21
|
LL | [(); { for _ in 0usize.. {}; 0}];
| ^^^^^^^^ calling non-const function `<std::ops::RangeFrom<usize> as std::iter::IntoIterator>::into_iter`

error: aborting due to 7 previous errors

Some errors have detailed explanations: E0015, E0019, E0080, E0308.
For more information about an error, try `rustc --explain E0015`.
5 changes: 5 additions & 0 deletions src/test/ui/imports/empty-extern-arg-wasm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// compile-flags: --extern std=
// error-pattern: can't find crate for `std`
// only-wasm32

fn main() {}
9 changes: 9 additions & 0 deletions src/test/ui/imports/empty-extern-arg-wasm.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error: extern location for std does not exist:

error[E0463]: can't find crate for `std`
|
= note: the `wasm32-unknown-unknown` target may not be installed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also use normalization to get rid of these two lines. Then you don't need to duplicate tests.

Copy link
Member

@RalfJung RalfJung Jun 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have e.g. used the following to normalize away entire lines in other tests:

// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> ""
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, this is great news.
For some reason I thought the normalization works per-line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much simpler to fix platform-dependent tests this way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the matching of the normalization pattern is per-line -- but if you include the final \n, you can remove the entire line. And then that's handled correctly when comparing later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have a look at this tomorrow; in the meantime feel free to r- or we can do this in a follow up PR if that's alright with y'all.


error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0463`.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// compile-flags: --extern std=
// error-pattern: can't find crate for `std`
// ignore-wasm32

fn main() {}
7 changes: 7 additions & 0 deletions src/test/ui/imports/empty-extern-arg.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
error: extern location for std does not exist:

error[E0463]: can't find crate for `std`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0463`.
19 changes: 19 additions & 0 deletions src/test/ui/lang-item/weak-lang-item.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
error[E0259]: the name `core` is defined multiple times
--> $DIR/weak-lang-item.rs:8:1
|
LL | extern crate core;
| ^^^^^^^^^^^^^^^^^^ `core` reimported here
|
= note: `core` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
|
LL | extern crate core as other_core;
|

error: `#[panic_handler]` function required, but not found

error: language item required, but not found: `eh_personality`

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0259`.
6 changes: 6 additions & 0 deletions src/test/ui/linkage/issue-10755.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
error: linker `llllll` not found
|
= note: No such file or directory (os error 2)

error: aborting due to previous error

File renamed without changes.
File renamed without changes.
Loading