Cleaned up some tests

add comment to closure-move-use-after-move-diagnostic.rs

add comment to missing-operator-after-float.rs

add comment to closure-array-break-length.rs

add comment to box-lifetime-argument-not-allowed.rs

add comment to const-return-outside-fn.rs

add comment to drop-conflicting-impls.rs

add comment to unbalanced-doublequote-2.rs

add comment to borrow-immutable-deref-box.rs

add comment to for-in-const-eval.rs

add comment to borrowck-annotated-static-lifetime.rs

cleaned up cast-rfc0401.rs

add comment to nll-anon-to-static.rs

add comment to cast-to-dyn-any.rs

add comment to missing-associated-items.rs

add comment to enum-discriminant-missing-variant.rs
This commit is contained in:
reddevilmidzy 2025-12-21 09:13:49 +09:00
parent 7ca2eb9c6f
commit 4578082361
38 changed files with 160 additions and 171 deletions

View file

@ -1,3 +0,0 @@
fn main() {
|_: [u8; break]| (); //~ ERROR [E0268]
}

View file

@ -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`.

View file

@ -1,3 +1,4 @@
//! regression test for issue <https://github.com/rust-lang/rust/issues/36400>
fn f(x: &mut u32) {}
fn main() {

View file

@ -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

View file

@ -1,8 +1,9 @@
// Test that `Box` cannot be used with a lifetime argument.
//! Test that `Box` cannot be used with a lifetime argument.
//! regression test for issue <https://github.com/rust-lang/rust/issues/18423>
struct Foo<'a> {
x: Box<'a, isize>
x: Box<'a, isize>,
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied
}
fn main() { }
fn main() {}

View file

@ -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

View file

@ -1,8 +0,0 @@
// RFC 401 test extracted into distinct file. This is because some the
// change to suppress "derived" errors wound up suppressing this error
// message, since the fallback for `3` doesn't occur.
fn main() {
let _ = 3 as bool;
//~^ ERROR cannot cast `i32` as `bool`
}

View file

@ -1,15 +0,0 @@
error[E0054]: cannot cast `i32` as `bool`
--> $DIR/cast-rfc0401-2.rs:6:13
|
LL | let _ = 3 as bool;
| ^^^^^^^^^
|
help: compare with zero instead
|
LL - let _ = 3 as bool;
LL + let _ = 3 != 0;
|
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0054`.

View file

@ -1,29 +1,33 @@
fn illegal_cast<U:?Sized,V:?Sized>(u: *const U) -> *const V
{
fn illegal_cast<U: ?Sized, V: ?Sized>(u: *const U) -> *const V {
u as *const V //~ ERROR is invalid
}
fn illegal_cast_2<U:?Sized>(u: *const U) -> *const str
{
fn illegal_cast_2<U: ?Sized>(u: *const U) -> *const str {
u as *const str //~ ERROR is invalid
}
trait Foo { fn foo(&self) {} }
trait Foo {
fn foo(&self) {}
}
impl<T> Foo for T {}
trait Bar { fn foo(&self) {} }
trait Bar {
fn foo(&self) {}
}
impl<T> 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::<u8>();
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

View file

@ -1,5 +1,5 @@
error[E0606]: casting `*const U` as `*const V` is invalid
--> $DIR/cast-rfc0401.rs:3:5
--> $DIR/cast-rfc0401-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.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-fail.rs:76:30
|
LL | vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>();
| ^^^^^^^^
@ -251,7 +257,7 @@ help: dereference the expression
LL | vec![0.0].iter().map(|s| *s as f32).collect::<Vec<f32>>();
| +
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`.

View file

@ -1,3 +1,4 @@
//! regression test for issue <https://github.com/rust-lang/rust/issues/22289>
fn main() {
0 as &dyn std::any::Any; //~ ERROR non-primitive cast
}

View file

@ -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

View file

@ -1,9 +0,0 @@
fn main() {
loop {
|_: [_; break]| {} //~ ERROR: `break` outside of a loop
}
loop {
|_: [_; continue]| {} //~ ERROR: `continue` outside of a loop
}
}

View file

@ -1,15 +0,0 @@
error[E0268]: `break` outside of a loop or labeled block
--> $DIR/array-break-length.rs:3: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
|
LL | |_: [_; continue]| {}
| ^^^^^^^^ cannot `continue` outside of a loop
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0268`.

View file

@ -1,7 +1,18 @@
//! regression test for issue <https://github.com/rust-lang/rust/issues/50581>
fn main() {
|_: [_; continue]| {}; //~ ERROR: `continue` outside of a loop
|_: [_; break]| (); //~ ERROR: `break` outside of a loop or labeled block
while |_: [_; continue]| {} {} //~ ERROR: `continue` outside of a loop
while |_: [_; break]| {} {} //~ ERROR: `break` outside of a loop
loop {
|_: [_; break]| {} //~ ERROR: `break` outside of a loop
}
loop {
|_: [_; continue]| {} //~ ERROR: `continue` outside of a loop
}
}

View file

@ -1,21 +1,39 @@
error[E0268]: `continue` outside of a loop
--> $DIR/closure-array-break-length.rs:2:13
--> $DIR/closure-array-break-length.rs:3:13
|
LL | |_: [_; continue]| {};
| ^^^^^^^^ cannot `continue` outside of a loop
error[E0268]: `break` outside of a loop or labeled block
--> $DIR/closure-array-break-length.rs:5:13
|
LL | |_: [_; break]| ();
| ^^^^^ cannot `break` outside of a loop or labeled block
error[E0268]: `continue` outside of a loop
--> $DIR/closure-array-break-length.rs:4:19
--> $DIR/closure-array-break-length.rs:7:19
|
LL | while |_: [_; continue]| {} {}
| ^^^^^^^^ cannot `continue` outside of a loop
error[E0268]: `break` outside of a loop or labeled block
--> $DIR/closure-array-break-length.rs:6:19
--> $DIR/closure-array-break-length.rs:9:19
|
LL | while |_: [_; break]| {} {}
| ^^^^^ cannot `break` outside of a loop or labeled block
error: aborting due to 3 previous errors
error[E0268]: `break` outside of a loop or labeled block
--> $DIR/closure-array-break-length.rs:12:17
|
LL | |_: [_; break]| {}
| ^^^^^ cannot `break` outside of a loop or labeled block
error[E0268]: `continue` outside of a loop
--> $DIR/closure-array-break-length.rs:16:17
|
LL | |_: [_; continue]| {}
| ^^^^^^^^ cannot `continue` outside of a loop
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0268`.

View file

@ -1,13 +1,16 @@
//! regression test for <https://github.com/rust-lang/rust/issues/24357>
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
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
}

View file

@ -1,25 +1,26 @@
error[E0382]: use of moved value: `x`
--> $DIR/issue-24357.rs:10:12
--> $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 | 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 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
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
--> $DIR/closure-move-use-after-move-diagnostic.rs:2:1
|
LL | struct NoCopy;
| ^^^^^^^^^^^^^ consider implementing `Clone` for this type
...
LL | let f = move || { let y = x; };
| - you could clone this value
LL | let y = x;
| - you could clone this value
error: aborting due to 1 previous error

View file

@ -1,3 +1,4 @@
//! regression test for issue <https://github.com/rust-lang/rust/issues/38458>
const x: () = {
return; //~ ERROR return statement outside of function body
};

View file

@ -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;
| ^^^^^^

View file

@ -1,12 +1,13 @@
//! regression test for issue <https://github.com/rust-lang/rust/issues/28568>
struct MyStruct;
impl Drop for MyStruct {
fn drop(&mut self) { }
fn drop(&mut self) {}
}
impl Drop for MyStruct {
//~^ ERROR conflicting implementations of trait
fn drop(&mut self) { }
//~^ ERROR conflicting implementations of trait
fn drop(&mut self) {}
}
fn main() {}

View file

@ -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

View file

@ -1,3 +1,4 @@
//! regression test for issue <https://github.com/rust-lang/rust/issues/23217>
pub enum SomeEnum {
B = SomeEnum::A, //~ ERROR no variant or associated item named `A` found
}

View file

@ -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

View file

@ -1,6 +0,0 @@
struct Inches(i32);
fn main() {
Inches as f32;
//~^ ERROR casting
}

View file

@ -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`.

View file

@ -1,3 +1,4 @@
//! regression test for issue <https://github.com/rust-lang/rust/issues/47184>
fn main() {
let _vec: Vec<&'static String> = vec![&String::new()];
//~^ ERROR temporary value dropped while borrowed [E0716]

View file

@ -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

View file

@ -1,3 +1,4 @@
//! regression test for issue <https://github.com/rust-lang/rust/issues/46983>
fn foo(x: &u32) -> &'static u32 {
&*x
//~^ ERROR lifetime may not live long enough

View file

@ -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`

View file

@ -1,3 +1,4 @@
//! regression test for issue <https://github.com/rust-lang/rust/issues/45965>
fn main() {
let a = |r: f64| if r != 0.0(r != 0.0) { 1.0 } else { 0.0 };
//~^ ERROR expected function, found `{float}`

View file

@ -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 };
| ^^^----------

View file

@ -1,3 +1,4 @@
//! regression test for issue <https://github.com/rust-lang/rust/issues/44078>
fn main() {
"😊""; //~ ERROR unterminated double quote
}

View file

@ -1,5 +1,5 @@
error[E0765]: unterminated double quote string
--> $DIR/issue-44078.rs:2:8
--> $DIR/unbalanced-doublequote-2.rs:3:8
|
LL | "😊"";
| _________^

View file

@ -1,9 +1,17 @@
enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ }
//! regression test for issue <https://github.com/rust-lang/rust/issues/23173>
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`

View file

@ -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

View file

@ -1,3 +1,4 @@
//! regression test for issue <https://github.com/rust-lang/rust/issues/50582>
fn main() {
Vec::<[(); 1 + for x in 0..1 {}]>::new();
//~^ ERROR cannot add

View file

@ -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} + ()`