]> git.lizzy.rs Git - rust.git/commitdiff
fix a suggestion message
authorTakayuki Maeda <takoyaki0316@gmail.com>
Fri, 11 Mar 2022 12:26:06 +0000 (21:26 +0900)
committerTakayuki Maeda <takoyaki0316@gmail.com>
Fri, 11 Mar 2022 12:26:06 +0000 (21:26 +0900)
compiler/rustc_parse/src/parser/item.rs
src/test/ui/suggestions/struct-field-type-including-single-colon.rs [new file with mode: 0644]
src/test/ui/suggestions/struct-field-type-including-single-colon.stderr [new file with mode: 0644]
src/test/ui/suggestions/sturct-field-type-including-single-colon.rs [deleted file]
src/test/ui/suggestions/sturct-field-type-including-single-colon.stderr [deleted file]

index 423ce7c354c3ff71dc29e44f60a15211ae2ac882..ec89301c1e22edf17358721a99c63179ee207dcf 100644 (file)
@@ -1538,7 +1538,7 @@ fn parse_name_and_ty(
             self.struct_span_err(self.token.span, "found single colon in a struct field type path")
                 .span_suggestion_verbose(
                     self.token.span,
-                    "maybe you meant to write a path separator here",
+                    "write a path separator here",
                     "::".to_string(),
                     Applicability::MaybeIncorrect,
                 )
diff --git a/src/test/ui/suggestions/struct-field-type-including-single-colon.rs b/src/test/ui/suggestions/struct-field-type-including-single-colon.rs
new file mode 100644 (file)
index 0000000..b7ad6d9
--- /dev/null
@@ -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() {}
diff --git a/src/test/ui/suggestions/struct-field-type-including-single-colon.stderr b/src/test/ui/suggestions/struct-field-type-including-single-colon.stderr
new file mode 100644 (file)
index 0000000..189759d
--- /dev/null
@@ -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
+
diff --git a/src/test/ui/suggestions/sturct-field-type-including-single-colon.rs b/src/test/ui/suggestions/sturct-field-type-including-single-colon.rs
deleted file mode 100644 (file)
index b7ad6d9..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-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() {}
diff --git a/src/test/ui/suggestions/sturct-field-type-including-single-colon.stderr b/src/test/ui/suggestions/sturct-field-type-including-single-colon.stderr
deleted file mode 100644 (file)
index 7566ca2..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-error: found single colon in a struct field type path
-  --> $DIR/sturct-field-type-including-single-colon.rs:9:11
-   |
-LL |     a: foo:A,
-   |           ^
-   |
-help: maybe you meant to write a path separator here
-   |
-LL |     a: foo::A,
-   |           ~~
-
-error: expected `,`, or `}`, found `:`
-  --> $DIR/sturct-field-type-including-single-colon.rs:9:11
-   |
-LL |     a: foo:A,
-   |           ^
-
-error: found single colon in a struct field type path
-  --> $DIR/sturct-field-type-including-single-colon.rs:15:16
-   |
-LL |     b: foo::bar:B,
-   |                ^
-   |
-help: maybe you meant to write a path separator here
-   |
-LL |     b: foo::bar::B,
-   |                ~~
-
-error: expected `,`, or `}`, found `:`
-  --> $DIR/sturct-field-type-including-single-colon.rs:15:16
-   |
-LL |     b: foo::bar:B,
-   |                ^
-
-error: aborting due to 4 previous errors
-