about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-04-01 21:48:39 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-04-12 23:02:09 +0300
commit44acea4d880b646caa00a7237ea1a17031dd2116 (patch)
treef109f2beda49e7972c2c6e562944c1a2c810c3d2 /src/test
parent6c537493d01694cc6e0a614dff12c475055aa2b4 (diff)
downloadrust-44acea4d880b646caa00a7237ea1a17031dd2116.tar.gz
rust-44acea4d880b646caa00a7237ea1a17031dd2116.zip
AST/HIR: Merge field access expressions for named and numeric fields
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/issue-19244-1.rs2
-rw-r--r--src/test/compile-fail/struct-field-privacy.rs2
-rw-r--r--src/test/compile-fail/tuple-index-out-of-bounds.rs4
-rw-r--r--src/test/ui/error-codes/E0609.stderr4
-rw-r--r--src/test/ui/error-codes/E0611.stderr9
-rw-r--r--src/test/ui/error-codes/E0612.stderr9
-rw-r--r--src/test/ui/error-codes/ex-E0611.rs (renamed from src/test/ui/error-codes/E0611.rs)2
-rw-r--r--src/test/ui/error-codes/ex-E0611.stderr9
-rw-r--r--src/test/ui/error-codes/ex-E0612.rs (renamed from src/test/ui/error-codes/E0612.rs)2
-rw-r--r--src/test/ui/error-codes/ex-E0612.stderr9
-rw-r--r--src/test/ui/issue-47073-zero-padded-tuple-struct-indices.rs4
-rw-r--r--src/test/ui/issue-47073-zero-padded-tuple-struct-indices.stderr11
-rw-r--r--src/test/ui/macros/macro-backtrace-invalid-internals.rs4
-rw-r--r--src/test/ui/macros/macro-backtrace-invalid-internals.stderr18
14 files changed, 46 insertions, 43 deletions
diff --git a/src/test/compile-fail/issue-19244-1.rs b/src/test/compile-fail/issue-19244-1.rs
index 0fa1a154772..df34aab4b8f 100644
--- a/src/test/compile-fail/issue-19244-1.rs
+++ b/src/test/compile-fail/issue-19244-1.rs
@@ -12,5 +12,5 @@ const TUP: (usize,) = (42,);
 
 fn main() {
     let a: [isize; TUP.1];
-    //~^ ERROR attempted out-of-bounds tuple index
+    //~^ ERROR no field `1` on type `(usize,)`
 }
diff --git a/src/test/compile-fail/struct-field-privacy.rs b/src/test/compile-fail/struct-field-privacy.rs
index 5b2e04e25a9..f487ef62aa4 100644
--- a/src/test/compile-fail/struct-field-privacy.rs
+++ b/src/test/compile-fail/struct-field-privacy.rs
@@ -42,7 +42,7 @@ fn test(a: A, b: inner::A, c: inner::B, d: xc::A, e: xc::B, z: inner::Z) {
     e.b; //~ ERROR: field `b` of struct `xc::B` is private
 
     z.0;
-    z.1; //~ ERROR: field `1` of tuple-struct `inner::Z` is private
+    z.1; //~ ERROR: field `1` of struct `inner::Z` is private
 }
 
 fn main() {}
diff --git a/src/test/compile-fail/tuple-index-out-of-bounds.rs b/src/test/compile-fail/tuple-index-out-of-bounds.rs
index 4597cf3d350..35b843676b4 100644
--- a/src/test/compile-fail/tuple-index-out-of-bounds.rs
+++ b/src/test/compile-fail/tuple-index-out-of-bounds.rs
@@ -15,10 +15,10 @@ fn main() {
     origin.0;
     origin.1;
     origin.2;
-    //~^ ERROR attempted out-of-bounds tuple index `2` on type `Point`
+    //~^ ERROR no field `2` on type `Point`
     let tuple = (0, 0);
     tuple.0;
     tuple.1;
     tuple.2;
-    //~^ ERROR attempted out-of-bounds tuple index `2` on type `({integer}, {integer})`
+    //~^ ERROR no field `2` on type `({integer}, {integer})`
 }
diff --git a/src/test/ui/error-codes/E0609.stderr b/src/test/ui/error-codes/E0609.stderr
index 24581889ae9..dd793b29feb 100644
--- a/src/test/ui/error-codes/E0609.stderr
+++ b/src/test/ui/error-codes/E0609.stderr
@@ -7,10 +7,10 @@ LL |     let _ = x.foo; //~ ERROR E0609
    = note: available fields are: `x`
 
 error[E0609]: no field `1` on type `Bar`
-  --> $DIR/E0609.rs:21:5
+  --> $DIR/E0609.rs:21:7
    |
 LL |     y.1; //~ ERROR E0609
-   |     ^^^
+   |       ^ unknown field
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/error-codes/E0611.stderr b/src/test/ui/error-codes/E0611.stderr
deleted file mode 100644
index c4b86e76c14..00000000000
--- a/src/test/ui/error-codes/E0611.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0611]: field `0` of tuple-struct `a::Foo` is private
-  --> $DIR/E0611.rs:21:4
-   |
-LL |    y.0; //~ ERROR E0611
-   |    ^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0611`.
diff --git a/src/test/ui/error-codes/E0612.stderr b/src/test/ui/error-codes/E0612.stderr
deleted file mode 100644
index 18013697a83..00000000000
--- a/src/test/ui/error-codes/E0612.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0612]: attempted out-of-bounds tuple index `1` on type `Foo`
-  --> $DIR/E0612.rs:15:4
-   |
-LL |    y.1; //~ ERROR E0612
-   |    ^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0612`.
diff --git a/src/test/ui/error-codes/E0611.rs b/src/test/ui/error-codes/ex-E0611.rs
index 1e392d194b1..4e580242e64 100644
--- a/src/test/ui/error-codes/E0611.rs
+++ b/src/test/ui/error-codes/ex-E0611.rs
@@ -18,5 +18,5 @@ mod a {
 
 fn main() {
    let y = a::Foo::new();
-   y.0; //~ ERROR E0611
+   y.0; //~ ERROR field `0` of struct `a::Foo` is private
 }
diff --git a/src/test/ui/error-codes/ex-E0611.stderr b/src/test/ui/error-codes/ex-E0611.stderr
new file mode 100644
index 00000000000..2f5066542db
--- /dev/null
+++ b/src/test/ui/error-codes/ex-E0611.stderr
@@ -0,0 +1,9 @@
+error[E0616]: field `0` of struct `a::Foo` is private
+  --> $DIR/ex-E0611.rs:21:4
+   |
+LL |    y.0; //~ ERROR field `0` of struct `a::Foo` is private
+   |    ^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0616`.
diff --git a/src/test/ui/error-codes/E0612.rs b/src/test/ui/error-codes/ex-E0612.rs
index 429a8bb7eb7..46e26c87e5f 100644
--- a/src/test/ui/error-codes/E0612.rs
+++ b/src/test/ui/error-codes/ex-E0612.rs
@@ -12,5 +12,5 @@ struct Foo(u32);
 
 fn main() {
    let y = Foo(0);
-   y.1; //~ ERROR E0612
+   y.1; //~ ERROR no field `1` on type `Foo`
 }
diff --git a/src/test/ui/error-codes/ex-E0612.stderr b/src/test/ui/error-codes/ex-E0612.stderr
new file mode 100644
index 00000000000..a07efc939ab
--- /dev/null
+++ b/src/test/ui/error-codes/ex-E0612.stderr
@@ -0,0 +1,9 @@
+error[E0609]: no field `1` on type `Foo`
+  --> $DIR/ex-E0612.rs:15:6
+   |
+LL |    y.1; //~ ERROR no field `1` on type `Foo`
+   |      ^ did you mean `0`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/src/test/ui/issue-47073-zero-padded-tuple-struct-indices.rs b/src/test/ui/issue-47073-zero-padded-tuple-struct-indices.rs
index e339716289c..c59a9bc4170 100644
--- a/src/test/ui/issue-47073-zero-padded-tuple-struct-indices.rs
+++ b/src/test/ui/issue-47073-zero-padded-tuple-struct-indices.rs
@@ -16,7 +16,7 @@ struct Verdict(Guilty, Option<FineDollars>);
 fn main() {
     let justice = Verdict(true, Some(2718));
     let _condemned = justice.00;
-    //~^ ERROR invalid tuple or struct index
+    //~^ ERROR no field `00` on type `Verdict`
     let _punishment = justice.001;
-    //~^ ERROR invalid tuple or struct index
+    //~^ ERROR no field `001` on type `Verdict`
 }
diff --git a/src/test/ui/issue-47073-zero-padded-tuple-struct-indices.stderr b/src/test/ui/issue-47073-zero-padded-tuple-struct-indices.stderr
index 9603ac01fef..4a1c9b554a9 100644
--- a/src/test/ui/issue-47073-zero-padded-tuple-struct-indices.stderr
+++ b/src/test/ui/issue-47073-zero-padded-tuple-struct-indices.stderr
@@ -1,14 +1,17 @@
-error: invalid tuple or struct index
+error[E0609]: no field `00` on type `Verdict`
   --> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:18:30
    |
 LL |     let _condemned = justice.00;
-   |                              ^^ help: try simplifying the index: `0`
+   |                              ^^ did you mean `0`?
 
-error: invalid tuple or struct index
+error[E0609]: no field `001` on type `Verdict`
   --> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:20:31
    |
 LL |     let _punishment = justice.001;
-   |                               ^^^ help: try simplifying the index: `1`
+   |                               ^^^ unknown field
+   |
+   = note: available fields are: `0`, `1`
 
 error: aborting due to 2 previous errors
 
+For more information about this error, try `rustc --explain E0609`.
diff --git a/src/test/ui/macros/macro-backtrace-invalid-internals.rs b/src/test/ui/macros/macro-backtrace-invalid-internals.rs
index 58a30e86f22..bff64ad4892 100644
--- a/src/test/ui/macros/macro-backtrace-invalid-internals.rs
+++ b/src/test/ui/macros/macro-backtrace-invalid-internals.rs
@@ -24,7 +24,7 @@ macro_rules! fake_field_stmt {
 
 macro_rules! fake_anon_field_stmt {
      () => {
-          (1).0 //~ ERROR no field
+          (1).0 //~ ERROR doesn't have fields
      }
 }
 
@@ -42,7 +42,7 @@ macro_rules! fake_field_expr {
 
 macro_rules! fake_anon_field_expr {
      () => {
-          (1).0 //~ ERROR no field
+          (1).0 //~ ERROR doesn't have fields
      }
 }
 
diff --git a/src/test/ui/macros/macro-backtrace-invalid-internals.stderr b/src/test/ui/macros/macro-backtrace-invalid-internals.stderr
index eab6cd23748..cb7d422b7f3 100644
--- a/src/test/ui/macros/macro-backtrace-invalid-internals.stderr
+++ b/src/test/ui/macros/macro-backtrace-invalid-internals.stderr
@@ -16,11 +16,11 @@ LL |           1.fake //~ ERROR doesn't have fields
 LL |     fake_field_stmt!();
    |     ------------------- in this macro invocation
 
-error[E0609]: no field `0` on type `{integer}`
-  --> $DIR/macro-backtrace-invalid-internals.rs:27:11
+error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
+  --> $DIR/macro-backtrace-invalid-internals.rs:27:15
    |
-LL |           (1).0 //~ ERROR no field
-   |           ^^^^^
+LL |           (1).0 //~ ERROR doesn't have fields
+   |               ^
 ...
 LL |     fake_anon_field_stmt!();
    |     ------------------------ in this macro invocation
@@ -56,11 +56,11 @@ LL |           1.fake //~ ERROR doesn't have fields
 LL |     let _ = fake_field_expr!();
    |             ------------------ in this macro invocation
 
-error[E0609]: no field `0` on type `{integer}`
-  --> $DIR/macro-backtrace-invalid-internals.rs:45:11
+error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
+  --> $DIR/macro-backtrace-invalid-internals.rs:45:15
    |
-LL |           (1).0 //~ ERROR no field
-   |           ^^^^^
+LL |           (1).0 //~ ERROR doesn't have fields
+   |               ^
 ...
 LL |     let _ = fake_anon_field_expr!();
    |             ----------------------- in this macro invocation
@@ -80,5 +80,5 @@ LL |           2.0_f32.powi(2) //~ ERROR can't call method `powi` on ambiguous n
 
 error: aborting due to 8 previous errors
 
-Some errors occurred: E0599, E0609, E0610, E0689.
+Some errors occurred: E0599, E0610, E0689.
 For more information about an error, try `rustc --explain E0599`.