Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/ui/typeck/return-unsized-coercion.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Regression test for issue <https://github.com/rust-lang/rust/issues/134355>

fn digit() -> str {
//~^ ERROR the size for values of type `str` cannot be known at compilation time
return { i32::MIN };
}

fn main() {}
12 changes: 12 additions & 0 deletions tests/ui/typeck/return-unsized-coercion.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/return-unsized-coercion.rs:3:15
|
LL | fn digit() -> str {
| ^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
= note: the return type of a function must have a statically known size

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0277`.
Loading