diff options
| author | Oliver Schneider <github35764891676564198441@oli-obk.de> | 2018-07-03 19:38:14 +0200 |
|---|---|---|
| committer | Oliver Schneider <github35764891676564198441@oli-obk.de> | 2018-07-18 10:53:08 +0200 |
| commit | 53d2ebb0adbe677a811ae130523ebceb285a8029 (patch) | |
| tree | aa5bf290ab3240ee1028359cef335f22dc1a2cdb /src/test/ui/str-array-assignment.stderr | |
| parent | 1c84d8187395b641616649a0f16f15a78ea8bbce (diff) | |
| download | rust-53d2ebb0adbe677a811ae130523ebceb285a8029.tar.gz rust-53d2ebb0adbe677a811ae130523ebceb285a8029.zip | |
Implement existential types
Diffstat (limited to 'src/test/ui/str-array-assignment.stderr')
| -rw-r--r-- | src/test/ui/str-array-assignment.stderr | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/test/ui/str-array-assignment.stderr b/src/test/ui/str-array-assignment.stderr new file mode 100644 index 00000000000..7a774cab38e --- /dev/null +++ b/src/test/ui/str-array-assignment.stderr @@ -0,0 +1,49 @@ +error[E0308]: if and else have incompatible types + --> $DIR/str-array-assignment.rs:13:11 + | +LL | let t = if true { s[..2] } else { s }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found &str + | + = note: expected type `str` + found type `&str` + +error[E0308]: mismatched types + --> $DIR/str-array-assignment.rs:15:27 + | +LL | let u: &str = if true { s[..2] } else { s }; + | ^^^^^^ + | | + | expected &str, found str + | help: consider borrowing here: `&s[..2]` + | + = note: expected type `&str` + found type `str` + +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/str-array-assignment.rs:17:7 + | +LL | let v = s[..2]; + | ^ ------ help: consider borrowing here: `&s[..2]` + | | + | doesn't have a size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `str` + = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized> + = note: all local variables must have a statically known size + +error[E0308]: mismatched types + --> $DIR/str-array-assignment.rs:19:17 + | +LL | let w: &str = s[..2]; + | ^^^^^^ + | | + | expected &str, found str + | help: consider borrowing here: `&s[..2]` + | + = note: expected type `&str` + found type `str` + +error: aborting due to 4 previous errors + +Some errors occurred: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. |
