Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tests/rustdoc-ui/projection-as-union-type-error.rs
Original file line number Diff line number Diff line change
@@ -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,
}
15 changes: 15 additions & 0 deletions tests/rustdoc-ui/projection-as-union-type-error.stderr
Original file line number Diff line number Diff line change
@@ -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`.
Original file line number Diff line number Diff line change
@@ -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() {}
Loading