about summary refs log tree commit diff
path: root/tests/ui/tuple/tuple-index-out-of-bounds.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/tuple/tuple-index-out-of-bounds.rs')
-rw-r--r--tests/ui/tuple/tuple-index-out-of-bounds.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/tuple/tuple-index-out-of-bounds.rs b/tests/ui/tuple/tuple-index-out-of-bounds.rs
new file mode 100644
index 00000000000..c772c0daa18
--- /dev/null
+++ b/tests/ui/tuple/tuple-index-out-of-bounds.rs
@@ -0,0 +1,14 @@
+struct Point(i32, i32);
+
+fn main() {
+    let origin = Point(0, 0);
+    origin.0;
+    origin.1;
+    origin.2;
+    //~^ ERROR no field `2` on type `Point`
+    let tuple = (0, 0);
+    tuple.0;
+    tuple.1;
+    tuple.2;
+    //~^ ERROR no field `2` on type `({integer}, {integer})`
+}