Skip to content

Commit a03da2b

Browse files
Add test for implementation on projection
1 parent 5919f62 commit a03da2b

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// This test ensures that if implementation on projections is supported,
2+
// it doesn't end in very weird cycle error.
3+
4+
#![crate_type = "lib"]
5+
6+
pub trait Identity {
7+
type Identity: ?Sized;
8+
}
9+
10+
impl<T: ?Sized> Identity for T {
11+
type Identity = Self;
12+
}
13+
14+
pub struct I8<const F: i8>;
15+
16+
impl <I8<{i8::MIN}> as Identity>::Identity {
17+
//~^ ERROR no nominal type found for inherent implementation
18+
pub fn foo(&self) {}
19+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0118]: no nominal type found for inherent implementation
2+
--> $DIR/wrong-normalization.rs:16:6
3+
|
4+
LL | impl <I8<{i8::MIN}> as Identity>::Identity {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type
6+
|
7+
= note: either implement a trait on it or create a newtype to wrap it instead
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0118`.

0 commit comments

Comments
 (0)