diff options
Diffstat (limited to 'tests')
18 files changed, 75 insertions, 111 deletions
diff --git a/tests/ui/async-await/async-drop/partly-dropped-tuple.rs b/tests/ui/async-await/async-drop/partly-dropped-tuple.rs new file mode 100644 index 00000000000..147caaf4cfd --- /dev/null +++ b/tests/ui/async-await/async-drop/partly-dropped-tuple.rs @@ -0,0 +1,11 @@ +//@ edition: 2024 +//@ build-pass +#![crate_type = "lib"] +#![allow(incomplete_features)] +#![feature(async_drop)] +async fn move_part_await_return_rest_tuple() -> Vec<usize> { + let x = (vec![3], vec![4, 4]); + drop(x.1); + + x.0 +} diff --git a/tests/ui/auxiliary/default-ty-param-cross-crate-crate.rs b/tests/ui/auxiliary/default-ty-param-cross-crate-crate.rs deleted file mode 100644 index d722b78768a..00000000000 --- a/tests/ui/auxiliary/default-ty-param-cross-crate-crate.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![crate_type = "lib"] -#![crate_name = "default_param_test"] -#![feature(default_type_parameter_fallback)] - -use std::marker::PhantomData; - -pub struct Foo<A, B>(PhantomData<(A, B)>); - -pub fn bleh<A=i32, X=char>() -> Foo<A, X> { Foo(PhantomData) } diff --git a/tests/ui/auxiliary/edition-kw-macro-2015.rs b/tests/ui/auxiliary/edition-kw-macro-2015.rs deleted file mode 100644 index 7f479fa9370..00000000000 --- a/tests/ui/auxiliary/edition-kw-macro-2015.rs +++ /dev/null @@ -1,26 +0,0 @@ -//@ edition:2015 - -#[macro_export] -macro_rules! produces_async { - () => (pub fn async() {}) -} - -#[macro_export] -macro_rules! produces_async_raw { - () => (pub fn r#async() {}) -} - -#[macro_export] -macro_rules! consumes_async { - (async) => (1) -} - -#[macro_export] -macro_rules! consumes_async_raw { - (r#async) => (1) -} - -#[macro_export] -macro_rules! passes_ident { - ($i: ident) => ($i) -} diff --git a/tests/ui/auxiliary/edition-kw-macro-2018.rs b/tests/ui/auxiliary/edition-kw-macro-2018.rs deleted file mode 100644 index ba8ecc4d83b..00000000000 --- a/tests/ui/auxiliary/edition-kw-macro-2018.rs +++ /dev/null @@ -1,26 +0,0 @@ -//@ edition:2018 - -#[macro_export] -macro_rules! produces_async { - () => (pub fn async() {}) -} - -#[macro_export] -macro_rules! produces_async_raw { - () => (pub fn r#async() {}) -} - -#[macro_export] -macro_rules! consumes_async { - (async) => (1) -} - -#[macro_export] -macro_rules! consumes_async_raw { - (r#async) => (1) -} - -#[macro_export] -macro_rules! passes_ident { - ($i: ident) => ($i) -} diff --git a/tests/ui/auxiliary/removing-extern-crate.rs b/tests/ui/auxiliary/removing-extern-crate.rs deleted file mode 100644 index 65e2cc34045..00000000000 --- a/tests/ui/auxiliary/removing-extern-crate.rs +++ /dev/null @@ -1 +0,0 @@ -// intentionally blank diff --git a/tests/ui/catch-unwind-bang.rs b/tests/ui/catch-unwind-bang.rs deleted file mode 100644 index c874c649f33..00000000000 --- a/tests/ui/catch-unwind-bang.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass -//@ needs-unwind - -fn worker() -> ! { - panic!() -} - -fn main() { - std::panic::catch_unwind(worker).unwrap_err(); -} diff --git a/tests/ui/cfguard-run.rs b/tests/ui/codegen/cfguard-run.rs index 52ad3e3cc04..52ad3e3cc04 100644 --- a/tests/ui/cfguard-run.rs +++ b/tests/ui/codegen/cfguard-run.rs diff --git a/tests/ui/const-generics/const_eval_unchecked_doesnt_fire_patterns.rs b/tests/ui/const-generics/const_eval_unchecked_doesnt_fire_patterns.rs new file mode 100644 index 00000000000..fae2d16f430 --- /dev/null +++ b/tests/ui/const-generics/const_eval_unchecked_doesnt_fire_patterns.rs @@ -0,0 +1,23 @@ +//@ check-pass + +// Previously the `CONST_EVALUATABLE_UNCHECKED` FCW would fire on const evaluation of +// associated consts. This is unnecessary as the FCW only needs to apply for repeat expr +// counts which are anon consts with generic parameters provided. #140447 + +pub struct Foo<const N: usize>; + +impl<const N: usize> Foo<N> { + const UNUSED_PARAM: usize = { + let _: [(); N]; + 3 + }; + + pub fn bar() { + match 1 { + Self::UNUSED_PARAM => (), + _ => (), + } + } +} + +fn main() {} diff --git a/tests/ui/error-festival.rs b/tests/ui/error-emitter/error-festival.rs index 356564e5407..ebb5882352c 100644 --- a/tests/ui/error-festival.rs +++ b/tests/ui/error-emitter/error-festival.rs @@ -1,3 +1,5 @@ +//! Check that if there are a lot of errors we truncate the list of errors appropriately + enum Question { Yes, No, diff --git a/tests/ui/error-festival.stderr b/tests/ui/error-emitter/error-festival.stderr index 9db95363791..be484bc8094 100644 --- a/tests/ui/error-festival.stderr +++ b/tests/ui/error-emitter/error-festival.stderr @@ -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; | ^ @@ -15,19 +15,19 @@ 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; | -^^^^^ @@ -35,19 +35,19 @@ 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` @@ -55,7 +55,7 @@ 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; | ^^^^^^^^^^^^ @@ -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; | ^^^^^^^^^ @@ -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; | ^^^^^^^^ @@ -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]; | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/non-copyable-void.rs b/tests/ui/non-copyable-void.rs deleted file mode 100644 index 55bad82bc33..00000000000 --- a/tests/ui/non-copyable-void.rs +++ /dev/null @@ -1,10 +0,0 @@ -use std::ffi::c_void; - -fn main() { - let x : *const Vec<isize> = &vec![1,2,3]; - let y : *const c_void = x as *const c_void; - unsafe { - let _z = (*y).clone(); - //~^ ERROR no method named `clone` found - } -} diff --git a/tests/ui/non-copyable-void.stderr b/tests/ui/non-copyable-void.stderr deleted file mode 100644 index 373557fa01a..00000000000 --- a/tests/ui/non-copyable-void.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0599]: no method named `clone` found for enum `c_void` in the current scope - --> $DIR/non-copyable-void.rs:7:23 - | -LL | let _z = (*y).clone(); - | ^^^^^ method not found in `c_void` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/panics/catch-unwind-bang.rs b/tests/ui/panics/catch-unwind-bang.rs new file mode 100644 index 00000000000..80eb377e5ca --- /dev/null +++ b/tests/ui/panics/catch-unwind-bang.rs @@ -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(); +} diff --git a/tests/ui/rust-2018/auxiliary/dummy-crate.rs b/tests/ui/rust-2018/auxiliary/dummy-crate.rs new file mode 100644 index 00000000000..c9e8881600d --- /dev/null +++ b/tests/ui/rust-2018/auxiliary/dummy-crate.rs @@ -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. diff --git a/tests/ui/removing-extern-crate.fixed b/tests/ui/rust-2018/removing-extern-crate.fixed index 477161fba80..e88a84cc93e 100644 --- a/tests/ui/removing-extern-crate.fixed +++ b/tests/ui/rust-2018/removing-extern-crate.fixed @@ -1,5 +1,5 @@ //@ edition:2018 -//@ aux-build:removing-extern-crate.rs +//@ aux-build:dummy-crate.rs //@ run-rustfix //@ check-pass diff --git a/tests/ui/removing-extern-crate.rs b/tests/ui/rust-2018/removing-extern-crate.rs index 0b819482c71..844377945e0 100644 --- a/tests/ui/removing-extern-crate.rs +++ b/tests/ui/rust-2018/removing-extern-crate.rs @@ -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 } diff --git a/tests/ui/removing-extern-crate.stderr b/tests/ui/rust-2018/removing-extern-crate.stderr index 4dddf160ce2..57312542640 100644 --- a/tests/ui/removing-extern-crate.stderr +++ b/tests/ui/rust-2018/removing-extern-crate.stderr @@ -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 @@ -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 diff --git a/tests/ui/sanitizer/asan_odr_windows.rs b/tests/ui/sanitizer/asan_odr_windows.rs index c618ac02a66..28c24716761 100644 --- a/tests/ui/sanitizer/asan_odr_windows.rs +++ b/tests/ui/sanitizer/asan_odr_windows.rs @@ -5,6 +5,8 @@ //@ compile-flags:-Zsanitizer=address //@ aux-build: asan_odr_win-2.rs //@ only-windows-msvc +//@ needs-sanitizer-support +//@ needs-sanitizer-address extern crate othercrate;  | 
