Skip to content

Commit ea465d0

Browse files
committed
Add test for rust-lang#56607
1 parent 54d6738 commit ea465d0

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

tests/ui/sized/unsized-binding.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn main() {
2+
let x = *""; //~ ERROR E0277
3+
println!("{}", x); //~ ERROR E0277
4+
println!("{}", x); //~ ERROR E0277
5+
}

tests/ui/sized/unsized-binding.stderr

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
error[E0277]: the size for values of type `str` cannot be known at compilation time
2+
--> $DIR/unsized-binding.rs:2:9
3+
|
4+
LL | let x = *"";
5+
| ^ doesn't have a size known at compile-time
6+
|
7+
= help: the trait `Sized` is not implemented for `str`
8+
= note: all local variables must have a statically known size
9+
= help: unsized locals are gated as an unstable feature
10+
11+
error[E0277]: the size for values of type `str` cannot be known at compilation time
12+
--> $DIR/unsized-binding.rs:3:20
13+
|
14+
LL | println!("{}", x);
15+
| -- ^ doesn't have a size known at compile-time
16+
| |
17+
| required by a bound introduced by this call
18+
|
19+
= help: the trait `Sized` is not implemented for `str`
20+
note: required by a bound in `core::fmt::rt::Argument::<'a>::new_display`
21+
--> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
22+
= 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)
23+
24+
error[E0277]: the size for values of type `str` cannot be known at compilation time
25+
--> $DIR/unsized-binding.rs:4:20
26+
|
27+
LL | println!("{}", x);
28+
| -- ^ doesn't have a size known at compile-time
29+
| |
30+
| required by a bound introduced by this call
31+
|
32+
= help: the trait `Sized` is not implemented for `str`
33+
note: required by a bound in `core::fmt::rt::Argument::<'a>::new_display`
34+
--> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
35+
= 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)
36+
37+
error: aborting due to 3 previous errors
38+
39+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)