Add test for #56607
This commit is contained in:
parent
cdddcd3bea
commit
3d86b8acda
5
tests/ui/sized/unsized-binding.rs
Normal file
5
tests/ui/sized/unsized-binding.rs
Normal file
@ -0,0 +1,5 @@
|
||||
fn main() {
|
||||
let x = *""; //~ ERROR E0277
|
||||
println!("{}", x); //~ ERROR E0277
|
||||
println!("{}", x); //~ ERROR E0277
|
||||
}
|
39
tests/ui/sized/unsized-binding.stderr
Normal file
39
tests/ui/sized/unsized-binding.stderr
Normal file
@ -0,0 +1,39 @@
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
--> $DIR/unsized-binding.rs:2:9
|
||||
|
|
||||
LL | let x = *"";
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `str`
|
||||
= note: all local variables must have a statically known size
|
||||
= help: unsized locals are gated as an unstable feature
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
--> $DIR/unsized-binding.rs:3:20
|
||||
|
|
||||
LL | println!("{}", x);
|
||||
| -- ^ doesn't have a size known at compile-time
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `str`
|
||||
note: required by a bound in `core::fmt::rt::Argument::<'a>::new_display`
|
||||
--> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
||||
--> $DIR/unsized-binding.rs:4:20
|
||||
|
|
||||
LL | println!("{}", x);
|
||||
| -- ^ doesn't have a size known at compile-time
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `str`
|
||||
note: required by a bound in `core::fmt::rt::Argument::<'a>::new_display`
|
||||
--> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
Loading…
Reference in New Issue
Block a user