summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-05-14 08:06:40 +0000
committerbors <bors@rust-lang.org>2023-05-14 08:06:40 +0000
commit0a0e045e50352d5b8c5c99e965c16aa978a0cbe1 (patch)
treec2cb8ed5aac700c698ba1af046b721a157cd00d3 /tests
parentbc888958c9e1fdde09791f15d3421bdc3b6d7d29 (diff)
parentd1cd1273f515eb668578dd58585a75b4e1c3012c (diff)
downloadrust-0a0e045e50352d5b8c5c99e965c16aa978a0cbe1.tar.gz
Auto merge of #111552 - matthiaskrgr:rollup-4nidoti, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #111463 (Better diagnostics for `env!` where variable contains escape) - #111477 (better diagnostics for `impl<..> impl Trait for Type`) - #111534 (rustdoc-json: Add tests for `#![feature(inherent_associated_types)]`) - #111549 ([rustdoc] Convert more GUI tests colors to their original format) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc-gui/search-result-color.goml172
-rw-r--r--tests/rustdoc-json/type/inherent_associated_type.rs29
-rw-r--r--tests/rustdoc-json/type/inherent_associated_type_bound.rs21
-rw-r--r--tests/rustdoc-json/type/inherent_associated_type_projections.rs33
-rw-r--r--tests/ui/extenv/extenv-escaped-var.rs3
-rw-r--r--tests/ui/extenv/extenv-escaped-var.stderr11
-rw-r--r--tests/ui/extenv/issue-110547.stderr12
-rw-r--r--tests/ui/impl-trait/extra-impl-in-trait-impl.fixed19
-rw-r--r--tests/ui/impl-trait/extra-impl-in-trait-impl.rs19
-rw-r--r--tests/ui/impl-trait/extra-impl-in-trait-impl.stderr26
10 files changed, 253 insertions, 92 deletions
diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml
index da46a90df90..90f7160b724 100644
--- a/tests/rustdoc-gui/search-result-color.goml
+++ b/tests/rustdoc-gui/search-result-color.goml
@@ -47,89 +47,89 @@ reload:
wait-for: "#search-tabs"
assert-css: (
"#search-tabs > button > .count",
- {"color": "rgb(136, 136, 136)"},
+ {"color": "#888"},
ALL,
)
assert-css: (
"//*[@class='desc'][text()='Just a normal struct.']",
- {"color": "rgb(197, 197, 197)"},
+ {"color": "#c5c5c5"},
)
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']",
- {"color": "rgb(0, 150, 207)"},
+ {"color": "#0096cf"},
)
// Checking the color of the bottom border.
assert-css: (
".search-results > a",
- {"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
+ {"border-bottom-color": "#aaa3"}
)
// Checking the color of "keyword" text.
assert-css: (
"//*[@class='result-name']//*[text()='(keyword)']",
- {"color": "rgb(120, 135, 151)"},
+ {"color": "#788797"},
)
-store-value: (entry_color, "rgb(0, 150, 207)") // color of the search entry
-store-value: (hover_entry_color, "rgb(255, 255, 255)") // color of the hovered/focused search entry
-store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
-store-value: (hover_background_color, "rgb(60, 60, 60)") // hover background color
+store-value: (entry_color, "#0096cf") // color of the search entry
+store-value: (hover_entry_color, "#fff") // color of the hovered/focused search entry
+store-value: (background_color, "transparent") // background color
+store-value: (hover_background_color, "#3c3c3c") // hover background color
call-function: (
"check-result-color", (
"keyword", // item kind
- "rgb(57, 175, 215)", // color of item kind
- "rgb(57, 175, 215)", // color of hovered/focused item kind
+ "#39afd7", // color of item kind
+ "#39afd7", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"struct", // item kind
- "rgb(255, 160, 165)", // color of item kind
- "rgb(255, 160, 165)", // color of hovered/focused item kind
+ "#ffa0a5", // color of item kind
+ "#ffa0a5", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"associatedtype", // item kind
- "rgb(57, 175, 215)", // color of item kind
- "rgb(57, 175, 215)", // color of hovered/focused item kind
+ "#39afd7", // color of item kind
+ "#39afd7", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"tymethod", // item kind
- "rgb(253, 214, 135)", // color of item kind
- "rgb(253, 214, 135)", // color of hovered/focused item kind
+ "#fdd687", // color of item kind
+ "#fdd687", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"method", // item kind
- "rgb(253, 214, 135)", // color of item kind
- "rgb(253, 214, 135)", // color of hovered/focused item kind
+ "#fdd687", // color of item kind
+ "#fdd687", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"structfield", // item kind
- "rgb(0, 150, 207)", // color of item kind
- "rgb(255, 255, 255)", // color of hovered/focused item kind
+ "#0096cf", // color of item kind
+ "#fff", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"macro", // item kind
- "rgb(163, 122, 204)", // color of item kind
- "rgb(163, 122, 204)", // color of hovered/focused item kind
+ "#a37acc", // color of item kind
+ "#a37acc", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"fn", // item kind
- "rgb(253, 214, 135)", // color of item kind
- "rgb(253, 214, 135)", // color of hovered/focused item kind
+ "#fdd687", // color of item kind
+ "#fdd687", // color of hovered/focused item kind
),
)
@@ -138,7 +138,7 @@ move-cursor-to: ".search-input"
focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
- {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"},
+ {"color": "#0096cf", "background-color": "transparent"},
ALL,
)
@@ -146,11 +146,11 @@ assert-css: (
move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']"
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']",
- {"color": "rgb(255, 255, 255)"},
+ {"color": "#fff"},
)
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
- {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"},
+ {"color": "#fff", "background-color": "rgb(60, 60, 60)"},
)
// Dark theme
@@ -164,89 +164,89 @@ reload:
wait-for: "#search-tabs"
assert-css: (
"#search-tabs > button > .count",
- {"color": "rgb(136, 136, 136)"},
+ {"color": "#888"},
ALL,
)
assert-css: (
"//*[@class='desc'][text()='Just a normal struct.']",
- {"color": "rgb(221, 221, 221)"},
+ {"color": "#ddd"},
)
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']",
- {"color": "rgb(221, 221, 221)"},
+ {"color": "#ddd"},
)
// Checking the color of the bottom border.
assert-css: (
".search-results > a",
- {"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
+ {"border-bottom-color": "#aaa3"}
)
// Checking the color for "keyword" text.
assert-css: (
"//*[@class='result-name']//*[text()='(keyword)']",
- {"color": "rgb(221, 221, 221)"},
+ {"color": "#ddd"},
)
-store-value: (entry_color, "rgb(221, 221, 221)") // color of the search entry
-store-value: (hover_entry_color, "rgb(221, 221, 221)") // color of the hovered/focused search entry
-store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
-store-value: (hover_background_color, "rgb(97, 97, 97)") // hover background color
+store-value: (entry_color, "#ddd") // color of the search entry
+store-value: (hover_entry_color, "#ddd") // color of the hovered/focused search entry
+store-value: (background_color, "transparent") // background color
+store-value: (hover_background_color, "#616161") // hover background color
call-function: (
"check-result-color", (
"keyword", // item kind
- "rgb(210, 153, 29)", // color of item kind
- "rgb(210, 153, 29)", // color of hovered/focused item kind
+ "#d2991d", // color of item kind
+ "#d2991d", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"struct", // item kind
- "rgb(45, 191, 184)", // color of item kind
- "rgb(45, 191, 184)", // color of hovered/focused item kind
+ "#2dbfb8", // color of item kind
+ "#2dbfb8", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"associatedtype", // item kind
- "rgb(210, 153, 29)", // color of item kind
- "rgb(210, 153, 29)", // color of hovered/focused item kind
+ "#d2991d", // color of item kind
+ "#d2991d", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"tymethod", // item kind
- "rgb(43, 171, 99)", // color of item kind
- "rgb(43, 171, 99)", // color of hovered/focused item kind
+ "#2bab63", // color of item kind
+ "#2bab63", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"method", // item kind
- "rgb(43, 171, 99)", // color of item kind
- "rgb(43, 171, 99)", // color of hovered/focused item kind
+ "#2bab63", // color of item kind
+ "#2bab63", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"structfield", // item kind
- "rgb(221, 221, 221)", // color of item kind
- "rgb(221, 221, 221)", // color of hovered/focused item kind
+ "#ddd", // color of item kind
+ "#ddd", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"macro", // item kind
- "rgb(9, 189, 0)", // color of item kind
- "rgb(9, 189, 0)", // color of hovered/focused item kind
+ "#09bd00", // color of item kind
+ "#09bd00", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"fn", // item kind
- "rgb(43, 171, 99)", // color of item kind
- "rgb(43, 171, 99)", // color of hovered/focused item kind
+ "#2bab63", // color of item kind
+ "#2bab63", // color of hovered/focused item kind
),
)
@@ -255,7 +255,7 @@ move-cursor-to: ".search-input"
focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
- {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
+ {"color": "#ddd", "background-color": "transparent"},
)
// Light theme
@@ -266,89 +266,89 @@ reload:
wait-for: "#search-tabs"
assert-css: (
"#search-tabs > button > .count",
- {"color": "rgb(136, 136, 136)"},
+ {"color": "#888"},
ALL,
)
assert-css: (
"//*[@class='desc'][text()='Just a normal struct.']",
- {"color": "rgb(0, 0, 0)"},
+ {"color": "#000"},
)
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']",
- {"color": "rgb(0, 0, 0)"},
+ {"color": "#000"},
)
// Checking the color of the bottom border.
assert-css: (
".search-results > a",
- {"border-bottom-color": "rgba(170, 170, 170, 0.2)"}
+ {"border-bottom-color": "#aaa3"}
)
// Checking the color for "keyword" text.
assert-css: (
"//*[@class='result-name']//*[text()='(keyword)']",
- {"color": "rgb(0, 0, 0)"},
+ {"color": "#000"},
)
-store-value: (entry_color, "rgb(0, 0, 0)") // color of the search entry
-store-value: (hover_entry_color, "rgb(0, 0, 0)") // color of the hovered/focused search entry
-store-value: (background_color, "rgba(0, 0, 0, 0)") // background color
-store-value: (hover_background_color, "rgb(204, 204, 204)") // hover background color
+store-value: (entry_color, "#000") // color of the search entry
+store-value: (hover_entry_color, "#000") // color of the hovered/focused search entry
+store-value: (background_color, "transparent") // background color
+store-value: (hover_background_color, "#ccc") // hover background color
call-function: (
"check-result-color", (
"keyword", // item kind
- "rgb(56, 115, 173)", // color of item kind
- "rgb(56, 115, 173)", // color of hovered/focused item kind
+ "#3873ad", // color of item kind
+ "#3873ad", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"struct", // item kind
- "rgb(173, 55, 138)", // color of item kind
- "rgb(173, 55, 138)", // color of hovered/focused item kind
+ "#ad378a", // color of item kind
+ "#ad378a", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"associatedtype", // item kind
- "rgb(56, 115, 173)", // color of item kind
- "rgb(56, 115, 173)", // color of hovered/focused item kind
+ "#3873ad", // color of item kind
+ "#3873ad", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"tymethod", // item kind
- "rgb(173, 124, 55)", // color of item kind
- "rgb(173, 124, 55)", // color of hovered/focused item kind
+ "#ad7c37", // color of item kind
+ "#ad7c37", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"method", // item kind
- "rgb(173, 124, 55)", // color of item kind
- "rgb(173, 124, 55)", // color of hovered/focused item kind
+ "#ad7c37", // color of item kind
+ "#ad7c37", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"structfield", // item kind
- "rgb(0, 0, 0)", // color of item kind
- "rgb(0, 0, 0)", // color of hovered/focused item kind
+ "#000", // color of item kind
+ "#000", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"macro", // item kind
- "rgb(6, 128, 0)", // color of item kind
- "rgb(6, 128, 0)", // color of hovered/focused item kind
+ "#068000", // color of item kind
+ "#068000", // color of hovered/focused item kind
),
)
call-function: (
"check-result-color", (
"fn", // item kind
- "rgb(173, 124, 55)", // color of item kind
- "rgb(173, 124, 55)", // color of hovered/focused item kind
+ "#ad7c37", // color of item kind
+ "#ad7c37", // color of hovered/focused item kind
),
)
@@ -357,7 +357,7 @@ move-cursor-to: ".search-input"
focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
- {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
+ {"color": "#000", "background-color": "transparent"},
)
// Check the alias.
@@ -386,16 +386,16 @@ define-function: (
call-function: ("check-alias", {
"theme": "ayu",
- "alias": "rgb(197, 197, 197)",
- "grey": "rgb(153, 153, 153)",
+ "alias": "#c5c5c5",
+ "grey": "#999",
})
call-function: ("check-alias", {
"theme": "dark",
- "alias": "rgb(255, 255, 255)",
- "grey": "rgb(204, 204, 204)",
+ "alias": "#fff",
+ "grey": "#ccc",
})
call-function: ("check-alias", {
"theme": "light",
- "alias": "rgb(0, 0, 0)",
- "grey": "rgb(153, 153, 153)",
+ "alias": "#000",
+ "grey": "#999",
})
diff --git a/tests/rustdoc-json/type/inherent_associated_type.rs b/tests/rustdoc-json/type/inherent_associated_type.rs
new file mode 100644
index 00000000000..ed63def93df
--- /dev/null
+++ b/tests/rustdoc-json/type/inherent_associated_type.rs
@@ -0,0 +1,29 @@
+// ignore-tidy-linelength
+#![feature(inherent_associated_types)]
+#![feature(no_core)]
+#![allow(incomplete_features)]
+#![no_core]
+
+// @set OwnerMetadata = '$.index[*][?(@.name=="OwnerMetadata")].id'
+pub struct OwnerMetadata;
+// @set Owner = '$.index[*][?(@.name=="Owner")].id'
+pub struct Owner;
+
+pub fn create() -> Owner::Metadata {
+ OwnerMetadata
+}
+// @is '$.index[*][?(@.name=="create")].inner.decl.output.kind' '"qualified_path"'
+// @is '$.index[*][?(@.name=="create")].inner.decl.output.inner.name' '"Metadata"'
+// @is '$.index[*][?(@.name=="create")].inner.decl.output.inner.trait' null
+// @is '$.index[*][?(@.name=="create")].inner.decl.output.inner.self_type.kind' '"resolved_path"'
+// @is '$.index[*][?(@.name=="create")].inner.decl.output.inner.self_type.inner.id' $Owner
+
+/// impl
+impl Owner {
+ /// iat
+ pub type Metadata = OwnerMetadata;
+}
+// @set iat = '$.index[*][?(@.docs=="iat")].id'
+// @is '$.index[*][?(@.docs=="impl")].inner.items[*]' $iat
+// @is '$.index[*][?(@.docs=="iat")].kind' '"assoc_type"'
+// @is '$.index[*][?(@.docs=="iat")].inner.default.inner.id' $OwnerMetadata
diff --git a/tests/rustdoc-json/type/inherent_associated_type_bound.rs b/tests/rustdoc-json/type/inherent_associated_type_bound.rs
new file mode 100644
index 00000000000..a089600b692
--- /dev/null
+++ b/tests/rustdoc-json/type/inherent_associated_type_bound.rs
@@ -0,0 +1,21 @@
+// ignore-tidy-linelength
+#![feature(inherent_associated_types)]
+#![allow(incomplete_features)]
+
+// @set Carrier = '$.index[*][?(@.name=="Carrier")].id'
+pub struct Carrier<'a>(&'a ());
+
+// @is '$.index[*][?(@.name=="User")].inner.type.kind' '"function_pointer"'
+// @is '$.index[*][?(@.name=="User")].inner.type.inner.generic_params[*].name' \""'b"\"
+// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].kind' '"qualified_path"'
+// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].inner.self_type.inner.id' $Carrier
+// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].inner.self_type.inner.args.angle_bracketed.args[0].lifetime' \""'b"\"
+// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].inner.name' '"Focus"'
+// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].inner.trait' null
+// @is '$.index[*][?(@.name=="User")].inner.type.inner.decl.inputs[0][1].inner.args.angle_bracketed.args[0].type.inner' '"i32"'
+
+pub type User = for<'b> fn(Carrier<'b>::Focus<i32>);
+
+impl<'a> Carrier<'a> {
+ pub type Focus<T> = &'a mut T;
+}
diff --git a/tests/rustdoc-json/type/inherent_associated_type_projections.rs b/tests/rustdoc-json/type/inherent_associated_type_projections.rs
new file mode 100644
index 00000000000..30c68bfe56c
--- /dev/null
+++ b/tests/rustdoc-json/type/inherent_associated_type_projections.rs
@@ -0,0 +1,33 @@
+// ignore-tidy-linelength
+#![feature(inherent_associated_types)]
+#![allow(incomplete_features)]
+
+// @set Parametrized = '$.index[*][?(@.name=="Parametrized")].id'
+pub struct Parametrized<T>(T);
+
+// @is '$.index[*][?(@.name=="Test")].inner.type.kind' '"qualified_path"'
+// @is '$.index[*][?(@.name=="Test")].inner.type.inner.self_type.inner.id' $Parametrized
+// @is '$.index[*][?(@.name=="Test")].inner.type.inner.self_type.inner.args.angle_bracketed.args[0].type' '{"inner": "i32", "kind": "primitive"}'
+// @is '$.index[*][?(@.name=="Test")].inner.type.inner.name' '"Proj"'
+// @is '$.index[*][?(@.name=="Test")].inner.type.inner.trait' null
+pub type Test = Parametrized<i32>::Proj;
+
+/// param_bool
+impl Parametrized<bool> {
+ /// param_bool_proj
+ pub type Proj = ();
+}
+
+/// param_i32
+impl Parametrized<i32> {
+ /// param_i32_proj
+ pub type Proj = String;
+}
+
+// @set param_bool = '$.index[*][?(@.docs=="param_bool")].id'
+// @set param_i32 = '$.index[*][?(@.docs=="param_i32")].id'
+// @set param_bool_proj = '$.index[*][?(@.docs=="param_bool_proj")].id'
+// @set param_i32_proj = '$.index[*][?(@.docs=="param_i32_proj")].id'
+
+// @is '$.index[*][?(@.docs=="param_bool")].inner.items[*]' $param_bool_proj
+// @is '$.index[*][?(@.docs=="param_i32")].inner.items[*]' $param_i32_proj
diff --git a/tests/ui/extenv/extenv-escaped-var.rs b/tests/ui/extenv/extenv-escaped-var.rs
new file mode 100644
index 00000000000..d898feb78c6
--- /dev/null
+++ b/tests/ui/extenv/extenv-escaped-var.rs
@@ -0,0 +1,3 @@
+fn main() {
+ env!("\t"); //~ERROR environment variable `\t` not defined at compile time
+}
diff --git a/tests/ui/extenv/extenv-escaped-var.stderr b/tests/ui/extenv/extenv-escaped-var.stderr
new file mode 100644
index 00000000000..25e218c63f3
--- /dev/null
+++ b/tests/ui/extenv/extenv-escaped-var.stderr
@@ -0,0 +1,11 @@
+error: environment variable `\t` not defined at compile time
+ --> $DIR/extenv-escaped-var.rs:2:5
+ |
+LL | env!("\t");
+ | ^^^^^^^^^^
+ |
+ = help: use `std::env::var("\t")` to read the variable at run time
+ = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
diff --git a/tests/ui/extenv/issue-110547.stderr b/tests/ui/extenv/issue-110547.stderr
index 1219630d346..10589ec2f54 100644
--- a/tests/ui/extenv/issue-110547.stderr
+++ b/tests/ui/extenv/issue-110547.stderr
@@ -1,28 +1,28 @@
-error: environment variable ` ` not defined at compile time
+error: environment variable `\t` not defined at compile time
--> $DIR/issue-110547.rs:4:5
|
LL | env!{"\t"};
| ^^^^^^^^^^
|
- = help: use `std::env::var(" ")` to read the variable at run time
+ = help: use `std::env::var("\t")` to read the variable at run time
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: environment variable ` ` not defined at compile time
+error: environment variable `\t` not defined at compile time
--> $DIR/issue-110547.rs:5:5
|
LL | env!("\t");
| ^^^^^^^^^^
|
- = help: use `std::env::var(" ")` to read the variable at run time
+ = help: use `std::env::var("\t")` to read the variable at run time
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: environment variable `` not defined at compile time
+error: environment variable `\u{2069}` not defined at compile time
--> $DIR/issue-110547.rs:6:5
|
LL | env!("\u{2069}");
| ^^^^^^^^^^^^^^^^
|
- = help: use `std::env::var("")` to read the variable at run time
+ = help: use `std::env::var("\u{2069}")` to read the variable at run time
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
diff --git a/tests/ui/impl-trait/extra-impl-in-trait-impl.fixed b/tests/ui/impl-trait/extra-impl-in-trait-impl.fixed
new file mode 100644
index 00000000000..cd4f2610d3f
--- /dev/null
+++ b/tests/ui/impl-trait/extra-impl-in-trait-impl.fixed
@@ -0,0 +1,19 @@
+// run-rustfix
+
+struct S<T>(T);
+struct S2;
+
+impl<T: Default> Default for S<T> {
+ //~^ ERROR: unexpected `impl` keyword
+ //~| HELP: remove the extra `impl`
+ fn default() -> Self { todo!() }
+}
+
+impl Default for S2 {
+ //~^ ERROR: unexpected `impl` keyword
+ //~| HELP: remove the extra `impl`
+ fn default() -> Self { todo!() }
+}
+
+
+fn main() {}
diff --git a/tests/ui/impl-trait/extra-impl-in-trait-impl.rs b/tests/ui/impl-trait/extra-impl-in-trait-impl.rs
new file mode 100644
index 00000000000..024b703e6f2
--- /dev/null
+++ b/tests/ui/impl-trait/extra-impl-in-trait-impl.rs
@@ -0,0 +1,19 @@
+// run-rustfix
+
+struct S<T>(T);
+struct S2;
+
+impl<T: Default> impl Default for S<T> {
+ //~^ ERROR: unexpected `impl` keyword
+ //~| HELP: remove the extra `impl`
+ fn default() -> Self { todo!() }
+}
+
+impl impl Default for S2 {
+ //~^ ERROR: unexpected `impl` keyword
+ //~| HELP: remove the extra `impl`
+ fn default() -> Self { todo!() }
+}
+
+
+fn main() {}
diff --git a/tests/ui/impl-trait/extra-impl-in-trait-impl.stderr b/tests/ui/impl-trait/extra-impl-in-trait-impl.stderr
new file mode 100644
index 00000000000..5aafc8b64d4
--- /dev/null
+++ b/tests/ui/impl-trait/extra-impl-in-trait-impl.stderr
@@ -0,0 +1,26 @@
+error: unexpected `impl` keyword
+ --> $DIR/extra-impl-in-trait-impl.rs:6:18
+ |
+LL | impl<T: Default> impl Default for S<T> {
+ | ^^^^^ help: remove the extra `impl`
+ |
+note: this is parsed as an `impl Trait` type, but a trait is expected at this position
+ --> $DIR/extra-impl-in-trait-impl.rs:6:18
+ |
+LL | impl<T: Default> impl Default for S<T> {
+ | ^^^^^^^^^^^^
+
+error: unexpected `impl` keyword
+ --> $DIR/extra-impl-in-trait-impl.rs:12:6
+ |
+LL | impl impl Default for S2 {
+ | ^^^^^ help: remove the extra `impl`
+ |
+note: this is parsed as an `impl Trait` type, but a trait is expected at this position
+ --> $DIR/extra-impl-in-trait-impl.rs:12:6
+ |
+LL | impl impl Default for S2 {
+ | ^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+