]> git.lizzy.rs Git - rust.git/commitdiff
Add regression test for #96287
authorGuillaume Gomez <guillaume.gomez@huawei.com>
Mon, 2 Jan 2023 13:29:56 +0000 (14:29 +0100)
committerGuillaume Gomez <guillaume.gomez@huawei.com>
Mon, 2 Jan 2023 13:49:08 +0000 (14:49 +0100)
src/test/rustdoc-ui/issue-96287.rs [new file with mode: 0644]
src/test/rustdoc-ui/issue-96287.stderr [new file with mode: 0644]

diff --git a/src/test/rustdoc-ui/issue-96287.rs b/src/test/rustdoc-ui/issue-96287.rs
new file mode 100644 (file)
index 0000000..8d8b445
--- /dev/null
@@ -0,0 +1,17 @@
+#![feature(type_alias_impl_trait)]
+
+pub trait TraitWithAssoc {
+    type Assoc;
+}
+
+pub type Foo<V> = impl Trait<V::Assoc>;
+//~^ ERROR
+//~^^ ERROR
+
+pub trait Trait<U> {}
+
+impl<W> Trait<W> for () {}
+
+pub fn foo_desugared<T: TraitWithAssoc>(_: T) -> Foo<T> {
+    ()
+}
diff --git a/src/test/rustdoc-ui/issue-96287.stderr b/src/test/rustdoc-ui/issue-96287.stderr
new file mode 100644 (file)
index 0000000..0236b9f
--- /dev/null
@@ -0,0 +1,15 @@
+error[E0220]: associated type `Assoc` not found for `V`
+  --> $DIR/issue-96287.rs:7:33
+   |
+LL | pub type Foo<V> = impl Trait<V::Assoc>;
+   |                                 ^^^^^ there is a similarly named associated type `Assoc` in the trait `TraitWithAssoc`
+
+error[E0220]: associated type `Assoc` not found for `V`
+  --> $DIR/issue-96287.rs:7:33
+   |
+LL | pub type Foo<V> = impl Trait<V::Assoc>;
+   |                                 ^^^^^ there is a similarly named associated type `Assoc` in the trait `TraitWithAssoc`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0220`.