diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-09-10 17:35:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-10 17:35:14 +0200 |
| commit | a204f87de8a3d3b57633a77f8a320fd79aac3682 (patch) | |
| tree | 0b5f409f4a2ada55fb3c4e5f995c6060c35240a4 | |
| parent | 34c935baf30c87a9b7487a55844dadd003de7110 (diff) | |
| parent | 6d61dfd2e48d4f183ca4bca4aaa60b2e2ffb4fa0 (diff) | |
| download | rust-a204f87de8a3d3b57633a77f8a320fd79aac3682.tar.gz rust-a204f87de8a3d3b57633a77f8a320fd79aac3682.zip | |
Rollup merge of #130173 - fmease:rustdoc-regression-tests, r=notriddle
rustdoc: add two regression tests They were basically copy/pasted from `tests/ui/` to `tests/rustdoc-ui/`. Not sure if it's worth adding these, I can just close these issues as is if you want. This brings the number of https://github.com/rust-lang/rust/labels/T-rustdoc + https://github.com/rust-lang/rust/labels/E-needs-test from 3 down to 1. The remaining one – #103004 — is a nasty one to retroactively find a proper(!) test for. Fixes #98250. Fixes #107872. r? rustdoc
3 files changed, 52 insertions, 0 deletions
diff --git a/tests/rustdoc-ui/projection-as-union-type-error.rs b/tests/rustdoc-ui/projection-as-union-type-error.rs new file mode 100644 index 00000000000..d1d2e72249d --- /dev/null +++ b/tests/rustdoc-ui/projection-as-union-type-error.rs @@ -0,0 +1,14 @@ +// Test to ensure that there is no ICE when normalizing a projection. +// See also <https://github.com/rust-lang/rust/pull/106938>. +// issue: rust-lang/rust#107872 + +pub trait Identity { + type Identity; +} + +pub type Foo = u8; + +pub union Bar { + a: <Foo as Identity>::Identity, //~ ERROR the trait bound `u8: Identity` is not satisfied + b: u8, +} diff --git a/tests/rustdoc-ui/projection-as-union-type-error.stderr b/tests/rustdoc-ui/projection-as-union-type-error.stderr new file mode 100644 index 00000000000..32598015864 --- /dev/null +++ b/tests/rustdoc-ui/projection-as-union-type-error.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `u8: Identity` is not satisfied + --> $DIR/projection-as-union-type-error.rs:12:9 + | +LL | a: <Foo as Identity>::Identity, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Identity` is not implemented for `u8` + | +help: this trait has no implementations, consider adding one + --> $DIR/projection-as-union-type-error.rs:5:1 + | +LL | pub trait Identity { + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/rustdoc-ui/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs b/tests/rustdoc-ui/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs new file mode 100644 index 00000000000..9f8053d5538 --- /dev/null +++ b/tests/rustdoc-ui/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs @@ -0,0 +1,23 @@ +// issue: rust-lang/rust#98250 +//@ check-pass + +#![feature(type_alias_impl_trait)] + +mod foo { + pub type Foo = impl PartialEq<(Foo, i32)>; + + fn foo() -> Foo { + super::Bar + } +} +use foo::Foo; + +struct Bar; + +impl PartialEq<(Foo, i32)> for Bar { + fn eq(&self, _other: &(Foo, i32)) -> bool { + true + } +} + +fn main() {} |
