Skip to content

Commit 6d61dfd

Browse files
committed
rustdoc: add two regression tests
1 parent 842d6fc commit 6d61dfd

3 files changed

+52
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Test to ensure that there is no ICE when normalizing a projection.
2+
// See also <https://github.com/rust-lang/rust/pull/106938>.
3+
// issue: rust-lang/rust#107872
4+
5+
pub trait Identity {
6+
type Identity;
7+
}
8+
9+
pub type Foo = u8;
10+
11+
pub union Bar {
12+
a: <Foo as Identity>::Identity, //~ ERROR the trait bound `u8: Identity` is not satisfied
13+
b: u8,
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0277]: the trait bound `u8: Identity` is not satisfied
2+
--> $DIR/projection-as-union-type-error.rs:12:9
3+
|
4+
LL | a: <Foo as Identity>::Identity,
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Identity` is not implemented for `u8`
6+
|
7+
help: this trait has no implementations, consider adding one
8+
--> $DIR/projection-as-union-type-error.rs:5:1
9+
|
10+
LL | pub trait Identity {
11+
| ^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to 1 previous error
14+
15+
For more information about this error, try `rustc --explain E0277`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// issue: rust-lang/rust#98250
2+
//@ check-pass
3+
4+
#![feature(type_alias_impl_trait)]
5+
6+
mod foo {
7+
pub type Foo = impl PartialEq<(Foo, i32)>;
8+
9+
fn foo() -> Foo {
10+
super::Bar
11+
}
12+
}
13+
use foo::Foo;
14+
15+
struct Bar;
16+
17+
impl PartialEq<(Foo, i32)> for Bar {
18+
fn eq(&self, _other: &(Foo, i32)) -> bool {
19+
true
20+
}
21+
}
22+
23+
fn main() {}

0 commit comments

Comments
 (0)