about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2016-12-03 17:41:14 -0800
committerEsteban Küber <esteban@kuber.com.ar>2016-12-08 10:25:42 -0800
commitef09db0ff301b98f6980f4bd3dad6fb060d18daa (patch)
treebbd68503fe3c97948fcfe670c05587b6c7d96931 /src/test/compile-fail
parent070fad1701fb36b112853b0a6a9787a7bb7ff34c (diff)
downloadrust-ef09db0ff301b98f6980f4bd3dad6fb060d18daa.tar.gz
rust-ef09db0ff301b98f6980f4bd3dad6fb060d18daa.zip
Point out the known type when field doesn't satisfy bound
For file

```rust
use std::path::Path;

fn f(p: Path) { }
```

provide the following error

```nocode
error[E0277]: the trait bound `[u8]: std::marker::Sized` is not satisfied in `std::path::Path`
 --> file.rs:3:6
  |
3 | fn f(p: Path) { }
  |      ^ within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]`
  |
  = note: `[u8]` does not have a constant size known at compile-time
  = note: required because it appears within the type `std::path::Path`
  = note: all local variables must have a statically known size
```
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/E0277.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/compile-fail/E0277.rs b/src/test/compile-fail/E0277.rs
index e4cb50cd3f2..e31fea1e458 100644
--- a/src/test/compile-fail/E0277.rs
+++ b/src/test/compile-fail/E0277.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::path::Path;
+
 trait Foo {
     fn bar(&self);
 }
@@ -16,6 +18,13 @@ fn some_func<T: Foo>(foo: T) {
     foo.bar();
 }
 
+fn f(p: Path) { }
+//~^ ERROR the trait bound `[u8]: std::marker::Sized` is not satisfied in `std::path::Path`
+//~| NOTE within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]`
+//~| NOTE `[u8]` does not have a constant size known at compile-time
+//~| NOTE required because it appears within the type `std::path::Path`
+//~| NOTE all local variables must have a statically known size
+
 fn main() {
     some_func(5i32);
     //~^ ERROR the trait bound `i32: Foo` is not satisfied