Skip to content

Commit fdd35a2

Browse files
committed
revert some changes
1 parent cda05b0 commit fdd35a2

9 files changed

+62
-45
lines changed

compiler/rustc_parse/messages.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ parse_expected_struct_field = expected one of `,`, `:`, or `{"}"}`, found `{$tok
246246
247247
parse_expected_trait_in_trait_impl_found_type = expected a trait, found type
248248
249-
parse_expr_rarrow_call = `->` is not valid for field access or method call
249+
parse_expr_rarrow_call = `->` is not valid syntax for field accesses and method calls
250250
.suggestion = try using `.` instead
251251
.help = the `.` operator will automatically dereference the value, except if the value is a raw pointer
252252

compiler/rustc_parse/src/errors.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3323,6 +3323,7 @@ pub(crate) struct AsyncImpl {
33233323
#[help]
33243324
pub(crate) struct ExprRArrowCall {
33253325
#[primary_span]
3326+
#[suggestion(style = "verbose", applicability = "machine-applicable", code = ".")]
33263327
pub span: Span,
33273328
}
33283329

tests/ui/parser/expr-rarrow-call-on-a-raw-pointer.fixed

-23
This file was deleted.

tests/ui/parser/expr-rarrow-call-on-a-raw-pointer.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ run-rustfix
21
#![allow(
32
dead_code,
43
unused_must_use
@@ -11,12 +10,12 @@ struct Named {
1110
struct Unnamed(usize);
1211

1312
unsafe fn named_struct_field_access(named: *mut Named) {
14-
named->foo += 1; //~ ERROR `->` is not valid for field access or method call
13+
named->foo += 1; //~ ERROR `->` is not valid syntax for field accesses and method calls
1514
//~^ ERROR no field `foo` on type `*mut Named`
1615
}
1716

1817
unsafe fn unnamed_struct_field_access(unnamed: *mut Unnamed) {
19-
unnamed->0 += 1; //~ ERROR `->` is not valid for field access or method call
18+
unnamed->0 += 1; //~ ERROR `->` is not valid syntax for field accesses and method calls
2019
//~^ ERROR no field `0` on type `*mut Unnamed`
2120
}
2221

tests/ui/parser/expr-rarrow-call-on-a-raw-pointer.stderr

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
1-
error: `->` is not valid for field access or method call
2-
--> $DIR/expr-rarrow-call-on-a-raw-pointer.rs:14:10
1+
error: `->` is not valid syntax for field accesses and method calls
2+
--> $DIR/expr-rarrow-call-on-a-raw-pointer.rs:13:10
33
|
44
LL | named->foo += 1;
55
| ^^
66
|
77
= help: the `.` operator will automatically dereference the value, except if the value is a raw pointer
8+
help: try using `.` instead
9+
|
10+
LL - named->foo += 1;
11+
LL + named.foo += 1;
12+
|
813

9-
error: `->` is not valid for field access or method call
10-
--> $DIR/expr-rarrow-call-on-a-raw-pointer.rs:19:12
14+
error: `->` is not valid syntax for field accesses and method calls
15+
--> $DIR/expr-rarrow-call-on-a-raw-pointer.rs:18:12
1116
|
1217
LL | unnamed->0 += 1;
1318
| ^^
1419
|
1520
= help: the `.` operator will automatically dereference the value, except if the value is a raw pointer
21+
help: try using `.` instead
22+
|
23+
LL - unnamed->0 += 1;
24+
LL + unnamed.0 += 1;
25+
|
1626

1727
error[E0609]: no field `foo` on type `*mut Named`
18-
--> $DIR/expr-rarrow-call-on-a-raw-pointer.rs:14:12
28+
--> $DIR/expr-rarrow-call-on-a-raw-pointer.rs:13:12
1929
|
2030
LL | named->foo += 1;
2131
| ^^^ unknown field
@@ -27,7 +37,7 @@ LL + (*named).foo += 1;
2737
|
2838

2939
error[E0609]: no field `0` on type `*mut Unnamed`
30-
--> $DIR/expr-rarrow-call-on-a-raw-pointer.rs:19:14
40+
--> $DIR/expr-rarrow-call-on-a-raw-pointer.rs:18:14
3141
|
3242
LL | unnamed->0 += 1;
3343
| ^ unknown field

tests/ui/parser/expr-rarrow-call.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ struct Named {
1010
struct Unnamed(usize);
1111

1212
fn named_struct_field_access(named: &Named) {
13-
named->foo; //~ ERROR `->` is not valid for field access or method call
13+
named->foo; //~ ERROR `->` is not valid syntax for field accesses and method calls
1414
}
1515

1616
fn unnamed_struct_field_access(unnamed: &Unnamed) {
17-
unnamed->0; //~ ERROR `->` is not valid for field access or method call
17+
unnamed->0; //~ ERROR `->` is not valid syntax for field accesses and method calls
1818
}
1919

2020
fn tuple_field_access(t: &(u8, u8)) {
21-
t->0; //~ ERROR `->` is not valid for field access or method call
22-
t->1; //~ ERROR `->` is not valid for field access or method call
21+
t->0; //~ ERROR `->` is not valid syntax for field accesses and method calls
22+
t->1; //~ ERROR `->` is not valid syntax for field accesses and method calls
2323
}
2424

2525
#[derive(Clone)]
2626
struct Foo;
2727

2828
fn method_call(foo: &Foo) {
29-
foo->clone(); //~ ERROR `->` is not valid for field access or method call
29+
foo->clone(); //~ ERROR `->` is not valid syntax for field accesses and method calls
3030
}
3131

3232
fn main() {}
+30-5
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,67 @@
1-
error: `->` is not valid for field access or method call
1+
error: `->` is not valid syntax for field accesses and method calls
22
--> $DIR/expr-rarrow-call.rs:13:10
33
|
44
LL | named->foo;
55
| ^^
66
|
77
= help: the `.` operator will automatically dereference the value, except if the value is a raw pointer
8+
help: try using `.` instead
9+
|
10+
LL - named->foo;
11+
LL + named.foo;
12+
|
813

9-
error: `->` is not valid for field access or method call
14+
error: `->` is not valid syntax for field accesses and method calls
1015
--> $DIR/expr-rarrow-call.rs:17:12
1116
|
1217
LL | unnamed->0;
1318
| ^^
1419
|
1520
= help: the `.` operator will automatically dereference the value, except if the value is a raw pointer
21+
help: try using `.` instead
22+
|
23+
LL - unnamed->0;
24+
LL + unnamed.0;
25+
|
1626

17-
error: `->` is not valid for field access or method call
27+
error: `->` is not valid syntax for field accesses and method calls
1828
--> $DIR/expr-rarrow-call.rs:21:6
1929
|
2030
LL | t->0;
2131
| ^^
2232
|
2333
= help: the `.` operator will automatically dereference the value, except if the value is a raw pointer
34+
help: try using `.` instead
35+
|
36+
LL - t->0;
37+
LL + t.0;
38+
|
2439

25-
error: `->` is not valid for field access or method call
40+
error: `->` is not valid syntax for field accesses and method calls
2641
--> $DIR/expr-rarrow-call.rs:22:6
2742
|
2843
LL | t->1;
2944
| ^^
3045
|
3146
= help: the `.` operator will automatically dereference the value, except if the value is a raw pointer
47+
help: try using `.` instead
48+
|
49+
LL - t->1;
50+
LL + t.1;
51+
|
3252

33-
error: `->` is not valid for field access or method call
53+
error: `->` is not valid syntax for field accesses and method calls
3454
--> $DIR/expr-rarrow-call.rs:29:8
3555
|
3656
LL | foo->clone();
3757
| ^^
3858
|
3959
= help: the `.` operator will automatically dereference the value, except if the value is a raw pointer
60+
help: try using `.` instead
61+
|
62+
LL - foo->clone();
63+
LL + foo.clone();
64+
|
4065

4166
error: aborting due to 5 previous errors
4267

tests/ui/parser/issues/issue-118530-ice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ fn bar() -> String {
55
attr::fn bar() -> String { //~ ERROR expected identifier, found keyword `fn`
66
//~^ ERROR expected one of `(`, `.`, `::`, `;`, `?`, `}`, or an operator, found `{`
77
//~| ERROR expected `;`, found `bar`
8-
//~| ERROR `->` is not valid for field access or method call
8+
//~| ERROR `->` is not valid syntax for field accesses and method calls
99
#[attr]
1010
[1, 2, 3].iter().map().collect::<String>()
1111
#[attr]

tests/ui/parser/issues/issue-118530-ice.stderr

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,18 @@ LL | attr::fn bar() -> String {
3333
| |
3434
| help: add `;` here
3535

36-
error: `->` is not valid for field access or method call
36+
error: `->` is not valid syntax for field accesses and method calls
3737
--> $DIR/issue-118530-ice.rs:5:20
3838
|
3939
LL | attr::fn bar() -> String {
4040
| ^^
4141
|
4242
= help: the `.` operator will automatically dereference the value, except if the value is a raw pointer
43+
help: try using `.` instead
44+
|
45+
LL - attr::fn bar() -> String {
46+
LL + attr::fn bar() . String {
47+
|
4348

4449
error: expected one of `(`, `.`, `::`, `;`, `?`, `}`, or an operator, found `{`
4550
--> $DIR/issue-118530-ice.rs:5:30

0 commit comments

Comments
 (0)