-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #94839 - TaKO8Ki:suggest-using-double-colon-for-struc…
…t-field-type, r=cjgillot Suggest using double colon when a struct field type include single colon #92685
- Loading branch information
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/test/ui/suggestions/struct-field-type-including-single-colon.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
mod foo { | ||
struct A; | ||
mod bar { | ||
struct B; | ||
} | ||
} | ||
|
||
struct Foo { | ||
a: foo:A, | ||
//~^ ERROR found single colon in a struct field type path | ||
//~| expected `,`, or `}`, found `:` | ||
} | ||
|
||
struct Bar { | ||
b: foo::bar:B, | ||
//~^ ERROR found single colon in a struct field type path | ||
//~| expected `,`, or `}`, found `:` | ||
} | ||
|
||
fn main() {} |
36 changes: 36 additions & 0 deletions
36
src/test/ui/suggestions/struct-field-type-including-single-colon.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
error: found single colon in a struct field type path | ||
--> $DIR/struct-field-type-including-single-colon.rs:9:11 | ||
| | ||
LL | a: foo:A, | ||
| ^ | ||
| | ||
help: write a path separator here | ||
| | ||
LL | a: foo::A, | ||
| ~~ | ||
|
||
error: expected `,`, or `}`, found `:` | ||
--> $DIR/struct-field-type-including-single-colon.rs:9:11 | ||
| | ||
LL | a: foo:A, | ||
| ^ | ||
|
||
error: found single colon in a struct field type path | ||
--> $DIR/struct-field-type-including-single-colon.rs:15:16 | ||
| | ||
LL | b: foo::bar:B, | ||
| ^ | ||
| | ||
help: write a path separator here | ||
| | ||
LL | b: foo::bar::B, | ||
| ~~ | ||
|
||
error: expected `,`, or `}`, found `:` | ||
--> $DIR/struct-field-type-including-single-colon.rs:15:16 | ||
| | ||
LL | b: foo::bar:B, | ||
| ^ | ||
|
||
error: aborting due to 4 previous errors | ||
|