summaryrefslogtreecommitdiffstats
path: root/tests/ui/indexing
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/indexing/index-bot.stderr2
-rw-r--r--tests/ui/indexing/index-help.stderr2
-rw-r--r--tests/ui/indexing/index_message.stderr2
-rw-r--r--tests/ui/indexing/indexing-requires-a-uint.stderr2
-rw-r--r--tests/ui/indexing/point-at-index-for-obligation-failure.rs7
-rw-r--r--tests/ui/indexing/point-at-index-for-obligation-failure.stderr13
6 files changed, 25 insertions, 3 deletions
diff --git a/tests/ui/indexing/index-bot.stderr b/tests/ui/indexing/index-bot.stderr
index bf231c92c..dca57f3d5 100644
--- a/tests/ui/indexing/index-bot.stderr
+++ b/tests/ui/indexing/index-bot.stderr
@@ -4,6 +4,6 @@ error[E0608]: cannot index into a value of type `!`
LL | (return)[0];
| ^^^
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0608`.
diff --git a/tests/ui/indexing/index-help.stderr b/tests/ui/indexing/index-help.stderr
index 2cb212a01..4ec28ddf8 100644
--- a/tests/ui/indexing/index-help.stderr
+++ b/tests/ui/indexing/index-help.stderr
@@ -9,6 +9,6 @@ LL | x[0i32];
= help: for that trait implementation, expected `usize`, found `i32`
= note: required for `Vec<{integer}>` to implement `Index<i32>`
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/indexing/index_message.stderr b/tests/ui/indexing/index_message.stderr
index 80f2bd523..6affb1ed9 100644
--- a/tests/ui/indexing/index_message.stderr
+++ b/tests/ui/indexing/index_message.stderr
@@ -4,6 +4,6 @@ error[E0608]: cannot index into a value of type `({integer},)`
LL | let _ = z[0];
| ^^^ help: to access tuple elements, use: `.0`
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0608`.
diff --git a/tests/ui/indexing/indexing-requires-a-uint.stderr b/tests/ui/indexing/indexing-requires-a-uint.stderr
index 6ea6bb600..3041c2c99 100644
--- a/tests/ui/indexing/indexing-requires-a-uint.stderr
+++ b/tests/ui/indexing/indexing-requires-a-uint.stderr
@@ -8,6 +8,8 @@ LL | [0][0u8];
= help: the trait `SliceIndex<[{integer}]>` is implemented for `usize`
= help: for that trait implementation, expected `usize`, found `u8`
= note: required for `[{integer}]` to implement `Index<u8>`
+ = note: 1 redundant requirement hidden
+ = note: required for `[{integer}; 1]` to implement `Index<u8>`
error[E0308]: mismatched types
--> $DIR/indexing-requires-a-uint.rs:12:18
diff --git a/tests/ui/indexing/point-at-index-for-obligation-failure.rs b/tests/ui/indexing/point-at-index-for-obligation-failure.rs
new file mode 100644
index 000000000..e9c429b53
--- /dev/null
+++ b/tests/ui/indexing/point-at-index-for-obligation-failure.rs
@@ -0,0 +1,7 @@
+fn main() {
+ let a = std::collections::HashMap::<String,String>::new();
+ let s = "hello";
+ let _b = a[
+ &s //~ ERROR E0277
+ ];
+}
diff --git a/tests/ui/indexing/point-at-index-for-obligation-failure.stderr b/tests/ui/indexing/point-at-index-for-obligation-failure.stderr
new file mode 100644
index 000000000..4cced2278
--- /dev/null
+++ b/tests/ui/indexing/point-at-index-for-obligation-failure.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the trait bound `String: Borrow<&str>` is not satisfied
+ --> $DIR/point-at-index-for-obligation-failure.rs:5:9
+ |
+LL | &s
+ | ^^ the trait `Borrow<&str>` is not implemented for `String`
+ |
+ = help: the trait `Borrow<str>` is implemented for `String`
+ = help: for that trait implementation, expected `str`, found `&str`
+ = note: required for `HashMap<String, String>` to implement `Index<&&str>`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.