AST/HIR: Merge field access expressions for named and numeric fields
This commit is contained in:
parent
6c537493d0
commit
44acea4d88
43 changed files with 105 additions and 432 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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`.
|
||||
|
|
@ -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`.
|
||||
|
|
@ -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
|
||||
}
|
||||
9
src/test/ui/error-codes/ex-E0611.stderr
Normal file
9
src/test/ui/error-codes/ex-E0611.stderr
Normal file
|
|
@ -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`.
|
||||
|
|
@ -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`
|
||||
}
|
||||
9
src/test/ui/error-codes/ex-E0612.stderr
Normal file
9
src/test/ui/error-codes/ex-E0612.stderr
Normal file
|
|
@ -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`.
|
||||
|
|
@ -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`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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`.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue