about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2018-10-10 17:30:10 -0700
committerEsteban Küber <esteban@kuber.com.ar>2018-10-10 17:30:10 -0700
commited10a3faae1fd1176b2edf4a61438e0542c103b9 (patch)
tree534e54fe4797809c901c165e2cd7009a9040b8a8 /src/test
parente1041c6cd1a027ab3ada3e8538620d2e1d7067fe (diff)
Custom E0277 diagnostic for `Path`
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`.