Skip to content

Commit

Permalink
Rollup merge of rust-lang#107857 - GuillaumeGomez:ui-test-impl-projec…
Browse files Browse the repository at this point in the history
…tions, r=oli-obk

Add ui test for implementation on projection

The error in full can be seen in rust-lang#107263 and is part of why the PR is blocked (it still requires the approval from the team for supporting it).

r? ``@oli-obk``
  • Loading branch information
Dylan-DPC authored Feb 11, 2023
2 parents 2745401 + a03da2b commit 2228c86
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/ui/const-generics/wrong-normalization.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// This test ensures that if implementation on projections is supported,
// it doesn't end in very weird cycle error.

#![crate_type = "lib"]

pub trait Identity {
type Identity: ?Sized;
}

impl<T: ?Sized> Identity for T {
type Identity = Self;
}

pub struct I8<const F: i8>;

impl <I8<{i8::MIN}> as Identity>::Identity {
//~^ ERROR no nominal type found for inherent implementation
pub fn foo(&self) {}
}
11 changes: 11 additions & 0 deletions tests/ui/const-generics/wrong-normalization.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0118]: no nominal type found for inherent implementation
--> $DIR/wrong-normalization.rs:16:6
|
LL | impl <I8<{i8::MIN}> as Identity>::Identity {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type
|
= note: either implement a trait on it or create a newtype to wrap it instead

error: aborting due to previous error

For more information about this error, try `rustc --explain E0118`.

0 comments on commit 2228c86

Please sign in to comment.