about summary refs log tree commit diff
path: root/tests/rustdoc-ui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc-ui')
-rw-r--r--tests/rustdoc-ui/invalid-redundant-explicit-link.rs8
-rw-r--r--tests/rustdoc-ui/invalid_associated_const.rs1
-rw-r--r--tests/rustdoc-ui/invalid_associated_const.stderr10
-rw-r--r--tests/rustdoc-ui/issue-102467.rs1
-rw-r--r--tests/rustdoc-ui/issue-102467.stderr10
-rw-r--r--tests/rustdoc-ui/issues/issue-110900.rs1
-rw-r--r--tests/rustdoc-ui/issues/issue-96287.rs1
-rw-r--r--tests/rustdoc-ui/issues/issue-96287.stderr14
-rw-r--r--tests/rustdoc-ui/lints/check.stderr2
-rw-r--r--tests/rustdoc-ui/synthetic-auto-trait-impls/const-in-super-trait-and-item-bound.rs23
-rw-r--r--tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl-normalize.rs17
-rw-r--r--tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl.rs11
-rw-r--r--tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.rs18
-rw-r--r--tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.stderr25
-rw-r--r--tests/rustdoc-ui/synthetic-auto-trait-impls/unconstrained-param-in-impl-ambiguity.rs10
-rw-r--r--tests/rustdoc-ui/synthetic-auto-trait-impls/unconstrained-param-in-impl-ambiguity.stderr9
16 files changed, 155 insertions, 6 deletions
diff --git a/tests/rustdoc-ui/invalid-redundant-explicit-link.rs b/tests/rustdoc-ui/invalid-redundant-explicit-link.rs
new file mode 100644
index 00000000000..99ac1d82aaf
--- /dev/null
+++ b/tests/rustdoc-ui/invalid-redundant-explicit-link.rs
@@ -0,0 +1,8 @@
+//@ check-pass
+
+// Regression test for <https://github.com/rust-lang/rust/issues/123158>. It
+// should not emit any warning.
+
+//! [**`SomeTrait`**](SomeTrait):
+
+pub trait SomeTrait {}
diff --git a/tests/rustdoc-ui/invalid_associated_const.rs b/tests/rustdoc-ui/invalid_associated_const.rs
index 6ab8c36f740..6f211a383a6 100644
--- a/tests/rustdoc-ui/invalid_associated_const.rs
+++ b/tests/rustdoc-ui/invalid_associated_const.rs
@@ -3,6 +3,7 @@
 trait T {
     type A: S<C<X = 0i32> = 34>;
     //~^ ERROR associated type bindings are not allowed here
+    //~| ERROR associated type bindings are not allowed here
 }
 
 trait S {
diff --git a/tests/rustdoc-ui/invalid_associated_const.stderr b/tests/rustdoc-ui/invalid_associated_const.stderr
index 9c6ae0f76c6..1eb6d2714e3 100644
--- a/tests/rustdoc-ui/invalid_associated_const.stderr
+++ b/tests/rustdoc-ui/invalid_associated_const.stderr
@@ -4,6 +4,14 @@ error[E0229]: associated type bindings are not allowed here
 LL |     type A: S<C<X = 0i32> = 34>;
    |                 ^^^^^^^^ associated type not allowed here
 
-error: aborting due to 1 previous error
+error[E0229]: associated type bindings are not allowed here
+  --> $DIR/invalid_associated_const.rs:4:17
+   |
+LL |     type A: S<C<X = 0i32> = 34>;
+   |                 ^^^^^^^^ associated type not allowed here
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0229`.
diff --git a/tests/rustdoc-ui/issue-102467.rs b/tests/rustdoc-ui/issue-102467.rs
index bff876e41d6..a27e6156979 100644
--- a/tests/rustdoc-ui/issue-102467.rs
+++ b/tests/rustdoc-ui/issue-102467.rs
@@ -6,6 +6,7 @@
 trait T {
     type A: S<C<X = 0i32> = 34>;
     //~^ ERROR associated type bindings are not allowed here
+    //~| ERROR associated type bindings are not allowed here
 }
 
 trait S {
diff --git a/tests/rustdoc-ui/issue-102467.stderr b/tests/rustdoc-ui/issue-102467.stderr
index 4a769f94cf2..f54a50a4e19 100644
--- a/tests/rustdoc-ui/issue-102467.stderr
+++ b/tests/rustdoc-ui/issue-102467.stderr
@@ -4,6 +4,14 @@ error[E0229]: associated type bindings are not allowed here
 LL |     type A: S<C<X = 0i32> = 34>;
    |                 ^^^^^^^^ associated type not allowed here
 
-error: aborting due to 1 previous error
+error[E0229]: associated type bindings are not allowed here
+  --> $DIR/issue-102467.rs:7:17
+   |
+LL |     type A: S<C<X = 0i32> = 34>;
+   |                 ^^^^^^^^ associated type not allowed here
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0229`.
diff --git a/tests/rustdoc-ui/issues/issue-110900.rs b/tests/rustdoc-ui/issues/issue-110900.rs
index 5f90444dfd3..5a896167083 100644
--- a/tests/rustdoc-ui/issues/issue-110900.rs
+++ b/tests/rustdoc-ui/issues/issue-110900.rs
@@ -1,7 +1,6 @@
 //@ check-pass
 
 #![crate_type="lib"]
-#![feature(associated_type_bounds)]
 
 trait A<'a> {}
 trait B<'b> {}
diff --git a/tests/rustdoc-ui/issues/issue-96287.rs b/tests/rustdoc-ui/issues/issue-96287.rs
index 08cc7ef4c90..b490c2fc03f 100644
--- a/tests/rustdoc-ui/issues/issue-96287.rs
+++ b/tests/rustdoc-ui/issues/issue-96287.rs
@@ -6,6 +6,7 @@ pub trait TraitWithAssoc {
 
 pub type Foo<V> = impl Trait<V::Assoc>;
 //~^ ERROR
+//~| ERROR
 
 pub trait Trait<U> {}
 
diff --git a/tests/rustdoc-ui/issues/issue-96287.stderr b/tests/rustdoc-ui/issues/issue-96287.stderr
index 62d81534a98..9aba0332164 100644
--- a/tests/rustdoc-ui/issues/issue-96287.stderr
+++ b/tests/rustdoc-ui/issues/issue-96287.stderr
@@ -9,6 +9,18 @@ help: consider restricting type parameter `V`
 LL | pub type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>;
    |               ++++++++++++++++
 
-error: aborting due to 1 previous error
+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 an associated type `Assoc` in the trait `TraitWithAssoc`
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: consider restricting type parameter `V`
+   |
+LL | pub type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>;
+   |               ++++++++++++++++
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0220`.
diff --git a/tests/rustdoc-ui/lints/check.stderr b/tests/rustdoc-ui/lints/check.stderr
index c5ed5d0c3ef..acdb8128443 100644
--- a/tests/rustdoc-ui/lints/check.stderr
+++ b/tests/rustdoc-ui/lints/check.stderr
@@ -4,7 +4,6 @@ warning: missing documentation for the crate
 LL | / #![feature(rustdoc_missing_doc_code_examples)]
 LL | |
 LL | |
-LL | |
 ...  |
 LL | |
 LL | | pub fn foo() {}
@@ -39,7 +38,6 @@ warning: missing code example in this documentation
 LL | / #![feature(rustdoc_missing_doc_code_examples)]
 LL | |
 LL | |
-LL | |
 ...  |
 LL | |
 LL | | pub fn foo() {}
diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/const-in-super-trait-and-item-bound.rs b/tests/rustdoc-ui/synthetic-auto-trait-impls/const-in-super-trait-and-item-bound.rs
new file mode 100644
index 00000000000..df6de6769d5
--- /dev/null
+++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/const-in-super-trait-and-item-bound.rs
@@ -0,0 +1,23 @@
+// We used to ICE here while trying to synthesize auto trait impls.
+// issue: 107715
+//@ check-pass
+
+pub const N: usize = 1;
+
+pub struct MapType<K: Supertrait<V>, V> {
+    _array: K::Array,
+}
+
+pub trait Subtrait: Supertrait<[u8; N]> {}
+
+pub trait Supertrait<V> {
+    type Array: AnotherTrait<V>;
+}
+
+pub trait AnotherTrait<V> {
+    const LENGTH: usize;
+}
+
+pub struct Container<S: Subtrait> {
+    _x: MapType<S, [u8; N]>,
+}
diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl-normalize.rs b/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl-normalize.rs
new file mode 100644
index 00000000000..1b67c2bc875
--- /dev/null
+++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl-normalize.rs
@@ -0,0 +1,17 @@
+// We used to ICE here while trying to synthesize auto trait impls.
+// issue: 112242
+//@ check-pass
+//@ compile-flags: -Znormalize-docs
+
+pub trait MyTrait<'a> {
+    type MyItem;
+}
+pub struct Inner<Q>(Q);
+pub struct Outer<Q>(Inner<Q>);
+
+impl<'a, Q> std::marker::Unpin for Inner<Q>
+where
+    Q: MyTrait<'a>,
+    <Q as MyTrait<'a>>::MyItem: Copy,
+{
+}
diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl.rs b/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl.rs
new file mode 100644
index 00000000000..31d1b11ff31
--- /dev/null
+++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl.rs
@@ -0,0 +1,11 @@
+// We used to ICE here while trying to synthesize auto trait impls.
+// issue: 123370
+//@ check-pass
+
+pub struct Inner<'a, Q>(&'a (), Q);
+
+pub struct Outer<'a, Q>(Inner<'a, Q>);
+
+impl<'a, Q: Trait<'a>> std::marker::Unpin for Inner<'static, Q> {}
+
+pub trait Trait<'a> {}
diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.rs b/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.rs
new file mode 100644
index 00000000000..f62f8396e99
--- /dev/null
+++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.rs
@@ -0,0 +1,18 @@
+// We used to ICE here while trying to synthesize auto trait impls.
+// issue: 114657
+
+pub trait Foo {
+    type FooType;
+}
+
+pub trait Bar<const A: usize>: Foo<FooType = <Self as Bar<A>>::BarType> {
+    type BarType;
+}
+
+pub(crate) const B: usize = 5;
+
+pub trait Tec: Bar<B> {}
+
+pub struct Structure<C: Tec> { //~ ERROR the trait bound `C: Bar<5>` is not satisfied
+    _field: C::BarType, //~ ERROR the trait bound `C: Bar<5>` is not satisfied
+}
diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.stderr b/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.stderr
new file mode 100644
index 00000000000..d87e769b505
--- /dev/null
+++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.stderr
@@ -0,0 +1,25 @@
+error[E0277]: the trait bound `C: Bar<5>` is not satisfied
+  --> $DIR/projections-in-super-trait-bound-unsatisfied.rs:16:1
+   |
+LL | pub struct Structure<C: Tec> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar<5>` is not implemented for `C`
+   |
+help: consider further restricting this bound
+   |
+LL | pub struct Structure<C: Tec + Bar<5>> {
+   |                             ++++++++
+
+error[E0277]: the trait bound `C: Bar<5>` is not satisfied
+  --> $DIR/projections-in-super-trait-bound-unsatisfied.rs:17:13
+   |
+LL |     _field: C::BarType,
+   |             ^^^^^^^^^^ the trait `Bar<5>` is not implemented for `C`
+   |
+help: consider further restricting this bound
+   |
+LL | pub struct Structure<C: Tec + Bar<5>> {
+   |                             ++++++++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/unconstrained-param-in-impl-ambiguity.rs b/tests/rustdoc-ui/synthetic-auto-trait-impls/unconstrained-param-in-impl-ambiguity.rs
new file mode 100644
index 00000000000..6c62415e06d
--- /dev/null
+++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/unconstrained-param-in-impl-ambiguity.rs
@@ -0,0 +1,10 @@
+// We used to ICE here while trying to synthesize auto trait impls.
+// issue: 112828
+
+struct Outer(Inner);
+struct Inner;
+
+unsafe impl<Q: Trait> Send for Inner {}
+//~^ ERROR the type parameter `Q` is not constrained by the impl trait, self type, or predicates
+
+trait Trait {}
diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/unconstrained-param-in-impl-ambiguity.stderr b/tests/rustdoc-ui/synthetic-auto-trait-impls/unconstrained-param-in-impl-ambiguity.stderr
new file mode 100644
index 00000000000..38d1a537fe4
--- /dev/null
+++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/unconstrained-param-in-impl-ambiguity.stderr
@@ -0,0 +1,9 @@
+error[E0207]: the type parameter `Q` is not constrained by the impl trait, self type, or predicates
+  --> $DIR/unconstrained-param-in-impl-ambiguity.rs:7:13
+   |
+LL | unsafe impl<Q: Trait> Send for Inner {}
+   |             ^ unconstrained type parameter
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0207`.