diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2021-04-19 22:00:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-19 22:00:10 +0200 |
| commit | 349fae3a32cfcb650f252104bb5c88ee32d9bebf (patch) | |
| tree | cf8f2f18e679b72ece157fe7a559ef9f7933763b /src/test/ui/issues | |
| parent | 761243572e8ed83368f9bdcc7e0198ef1bea3a66 (diff) | |
| parent | a8193ca4c3204d6d8aafadab80ff5c6b284aa76e (diff) | |
| download | rust-349fae3a32cfcb650f252104bb5c88ee32d9bebf.tar.gz rust-349fae3a32cfcb650f252104bb5c88ee32d9bebf.zip | |
Rollup merge of #84313 - lcnr:sized-err-msg, r=petrochenkov
fix suggestion for unsized function parameters taken from `@fasterthanlime's` article https://fasterthanli.me/articles/whats-in-the-box
Diffstat (limited to 'src/test/ui/issues')
| -rw-r--r-- | src/test/ui/issues/issue-5883.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-5883.stderr | 17 |
2 files changed, 11 insertions, 12 deletions
diff --git a/src/test/ui/issues/issue-5883.rs b/src/test/ui/issues/issue-5883.rs index 0de53502397..82866b35557 100644 --- a/src/test/ui/issues/issue-5883.rs +++ b/src/test/ui/issues/issue-5883.rs @@ -4,9 +4,9 @@ struct Struct { r: dyn A + 'static } -fn new_struct(r: dyn A + 'static) - -> Struct { //~^ ERROR the size for values of type - //~^ ERROR the size for values of type +fn new_struct( + r: dyn A + 'static //~ ERROR the size for values of type +) -> Struct { //~ ERROR the size for values of type Struct { r: r } } diff --git a/src/test/ui/issues/issue-5883.stderr b/src/test/ui/issues/issue-5883.stderr index 48879eb798f..de598a70ee0 100644 --- a/src/test/ui/issues/issue-5883.stderr +++ b/src/test/ui/issues/issue-5883.stderr @@ -1,22 +1,21 @@ error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time - --> $DIR/issue-5883.rs:7:15 + --> $DIR/issue-5883.rs:8:5 | -LL | fn new_struct(r: dyn A + 'static) - | ^ doesn't have a size known at compile-time +LL | r: dyn A + 'static + | ^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `(dyn A + 'static)` = help: unsized fn params are gated as an unstable feature help: function arguments must have a statically known size, borrowed types always have a known size | -LL | fn new_struct(&r: dyn A + 'static) - | ^ +LL | r: &dyn A + 'static + | ^ error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time - --> $DIR/issue-5883.rs:8:8 + --> $DIR/issue-5883.rs:9:6 | -LL | -> Struct { - | ^^^^^^ doesn't have a size known at compile-time -LL | +LL | ) -> Struct { + | ^^^^^^ doesn't have a size known at compile-time LL | Struct { r: r } | --------------- this returned value is of type `Struct` | |
