about summary refs log tree commit diff
path: root/tests/ui/indexing/index_message.stderr
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2023-08-03 21:43:17 +0200
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2023-08-04 13:17:39 +0200
commit5706be1854db74d0aafcc4658423884689f139e9 (patch)
tree5e4a3543de6a955d72ece8459d3e3353a05cc906 /tests/ui/indexing/index_message.stderr
parentfcf3006e0133365ecd26894689c086387edcbecb (diff)
downloadrust-5706be1854db74d0aafcc4658423884689f139e9.tar.gz
rust-5706be1854db74d0aafcc4658423884689f139e9.zip
Improve spans for indexing expressions
Indexing is similar to method calls in having an arbitrary
left-hand-side and then something on the right, which is the main part
of the expression. Method calls already have a span for that right part,
but indexing does not. This means that long method chains that use
indexing have really bad spans, especially when the indexing panics and
that span in coverted into a panic location.

This does the same thing as method calls for the AST and HIR, storing an
extra span which is then put into the `fn_span` field in THIR.
Diffstat (limited to 'tests/ui/indexing/index_message.stderr')
-rw-r--r--tests/ui/indexing/index_message.stderr9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/ui/indexing/index_message.stderr b/tests/ui/indexing/index_message.stderr
new file mode 100644
index 00000000000..80f2bd52314
--- /dev/null
+++ b/tests/ui/indexing/index_message.stderr
@@ -0,0 +1,9 @@
+error[E0608]: cannot index into a value of type `({integer},)`
+  --> $DIR/index_message.rs:3:14
+   |
+LL |     let _ = z[0];
+   |              ^^^ help: to access tuple elements, use: `.0`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0608`.