Skip to content

chore: edit and move tests #140465

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

Merged
merged 2 commits into from
Apr 30, 2025
Merged
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
1 change: 0 additions & 1 deletion tests/ui/auxiliary/removing-extern-crate.rs

This file was deleted.

10 changes: 0 additions & 10 deletions tests/ui/catch-unwind-bang.rs

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Check that if there are a lot of errors we truncate the list of errors appropriately

enum Question {
Yes,
No,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0425]: cannot find value `y` in this scope
--> $DIR/error-festival.rs:14:5
--> $DIR/error-festival.rs:16:5
|
LL | y = 2;
| ^
Expand All @@ -15,47 +15,47 @@ LL | let y = 2;
| +++

error[E0603]: constant `FOO` is private
--> $DIR/error-festival.rs:22:10
--> $DIR/error-festival.rs:24:10
|
LL | foo::FOO;
| ^^^ private constant
|
note: the constant `FOO` is defined here
--> $DIR/error-festival.rs:7:5
--> $DIR/error-festival.rs:9:5
|
LL | const FOO: u32 = 0;
| ^^^^^^^^^^^^^^^^^^^

error[E0368]: binary assignment operation `+=` cannot be applied to type `&str`
--> $DIR/error-festival.rs:12:5
--> $DIR/error-festival.rs:14:5
|
LL | x += 2;
| -^^^^^
| |
| cannot use `+=` on type `&str`

error[E0599]: no method named `z` found for reference `&str` in the current scope
--> $DIR/error-festival.rs:16:7
--> $DIR/error-festival.rs:18:7
|
LL | x.z();
| ^ method not found in `&str`

error[E0600]: cannot apply unary operator `!` to type `Question`
--> $DIR/error-festival.rs:19:5
--> $DIR/error-festival.rs:21:5
|
LL | !Question::Yes;
| ^^^^^^^^^^^^^^ cannot apply unary operator `!`
|
note: an implementation of `Not` might be missing for `Question`
--> $DIR/error-festival.rs:1:1
--> $DIR/error-festival.rs:3:1
|
LL | enum Question {
| ^^^^^^^^^^^^^ must implement `Not`
note: the trait `Not` must be implemented
--> $SRC_DIR/core/src/ops/bit.rs:LL:COL

error[E0604]: only `u8` can be cast as `char`, not `u32`
--> $DIR/error-festival.rs:25:5
--> $DIR/error-festival.rs:27:5
|
LL | 0u32 as char;
| ^^^^^^^^^^^^
Expand All @@ -64,13 +64,13 @@ LL | 0u32 as char;
| help: try `char::from_u32` instead: `char::from_u32(0u32)`

error[E0605]: non-primitive cast: `u8` as `Vec<u8>`
--> $DIR/error-festival.rs:29:5
--> $DIR/error-festival.rs:31:5
|
LL | x as Vec<u8>;
| ^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object

error[E0054]: cannot cast `{integer}` as `bool`
--> $DIR/error-festival.rs:33:24
--> $DIR/error-festival.rs:35:24
|
LL | let x_is_nonzero = x as bool;
| ^^^^^^^^^
Expand All @@ -82,7 +82,7 @@ LL + let x_is_nonzero = x != 0;
|

error[E0606]: casting `&u8` as `u32` is invalid
--> $DIR/error-festival.rs:37:18
--> $DIR/error-festival.rs:39:18
|
LL | let y: u32 = x as u32;
| ^^^^^^^^
Expand All @@ -93,7 +93,7 @@ LL | let y: u32 = *x as u32;
| +

error[E0607]: cannot cast thin pointer `*const u8` to wide pointer `*const [u8]`
--> $DIR/error-festival.rs:41:5
--> $DIR/error-festival.rs:43:5
|
LL | v as *const [u8];
| ^^^^^^^^^^^^^^^^
Expand Down
10 changes: 0 additions & 10 deletions tests/ui/non-copyable-void.rs

This file was deleted.

9 changes: 0 additions & 9 deletions tests/ui/non-copyable-void.stderr

This file was deleted.

15 changes: 15 additions & 0 deletions tests/ui/panics/catch-unwind-bang.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! Check that the unwind machinery handles uninhabited types correctly.
//! It used to call `std::mem::uninitialized::<!>();` at some point...
//!
//! See <https://github.com/rust-lang/rust/issues/39432>

//@ run-pass
//@ needs-unwind

fn worker() -> ! {
panic!()
}

fn main() {
std::panic::catch_unwind(worker).unwrap_err();
}
2 changes: 2 additions & 0 deletions tests/ui/rust-2018/auxiliary/dummy-crate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// intentionally blank, used because we need an extern crate for
// `removing-extern-crate.rs` but don't care about what's in it.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ edition:2018
//@ aux-build:removing-extern-crate.rs
//@ aux-build:dummy-crate.rs
//@ run-rustfix
//@ check-pass

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
//@ edition:2018
//@ aux-build:removing-extern-crate.rs
//@ aux-build:dummy-crate.rs
//@ run-rustfix
//@ check-pass

#![warn(rust_2018_idioms)]

extern crate removing_extern_crate as foo; //~ WARNING unused extern crate
extern crate dummy_crate as foo; //~ WARNING unused extern crate
extern crate core; //~ WARNING unused extern crate

mod another {
extern crate removing_extern_crate as foo; //~ WARNING unused extern crate
extern crate dummy_crate as foo; //~ WARNING unused extern crate
extern crate core; //~ WARNING unused extern crate
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
warning: unused extern crate
--> $DIR/removing-extern-crate.rs:8:1
|
LL | extern crate removing_extern_crate as foo;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
LL | extern crate dummy_crate as foo;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
|
note: the lint level is defined here
--> $DIR/removing-extern-crate.rs:6:9
Expand All @@ -20,8 +20,8 @@ LL | extern crate core;
warning: unused extern crate
--> $DIR/removing-extern-crate.rs:12:5
|
LL | extern crate removing_extern_crate as foo;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
LL | extern crate dummy_crate as foo;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it

warning: unused extern crate
--> $DIR/removing-extern-crate.rs:13:5
Expand Down
Loading