From 53d2ebb0adbe677a811ae130523ebceb285a8029 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Tue, 3 Jul 2018 19:38:14 +0200 Subject: Implement existential types --- src/test/ui/str-array-assignment.stderr | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/test/ui/str-array-assignment.stderr (limited to 'src/test/ui/str-array-assignment.stderr') 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 + = 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`. -- cgit 1.4.1-3-g733a5