diff --git a/tests/ui/array-slice-vec/array-break-length.rs b/tests/ui/array-slice-vec/array-break-length.rs index 60589f7c264a6..6362a5872624b 100644 --- a/tests/ui/array-slice-vec/array-break-length.rs +++ b/tests/ui/array-slice-vec/array-break-length.rs @@ -1,3 +1,4 @@ +//! regression test for issue fn main() { loop { |_: [_; break]| {} //~ ERROR: `break` outside of a loop @@ -6,4 +7,6 @@ fn main() { loop { |_: [_; continue]| {} //~ ERROR: `continue` outside of a loop } + + |_: [u8; break]| (); //~ ERROR: `break` outside of a loop or labeled block } diff --git a/tests/ui/array-slice-vec/array-break-length.stderr b/tests/ui/array-slice-vec/array-break-length.stderr index 2df7b6d7f63c6..93c4379e1655c 100644 --- a/tests/ui/array-slice-vec/array-break-length.stderr +++ b/tests/ui/array-slice-vec/array-break-length.stderr @@ -1,15 +1,21 @@ error[E0268]: `break` outside of a loop or labeled block - --> $DIR/array-break-length.rs:3:17 + --> $DIR/array-break-length.rs:4:17 | LL | |_: [_; break]| {} | ^^^^^ cannot `break` outside of a loop or labeled block error[E0268]: `continue` outside of a loop - --> $DIR/array-break-length.rs:7:17 + --> $DIR/array-break-length.rs:8:17 | LL | |_: [_; continue]| {} | ^^^^^^^^ cannot `continue` outside of a loop -error: aborting due to 2 previous errors +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/array-break-length.rs:11:14 + | +LL | |_: [u8; break]| (); + | ^^^^^ cannot `break` outside of a loop or labeled block + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0268`. diff --git a/tests/ui/issues/issue-36400.rs b/tests/ui/borrowck/borrow-immutable-deref-box.rs similarity index 65% rename from tests/ui/issues/issue-36400.rs rename to tests/ui/borrowck/borrow-immutable-deref-box.rs index a405f9b113525..6d4932b5b4b5d 100644 --- a/tests/ui/issues/issue-36400.rs +++ b/tests/ui/borrowck/borrow-immutable-deref-box.rs @@ -1,3 +1,4 @@ +//! regression test for issue fn f(x: &mut u32) {} fn main() { diff --git a/tests/ui/issues/issue-36400.stderr b/tests/ui/borrowck/borrow-immutable-deref-box.stderr similarity index 88% rename from tests/ui/issues/issue-36400.stderr rename to tests/ui/borrowck/borrow-immutable-deref-box.stderr index 522fb36e14343..6456dc8a0e5a6 100644 --- a/tests/ui/issues/issue-36400.stderr +++ b/tests/ui/borrowck/borrow-immutable-deref-box.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable - --> $DIR/issue-36400.rs:5:7 + --> $DIR/borrow-immutable-deref-box.rs:6:7 | LL | f(&mut *x); | ^^^^^^^ cannot borrow as mutable diff --git a/tests/ui/box/box-lifetime-argument-not-allowed.rs b/tests/ui/box/box-lifetime-argument-not-allowed.rs new file mode 100644 index 0000000000000..647fe0917d0a3 --- /dev/null +++ b/tests/ui/box/box-lifetime-argument-not-allowed.rs @@ -0,0 +1,9 @@ +//! Test that `Box` cannot be used with a lifetime argument. +//! regression test for issue + +struct Foo<'a> { + x: Box<'a, isize>, + //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied +} + +fn main() {} diff --git a/tests/ui/issues/issue-18423.stderr b/tests/ui/box/box-lifetime-argument-not-allowed.stderr similarity index 79% rename from tests/ui/issues/issue-18423.stderr rename to tests/ui/box/box-lifetime-argument-not-allowed.stderr index b5f19b5c9b23c..a597a03023af3 100644 --- a/tests/ui/issues/issue-18423.stderr +++ b/tests/ui/box/box-lifetime-argument-not-allowed.stderr @@ -1,7 +1,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied - --> $DIR/issue-18423.rs:4:8 + --> $DIR/box-lifetime-argument-not-allowed.rs:5:8 | -LL | x: Box<'a, isize> +LL | x: Box<'a, isize>, | ^^^ -- help: remove the lifetime argument | | | expected 0 lifetime arguments diff --git a/tests/ui/cast/cast-to-dyn-any.rs b/tests/ui/cast/cast-to-dyn-any.rs new file mode 100644 index 0000000000000..3180c530209e8 --- /dev/null +++ b/tests/ui/cast/cast-to-dyn-any.rs @@ -0,0 +1,4 @@ +//! regression test for issue +fn main() { + 0 as &dyn std::any::Any; //~ ERROR non-primitive cast +} diff --git a/tests/ui/issues/issue-22289.stderr b/tests/ui/cast/cast-to-dyn-any.stderr similarity index 91% rename from tests/ui/issues/issue-22289.stderr rename to tests/ui/cast/cast-to-dyn-any.stderr index 560fbc73bbdc8..6ee1098fcf406 100644 --- a/tests/ui/issues/issue-22289.stderr +++ b/tests/ui/cast/cast-to-dyn-any.stderr @@ -1,5 +1,5 @@ error[E0605]: non-primitive cast: `i32` as `&(dyn Any + 'static)` - --> $DIR/issue-22289.rs:2:5 + --> $DIR/cast-to-dyn-any.rs:3:5 | LL | 0 as &dyn std::any::Any; | ^^^^^^^^^^^^^^^^^^^^^^^ invalid cast diff --git a/tests/ui/closures/closure-move-use-after-move-diagnostic.rs b/tests/ui/closures/closure-move-use-after-move-diagnostic.rs new file mode 100644 index 0000000000000..3326af7486c5e --- /dev/null +++ b/tests/ui/closures/closure-move-use-after-move-diagnostic.rs @@ -0,0 +1,16 @@ +//! regression test for +struct NoCopy; //~ NOTE if `NoCopy` implemented `Clone`, you could clone the value +//~^ NOTE consider implementing `Clone` for this type +fn main() { + let x = NoCopy; + //~^ NOTE move occurs because `x` has type `NoCopy` + let f = move || { + //~^ NOTE value moved into closure here + let y = x; + //~^ NOTE variable moved due to use in closure + //~| NOTE you could clone this value + }; + let z = x; + //~^ ERROR use of moved value: `x` + //~| NOTE value used here after move +} diff --git a/tests/ui/closures/closure-move-use-after-move-diagnostic.stderr b/tests/ui/closures/closure-move-use-after-move-diagnostic.stderr new file mode 100644 index 0000000000000..94f80da1b10a4 --- /dev/null +++ b/tests/ui/closures/closure-move-use-after-move-diagnostic.stderr @@ -0,0 +1,27 @@ +error[E0382]: use of moved value: `x` + --> $DIR/closure-move-use-after-move-diagnostic.rs:13:13 + | +LL | let x = NoCopy; + | - move occurs because `x` has type `NoCopy`, which does not implement the `Copy` trait +LL | +LL | let f = move || { + | ------- value moved into closure here +LL | +LL | let y = x; + | - variable moved due to use in closure +... +LL | let z = x; + | ^ value used here after move + | +note: if `NoCopy` implemented `Clone`, you could clone the value + --> $DIR/closure-move-use-after-move-diagnostic.rs:2:1 + | +LL | struct NoCopy; + | ^^^^^^^^^^^^^ consider implementing `Clone` for this type +... +LL | let y = x; + | - you could clone this value + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/issues/issue-50582.rs b/tests/ui/consts/const-eval/for-in-const-eval.rs similarity index 52% rename from tests/ui/issues/issue-50582.rs rename to tests/ui/consts/const-eval/for-in-const-eval.rs index 1358e0bde4c82..f187a9ef30771 100644 --- a/tests/ui/issues/issue-50582.rs +++ b/tests/ui/consts/const-eval/for-in-const-eval.rs @@ -1,3 +1,4 @@ +//! regression test for issue fn main() { Vec::<[(); 1 + for x in 0..1 {}]>::new(); //~^ ERROR cannot add diff --git a/tests/ui/issues/issue-50582.stderr b/tests/ui/consts/const-eval/for-in-const-eval.stderr similarity index 95% rename from tests/ui/issues/issue-50582.stderr rename to tests/ui/consts/const-eval/for-in-const-eval.stderr index 168f5894fb030..e7a2558495813 100644 --- a/tests/ui/issues/issue-50582.stderr +++ b/tests/ui/consts/const-eval/for-in-const-eval.stderr @@ -1,5 +1,5 @@ error[E0277]: cannot add `()` to `{integer}` - --> $DIR/issue-50582.rs:2:18 + --> $DIR/for-in-const-eval.rs:3:18 | LL | Vec::<[(); 1 + for x in 0..1 {}]>::new(); | ^ no implementation for `{integer} + ()` diff --git a/tests/ui/issues/issue-38458.rs b/tests/ui/consts/const-return-outside-fn.rs similarity index 55% rename from tests/ui/issues/issue-38458.rs rename to tests/ui/consts/const-return-outside-fn.rs index 665a8fdf8e26e..c2ee8642bf4b1 100644 --- a/tests/ui/issues/issue-38458.rs +++ b/tests/ui/consts/const-return-outside-fn.rs @@ -1,3 +1,4 @@ +//! regression test for issue const x: () = { return; //~ ERROR return statement outside of function body }; diff --git a/tests/ui/issues/issue-38458.stderr b/tests/ui/consts/const-return-outside-fn.stderr similarity index 82% rename from tests/ui/issues/issue-38458.stderr rename to tests/ui/consts/const-return-outside-fn.stderr index fbf88d5033973..131d577a2547e 100644 --- a/tests/ui/issues/issue-38458.stderr +++ b/tests/ui/consts/const-return-outside-fn.stderr @@ -1,5 +1,5 @@ error[E0572]: return statement outside of function body - --> $DIR/issue-38458.rs:2:5 + --> $DIR/const-return-outside-fn.rs:3:5 | LL | return; | ^^^^^^ diff --git a/tests/ui/drop/drop-conflicting-impls.rs b/tests/ui/drop/drop-conflicting-impls.rs new file mode 100644 index 0000000000000..fba3462a24b2f --- /dev/null +++ b/tests/ui/drop/drop-conflicting-impls.rs @@ -0,0 +1,13 @@ +//! regression test for issue +struct MyStruct; + +impl Drop for MyStruct { + fn drop(&mut self) {} +} + +impl Drop for MyStruct { + //~^ ERROR conflicting implementations of trait + fn drop(&mut self) {} +} + +fn main() {} diff --git a/tests/ui/issues/issue-28568.stderr b/tests/ui/drop/drop-conflicting-impls.stderr similarity index 90% rename from tests/ui/issues/issue-28568.stderr rename to tests/ui/drop/drop-conflicting-impls.stderr index c8db0403e59a2..ee310f498d373 100644 --- a/tests/ui/issues/issue-28568.stderr +++ b/tests/ui/drop/drop-conflicting-impls.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `Drop` for type `MyStruct` - --> $DIR/issue-28568.rs:7:1 + --> $DIR/drop-conflicting-impls.rs:8:1 | LL | impl Drop for MyStruct { | ---------------------- first implementation here diff --git a/tests/ui/issues/issue-23217.rs b/tests/ui/enum/enum-discriminant-missing-variant.rs similarity index 58% rename from tests/ui/issues/issue-23217.rs rename to tests/ui/enum/enum-discriminant-missing-variant.rs index 09f9ebccf2505..1bdbfb1fbcd42 100644 --- a/tests/ui/issues/issue-23217.rs +++ b/tests/ui/enum/enum-discriminant-missing-variant.rs @@ -1,3 +1,4 @@ +//! regression test for issue pub enum SomeEnum { B = SomeEnum::A, //~ ERROR no variant or associated item named `A` found } diff --git a/tests/ui/issues/issue-23217.stderr b/tests/ui/enum/enum-discriminant-missing-variant.stderr similarity index 90% rename from tests/ui/issues/issue-23217.stderr rename to tests/ui/enum/enum-discriminant-missing-variant.stderr index 830d260f99d7d..ef98a93e86f66 100644 --- a/tests/ui/issues/issue-23217.stderr +++ b/tests/ui/enum/enum-discriminant-missing-variant.stderr @@ -1,5 +1,5 @@ error[E0599]: no variant or associated item named `A` found for enum `SomeEnum` in the current scope - --> $DIR/issue-23217.rs:2:19 + --> $DIR/enum-discriminant-missing-variant.rs:3:19 | LL | pub enum SomeEnum { | ----------------- variant or associated item `A` not found for this enum diff --git a/tests/ui/issues/issue-18423.rs b/tests/ui/issues/issue-18423.rs deleted file mode 100644 index 675fd041154be..0000000000000 --- a/tests/ui/issues/issue-18423.rs +++ /dev/null @@ -1,8 +0,0 @@ -// Test that `Box` cannot be used with a lifetime argument. - -struct Foo<'a> { - x: Box<'a, isize> - //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied -} - -fn main() { } diff --git a/tests/ui/issues/issue-21554.rs b/tests/ui/issues/issue-21554.rs deleted file mode 100644 index c176b1247cea9..0000000000000 --- a/tests/ui/issues/issue-21554.rs +++ /dev/null @@ -1,6 +0,0 @@ -struct Inches(i32); - -fn main() { - Inches as f32; - //~^ ERROR casting -} diff --git a/tests/ui/issues/issue-21554.stderr b/tests/ui/issues/issue-21554.stderr deleted file mode 100644 index b1b59af6ec2b2..0000000000000 --- a/tests/ui/issues/issue-21554.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0606]: casting `fn(i32) -> Inches {Inches}` as `f32` is invalid - --> $DIR/issue-21554.rs:4:5 - | -LL | Inches as f32; - | ^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0606`. diff --git a/tests/ui/issues/issue-22289.rs b/tests/ui/issues/issue-22289.rs deleted file mode 100644 index e1b3dfe5b61bd..0000000000000 --- a/tests/ui/issues/issue-22289.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - 0 as &dyn std::any::Any; //~ ERROR non-primitive cast -} diff --git a/tests/ui/issues/issue-24357.rs b/tests/ui/issues/issue-24357.rs deleted file mode 100644 index 63c061594d87e..0000000000000 --- a/tests/ui/issues/issue-24357.rs +++ /dev/null @@ -1,13 +0,0 @@ -struct NoCopy; //~ NOTE if `NoCopy` implemented `Clone`, you could clone the value -//~^ NOTE consider implementing `Clone` for this type -fn main() { - let x = NoCopy; - //~^ NOTE move occurs because `x` has type `NoCopy` - let f = move || { let y = x; }; - //~^ NOTE value moved into closure here - //~| NOTE variable moved due to use in closure - //~| NOTE you could clone this value - let z = x; - //~^ ERROR use of moved value: `x` - //~| NOTE value used here after move -} diff --git a/tests/ui/issues/issue-24357.stderr b/tests/ui/issues/issue-24357.stderr deleted file mode 100644 index 2d85077fe4c21..0000000000000 --- a/tests/ui/issues/issue-24357.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error[E0382]: use of moved value: `x` - --> $DIR/issue-24357.rs:10:12 - | -LL | let x = NoCopy; - | - move occurs because `x` has type `NoCopy`, which does not implement the `Copy` trait -LL | -LL | let f = move || { let y = x; }; - | ------- - variable moved due to use in closure - | | - | value moved into closure here -... -LL | let z = x; - | ^ value used here after move - | -note: if `NoCopy` implemented `Clone`, you could clone the value - --> $DIR/issue-24357.rs:1:1 - | -LL | struct NoCopy; - | ^^^^^^^^^^^^^ consider implementing `Clone` for this type -... -LL | let f = move || { let y = x; }; - | - you could clone this value - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/issues/issue-28568.rs b/tests/ui/issues/issue-28568.rs deleted file mode 100644 index ce511158f0051..0000000000000 --- a/tests/ui/issues/issue-28568.rs +++ /dev/null @@ -1,12 +0,0 @@ -struct MyStruct; - -impl Drop for MyStruct { - fn drop(&mut self) { } -} - -impl Drop for MyStruct { -//~^ ERROR conflicting implementations of trait - fn drop(&mut self) { } -} - -fn main() {} diff --git a/tests/ui/issues/issue-44078.rs b/tests/ui/issues/issue-44078.rs deleted file mode 100644 index b8c0e285ffcab..0000000000000 --- a/tests/ui/issues/issue-44078.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - "😊""; //~ ERROR unterminated double quote -} diff --git a/tests/ui/issues/issue-50581.rs b/tests/ui/issues/issue-50581.rs deleted file mode 100644 index 12bb9930eca40..0000000000000 --- a/tests/ui/issues/issue-50581.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - |_: [u8; break]| (); //~ ERROR [E0268] -} diff --git a/tests/ui/issues/issue-50581.stderr b/tests/ui/issues/issue-50581.stderr deleted file mode 100644 index bac1ade3b0c8f..0000000000000 --- a/tests/ui/issues/issue-50581.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0268]: `break` outside of a loop or labeled block - --> $DIR/issue-50581.rs:2:14 - | -LL | |_: [u8; break]| (); - | ^^^^^ cannot `break` outside of a loop or labeled block - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0268`. diff --git a/tests/ui/mismatched_types/cast-rfc0401.rs b/tests/ui/mismatched_types/cast-rfc0401.rs index b2ff5b4a0c063..fb04e3f5f9a0b 100644 --- a/tests/ui/mismatched_types/cast-rfc0401.rs +++ b/tests/ui/mismatched_types/cast-rfc0401.rs @@ -1,29 +1,33 @@ -fn illegal_cast(u: *const U) -> *const V -{ +fn illegal_cast(u: *const U) -> *const V { u as *const V //~ ERROR is invalid } -fn illegal_cast_2(u: *const U) -> *const str -{ +fn illegal_cast_2(u: *const U) -> *const str { u as *const str //~ ERROR is invalid } -trait Foo { fn foo(&self) {} } +trait Foo { + fn foo(&self) {} +} impl Foo for T {} -trait Bar { fn foo(&self) {} } +trait Bar { + fn foo(&self) {} +} impl Bar for T {} enum E { - A, B + A, + B, } -fn main() -{ +struct Inches(i32); + +fn main() { let f: f32 = 1.2; let v = core::ptr::null::(); - let fat_v : *const [u8] = unsafe { &*core::ptr::null::<[u8; 1]>()}; - let fat_sv : *const [i8] = unsafe { &*core::ptr::null::<[i8; 1]>()}; + let fat_v: *const [u8] = unsafe { &*core::ptr::null::<[u8; 1]>() }; + let fat_sv: *const [i8] = unsafe { &*core::ptr::null::<[i8; 1]>() }; let foo: &dyn Foo = &f; let _ = v as &u8; //~ ERROR non-primitive cast @@ -39,6 +43,7 @@ fn main() let _ = 3_i32 as bool; //~ ERROR cannot cast let _ = E::A as bool; //~ ERROR cannot cast let _ = 0x61u32 as char; //~ ERROR can be cast as + let _ = Inches as f32; //~ ERROR is invalid let _ = false as f32; //~ ERROR is invalid let _ = E::A as f32; //~ ERROR is invalid @@ -58,7 +63,7 @@ fn main() let _ = &f as *const f64; //~ ERROR is invalid let _ = fat_sv as usize; //~ ERROR is invalid - let a : *const str = "hello"; + let a: *const str = "hello"; let _ = a as *const dyn Foo; //~ ERROR the size for values of type // check no error cascade diff --git a/tests/ui/mismatched_types/cast-rfc0401.stderr b/tests/ui/mismatched_types/cast-rfc0401.stderr index a188b7791fdc8..e00434c8bc0db 100644 --- a/tests/ui/mismatched_types/cast-rfc0401.stderr +++ b/tests/ui/mismatched_types/cast-rfc0401.stderr @@ -1,5 +1,5 @@ error[E0606]: casting `*const U` as `*const V` is invalid - --> $DIR/cast-rfc0401.rs:3:5 + --> $DIR/cast-rfc0401.rs:2:5 | LL | u as *const V | ^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | u as *const V = note: the pointers may have different metadata error[E0606]: casting `*const U` as `*const str` is invalid - --> $DIR/cast-rfc0401.rs:8:5 + --> $DIR/cast-rfc0401.rs:6:5 | LL | u as *const str | ^^^^^^^^^^^^^^^ @@ -15,13 +15,13 @@ LL | u as *const str = note: the pointers may have different metadata error[E0609]: no field `f` on type `fn() {main}` - --> $DIR/cast-rfc0401.rs:65:18 + --> $DIR/cast-rfc0401.rs:70:18 | LL | let _ = main.f as *const u32; | ^ unknown field error[E0605]: non-primitive cast: `*const u8` as `&u8` - --> $DIR/cast-rfc0401.rs:29:13 + --> $DIR/cast-rfc0401.rs:33:13 | LL | let _ = v as &u8; | ^^^^^^^^ invalid cast @@ -33,43 +33,43 @@ LL + let _ = &*v; | error[E0605]: non-primitive cast: `*const u8` as `E` - --> $DIR/cast-rfc0401.rs:30:13 + --> $DIR/cast-rfc0401.rs:34:13 | LL | let _ = v as E; | ^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object error[E0605]: non-primitive cast: `*const u8` as `fn()` - --> $DIR/cast-rfc0401.rs:31:13 + --> $DIR/cast-rfc0401.rs:35:13 | LL | let _ = v as fn(); | ^^^^^^^^^ invalid cast error[E0605]: non-primitive cast: `*const u8` as `(u32,)` - --> $DIR/cast-rfc0401.rs:32:13 + --> $DIR/cast-rfc0401.rs:36:13 | LL | let _ = v as (u32,); | ^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object error[E0605]: non-primitive cast: `Option<&*const u8>` as `*const u8` - --> $DIR/cast-rfc0401.rs:33:13 + --> $DIR/cast-rfc0401.rs:37:13 | LL | let _ = Some(&v) as *const u8; | ^^^^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object error[E0606]: casting `*const u8` as `f32` is invalid - --> $DIR/cast-rfc0401.rs:35:13 + --> $DIR/cast-rfc0401.rs:39:13 | LL | let _ = v as f32; | ^^^^^^^^ error[E0606]: casting `fn() {main}` as `f64` is invalid - --> $DIR/cast-rfc0401.rs:36:13 + --> $DIR/cast-rfc0401.rs:40:13 | LL | let _ = main as f64; | ^^^^^^^^^^^ error[E0606]: casting `&*const u8` as `usize` is invalid - --> $DIR/cast-rfc0401.rs:37:13 + --> $DIR/cast-rfc0401.rs:41:13 | LL | let _ = &v as usize; | ^^^^^^^^^^^ @@ -77,13 +77,13 @@ LL | let _ = &v as usize; = help: cast through a raw pointer first error[E0606]: casting `f32` as `*const u8` is invalid - --> $DIR/cast-rfc0401.rs:38:13 + --> $DIR/cast-rfc0401.rs:42:13 | LL | let _ = f as *const u8; | ^^^^^^^^^^^^^^ error[E0054]: cannot cast `i32` as `bool` - --> $DIR/cast-rfc0401.rs:39:13 + --> $DIR/cast-rfc0401.rs:43:13 | LL | let _ = 3_i32 as bool; | ^^^^^^^^^^^^^ @@ -95,13 +95,13 @@ LL + let _ = 3_i32 != 0; | error[E0054]: cannot cast `E` as `bool` - --> $DIR/cast-rfc0401.rs:40:13 + --> $DIR/cast-rfc0401.rs:44:13 | LL | let _ = E::A as bool; | ^^^^^^^^^^^^ unsupported cast error[E0604]: only `u8` can be cast as `char`, not `u32` - --> $DIR/cast-rfc0401.rs:41:13 + --> $DIR/cast-rfc0401.rs:45:13 | LL | let _ = 0x61u32 as char; | ^^^^^^^^^^^^^^^ invalid cast @@ -112,8 +112,14 @@ LL - let _ = 0x61u32 as char; LL + let _ = char::from_u32(0x61u32); | +error[E0606]: casting `fn(i32) -> Inches {Inches}` as `f32` is invalid + --> $DIR/cast-rfc0401.rs:46:13 + | +LL | let _ = Inches as f32; + | ^^^^^^^^^^^^^ + error[E0606]: casting `bool` as `f32` is invalid - --> $DIR/cast-rfc0401.rs:43:13 + --> $DIR/cast-rfc0401.rs:48:13 | LL | let _ = false as f32; | ^^^^^^^^^^^^ @@ -121,7 +127,7 @@ LL | let _ = false as f32; = help: cast through an integer first error[E0606]: casting `E` as `f32` is invalid - --> $DIR/cast-rfc0401.rs:44:13 + --> $DIR/cast-rfc0401.rs:49:13 | LL | let _ = E::A as f32; | ^^^^^^^^^^^ @@ -129,7 +135,7 @@ LL | let _ = E::A as f32; = help: cast through an integer first error[E0606]: casting `char` as `f32` is invalid - --> $DIR/cast-rfc0401.rs:45:13 + --> $DIR/cast-rfc0401.rs:50:13 | LL | let _ = 'a' as f32; | ^^^^^^^^^^ @@ -137,25 +143,25 @@ LL | let _ = 'a' as f32; = help: cast through an integer first error[E0606]: casting `bool` as `*const u8` is invalid - --> $DIR/cast-rfc0401.rs:47:13 + --> $DIR/cast-rfc0401.rs:52:13 | LL | let _ = false as *const u8; | ^^^^^^^^^^^^^^^^^^ error[E0606]: casting `E` as `*const u8` is invalid - --> $DIR/cast-rfc0401.rs:48:13 + --> $DIR/cast-rfc0401.rs:53:13 | LL | let _ = E::A as *const u8; | ^^^^^^^^^^^^^^^^^ error[E0606]: casting `char` as `*const u8` is invalid - --> $DIR/cast-rfc0401.rs:49:13 + --> $DIR/cast-rfc0401.rs:54:13 | LL | let _ = 'a' as *const u8; | ^^^^^^^^^^^^^^^^ error[E0606]: cannot cast `usize` to a pointer that is wide - --> $DIR/cast-rfc0401.rs:51:24 + --> $DIR/cast-rfc0401.rs:56:24 | LL | let _ = 42usize as *const [u8]; | ------- ^^^^^^^^^^^ creating a `*const [u8]` requires both an address and a length @@ -163,43 +169,43 @@ LL | let _ = 42usize as *const [u8]; | consider casting this expression to `*const ()`, then using `core::ptr::from_raw_parts` error[E0607]: cannot cast thin pointer `*const u8` to wide pointer `*const [u8]` - --> $DIR/cast-rfc0401.rs:52:13 + --> $DIR/cast-rfc0401.rs:57:13 | LL | let _ = v as *const [u8]; | ^^^^^^^^^^^^^^^^ error[E0606]: casting `&dyn Foo` as `*const str` is invalid - --> $DIR/cast-rfc0401.rs:54:13 + --> $DIR/cast-rfc0401.rs:59:13 | LL | let _ = foo as *const str; | ^^^^^^^^^^^^^^^^^ error[E0606]: casting `&dyn Foo` as `*mut str` is invalid - --> $DIR/cast-rfc0401.rs:55:13 + --> $DIR/cast-rfc0401.rs:60:13 | LL | let _ = foo as *mut str; | ^^^^^^^^^^^^^^^ error[E0606]: casting `fn() {main}` as `*mut str` is invalid - --> $DIR/cast-rfc0401.rs:56:13 + --> $DIR/cast-rfc0401.rs:61:13 | LL | let _ = main as *mut str; | ^^^^^^^^^^^^^^^^ error[E0606]: casting `&f32` as `*mut f32` is invalid - --> $DIR/cast-rfc0401.rs:57:13 + --> $DIR/cast-rfc0401.rs:62:13 | LL | let _ = &f as *mut f32; | ^^^^^^^^^^^^^^ error[E0606]: casting `&f32` as `*const f64` is invalid - --> $DIR/cast-rfc0401.rs:58:13 + --> $DIR/cast-rfc0401.rs:63:13 | LL | let _ = &f as *const f64; | ^^^^^^^^^^^^^^^^ error[E0606]: casting `*const [i8]` as `usize` is invalid - --> $DIR/cast-rfc0401.rs:59:13 + --> $DIR/cast-rfc0401.rs:64:13 | LL | let _ = fat_sv as usize; | ^^^^^^^^^^^^^^^ @@ -207,7 +213,7 @@ LL | let _ = fat_sv as usize; = help: cast through a thin pointer first error[E0606]: casting `*const dyn Foo` as `*const [u16]` is invalid - --> $DIR/cast-rfc0401.rs:68:13 + --> $DIR/cast-rfc0401.rs:73:13 | LL | let _ = cf as *const [u16]; | ^^^^^^^^^^^^^^^^^^ @@ -215,7 +221,7 @@ LL | let _ = cf as *const [u16]; = note: the pointers have different metadata error[E0606]: casting `*const dyn Foo` as `*const dyn Bar` is invalid - --> $DIR/cast-rfc0401.rs:69:13 + --> $DIR/cast-rfc0401.rs:74:13 | LL | let _ = cf as *const dyn Bar; | ^^^^^^^^^^^^^^^^^^^^ @@ -223,7 +229,7 @@ LL | let _ = cf as *const dyn Bar; = note: the trait objects may have different vtables error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/cast-rfc0401.rs:53:13 + --> $DIR/cast-rfc0401.rs:58:13 | LL | let _ = fat_v as *const dyn Foo; | ^^^^^ doesn't have a size known at compile-time @@ -232,7 +238,7 @@ LL | let _ = fat_v as *const dyn Foo; = note: required for the cast from `*const [u8]` to `*const dyn Foo` error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/cast-rfc0401.rs:62:13 + --> $DIR/cast-rfc0401.rs:67:13 | LL | let _ = a as *const dyn Foo; | ^ doesn't have a size known at compile-time @@ -241,7 +247,7 @@ LL | let _ = a as *const dyn Foo; = note: required for the cast from `*const str` to `*const dyn Foo` error[E0606]: casting `&{float}` as `f32` is invalid - --> $DIR/cast-rfc0401.rs:71:30 + --> $DIR/cast-rfc0401.rs:76:30 | LL | vec![0.0].iter().map(|s| s as f32).collect::>(); | ^^^^^^^^ @@ -251,7 +257,7 @@ help: dereference the expression LL | vec![0.0].iter().map(|s| *s as f32).collect::>(); | + -error: aborting due to 34 previous errors +error: aborting due to 35 previous errors Some errors have detailed explanations: E0054, E0277, E0604, E0605, E0606, E0607, E0609. For more information about an error, try `rustc --explain E0054`. diff --git a/tests/ui/issues/issue-47184.rs b/tests/ui/nll/borrowck-annotate-static-lifetime.rs similarity index 63% rename from tests/ui/issues/issue-47184.rs rename to tests/ui/nll/borrowck-annotate-static-lifetime.rs index 2f78ce0002ba3..9d849db9b4f39 100644 --- a/tests/ui/issues/issue-47184.rs +++ b/tests/ui/nll/borrowck-annotate-static-lifetime.rs @@ -1,3 +1,4 @@ +//! regression test for issue fn main() { let _vec: Vec<&'static String> = vec![&String::new()]; //~^ ERROR temporary value dropped while borrowed [E0716] diff --git a/tests/ui/issues/issue-47184.stderr b/tests/ui/nll/borrowck-annotate-static-lifetime.stderr similarity index 91% rename from tests/ui/issues/issue-47184.stderr rename to tests/ui/nll/borrowck-annotate-static-lifetime.stderr index d25c6eda9c349..9cb9007d91314 100644 --- a/tests/ui/issues/issue-47184.stderr +++ b/tests/ui/nll/borrowck-annotate-static-lifetime.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/issue-47184.rs:2:44 + --> $DIR/borrowck-annotate-static-lifetime.rs:3:44 | LL | let _vec: Vec<&'static String> = vec![&String::new()]; | -------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement diff --git a/tests/ui/issues/issue-46983.rs b/tests/ui/nll/nll-anon-to-static.rs similarity index 57% rename from tests/ui/issues/issue-46983.rs rename to tests/ui/nll/nll-anon-to-static.rs index 4bd49a8796b34..3dc79950056cf 100644 --- a/tests/ui/issues/issue-46983.rs +++ b/tests/ui/nll/nll-anon-to-static.rs @@ -1,3 +1,4 @@ +//! regression test for issue fn foo(x: &u32) -> &'static u32 { &*x //~^ ERROR lifetime may not live long enough diff --git a/tests/ui/issues/issue-46983.stderr b/tests/ui/nll/nll-anon-to-static.stderr similarity index 88% rename from tests/ui/issues/issue-46983.stderr rename to tests/ui/nll/nll-anon-to-static.stderr index f47df306ab845..e431dfd992e15 100644 --- a/tests/ui/issues/issue-46983.stderr +++ b/tests/ui/nll/nll-anon-to-static.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/issue-46983.rs:2:5 + --> $DIR/nll-anon-to-static.rs:3:5 | LL | fn foo(x: &u32) -> &'static u32 { | - let's call the lifetime of this reference `'1` diff --git a/tests/ui/issues/issue-45965.rs b/tests/ui/parser/missing-operator-after-float.rs similarity index 62% rename from tests/ui/issues/issue-45965.rs rename to tests/ui/parser/missing-operator-after-float.rs index 15649f777e090..8868689ff81f3 100644 --- a/tests/ui/issues/issue-45965.rs +++ b/tests/ui/parser/missing-operator-after-float.rs @@ -1,3 +1,4 @@ +//! regression test for issue fn main() { let a = |r: f64| if r != 0.0(r != 0.0) { 1.0 } else { 0.0 }; //~^ ERROR expected function, found `{float}` diff --git a/tests/ui/issues/issue-45965.stderr b/tests/ui/parser/missing-operator-after-float.stderr similarity index 88% rename from tests/ui/issues/issue-45965.stderr rename to tests/ui/parser/missing-operator-after-float.stderr index 95a39b1d1980e..08878cf098a7c 100644 --- a/tests/ui/issues/issue-45965.stderr +++ b/tests/ui/parser/missing-operator-after-float.stderr @@ -1,5 +1,5 @@ error[E0618]: expected function, found `{float}` - --> $DIR/issue-45965.rs:2:30 + --> $DIR/missing-operator-after-float.rs:3:30 | LL | let a = |r: f64| if r != 0.0(r != 0.0) { 1.0 } else { 0.0 }; | ^^^---------- diff --git a/tests/ui/parser/unbalanced-doublequote-2.rs b/tests/ui/parser/unbalanced-doublequote-2.rs new file mode 100644 index 0000000000000..1906f96f6c9b9 --- /dev/null +++ b/tests/ui/parser/unbalanced-doublequote-2.rs @@ -0,0 +1,4 @@ +//! regression test for issue +fn main() { + "😊""; //~ ERROR unterminated double quote +} diff --git a/tests/ui/issues/issue-44078.stderr b/tests/ui/parser/unbalanced-doublequote-2.stderr similarity index 83% rename from tests/ui/issues/issue-44078.stderr rename to tests/ui/parser/unbalanced-doublequote-2.stderr index 3e12de34e11ee..3a6efaf7d4ec4 100644 --- a/tests/ui/issues/issue-44078.stderr +++ b/tests/ui/parser/unbalanced-doublequote-2.stderr @@ -1,5 +1,5 @@ error[E0765]: unterminated double quote string - --> $DIR/issue-44078.rs:2:8 + --> $DIR/unbalanced-doublequote-2.rs:3:8 | LL | "😊""; | _________^ diff --git a/tests/ui/issues/issue-23173.rs b/tests/ui/resolve/missing-associated-items.rs similarity index 63% rename from tests/ui/issues/issue-23173.rs rename to tests/ui/resolve/missing-associated-items.rs index 92f4c546440ab..72d6cbb3f1497 100644 --- a/tests/ui/issues/issue-23173.rs +++ b/tests/ui/resolve/missing-associated-items.rs @@ -1,9 +1,17 @@ -enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ } +//! regression test for issue +enum Token { + LeftParen, + RightParen, + Plus, + Minus, /* etc */ +} struct Struct { a: usize, } -fn use_token(token: &Token) { unimplemented!() } +fn use_token(token: &Token) { + unimplemented!() +} fn main() { use_token(&Token::Homura); //~ ERROR no variant or associated item named `Homura` diff --git a/tests/ui/issues/issue-23173.stderr b/tests/ui/resolve/missing-associated-items.stderr similarity index 87% rename from tests/ui/issues/issue-23173.stderr rename to tests/ui/resolve/missing-associated-items.stderr index d07d1a7caaf24..d27a3a644aee5 100644 --- a/tests/ui/issues/issue-23173.stderr +++ b/tests/ui/resolve/missing-associated-items.stderr @@ -1,14 +1,14 @@ error[E0599]: no variant or associated item named `Homura` found for enum `Token` in the current scope - --> $DIR/issue-23173.rs:9:23 + --> $DIR/missing-associated-items.rs:17:23 | -LL | enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ } +LL | enum Token { | ---------- variant or associated item `Homura` not found for this enum ... LL | use_token(&Token::Homura); | ^^^^^^ variant or associated item not found in `Token` error[E0599]: no function or associated item named `method` found for struct `Struct` in the current scope - --> $DIR/issue-23173.rs:10:13 + --> $DIR/missing-associated-items.rs:18:13 | LL | struct Struct { | ------------- function or associated item `method` not found for this struct @@ -17,7 +17,7 @@ LL | Struct::method(); | ^^^^^^ function or associated item not found in `Struct` error[E0599]: no function or associated item named `method` found for struct `Struct` in the current scope - --> $DIR/issue-23173.rs:11:13 + --> $DIR/missing-associated-items.rs:19:13 | LL | struct Struct { | ------------- function or associated item `method` not found for this struct @@ -26,7 +26,7 @@ LL | Struct::method; | ^^^^^^ function or associated item not found in `Struct` error[E0599]: no associated item named `Assoc` found for struct `Struct` in the current scope - --> $DIR/issue-23173.rs:12:13 + --> $DIR/missing-associated-items.rs:20:13 | LL | struct Struct { | ------------- associated item `Assoc` not found for this struct