about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-10-18 21:42:21 +0000
committerbors <bors@rust-lang.org>2018-10-18 21:42:21 +0000
commit45088b11f55e57a65fa1ebcf6e3b6014152eb516 (patch)
treee3b30d5b617dbbe7166549db8d8ba962d6a8b32c /src/test
parente7f5d48059aa14cc2808473564deadd72d1e818d (diff)
parented10a3faae1fd1176b2edf4a61438e0542c103b9 (diff)
Auto merge of #54979 - estebank:path-unsized, r=nikomatsakis
Custom E0277 diagnostic for `Path`

r? @nikomatsakis we have a way to target `Path` exclusively, we need to identify the correct text to show to consider #23286 fixed.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/error-codes/E0277.stderr2
-rw-r--r--src/test/ui/suggestions/path-by-value.rs6
-rw-r--r--src/test/ui/suggestions/path-by-value.stderr15
3 files changed, 22 insertions, 1 deletions
diff --git a/src/test/ui/error-codes/E0277.stderr b/src/test/ui/error-codes/E0277.stderr
index ab9020222ea..d0c089fa0f3 100644
--- a/src/test/ui/error-codes/E0277.stderr
+++ b/src/test/ui/error-codes/E0277.stderr
@@ -2,7 +2,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
   --> $DIR/E0277.rs:23:6
    |
 LL | fn f(p: Path) { }
-   |      ^ doesn't have a size known at compile-time
+   |      ^ borrow the `Path` instead
    |
    = help: within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]`
    = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
diff --git a/src/test/ui/suggestions/path-by-value.rs b/src/test/ui/suggestions/path-by-value.rs
new file mode 100644
index 00000000000..c875ca674ae
--- /dev/null
+++ b/src/test/ui/suggestions/path-by-value.rs
@@ -0,0 +1,6 @@
+use std::path::Path;
+
+fn f(p: Path) { }
+//~^ ERROR E0277
+
+fn main() {}
diff --git a/src/test/ui/suggestions/path-by-value.stderr b/src/test/ui/suggestions/path-by-value.stderr
new file mode 100644
index 00000000000..338cfc990dc
--- /dev/null
+++ b/src/test/ui/suggestions/path-by-value.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+  --> $DIR/path-by-value.rs:3:6
+   |
+LL | fn f(p: Path) { }
+   |      ^ borrow the `Path` instead
+   |
+   = help: within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]`
+   = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+   = note: required because it appears within the type `std::path::Path`
+   = note: all local variables must have a statically known size
+   = help: unsized locals are gated as an unstable feature
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.