-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for ICE Where clause
Binder(..)
was applicable to `Obligat…
…ion(..)` but now is not Fixes #84727
- Loading branch information
1 parent
5f95fc1
commit 6fe5555
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// ICE Where clause `Binder(..)` was applicable to `Obligation(..)` but now is not | ||
// issue: rust-lang/rust#84727 | ||
|
||
struct Cell<Fg, Bg = Fg> { | ||
foreground: Color<Fg>, | ||
//~^ ERROR cannot find type `Color` in this scope | ||
background: Color<Bg>, | ||
//~^ ERROR cannot find type `Color` in this scope | ||
} | ||
|
||
trait Over<Bottom, Output> { | ||
fn over(self) -> Output; | ||
} | ||
|
||
impl<TopFg, TopBg, BottomFg, BottomBg, NewFg, NewBg> | ||
Over<Cell<BottomFg, BottomBg>, Cell<NewFg, NewBg>> for Cell<TopFg, TopBg> | ||
where | ||
Self: Over<Color<BottomBg>, Cell<NewFg>>, | ||
//~^ ERROR cannot find type `Color` in this scope | ||
{ | ||
fn over(self) -> Cell<NewFg> { | ||
//~^ ERROR mismatched types | ||
self.over(); | ||
} | ||
} | ||
|
||
impl<'b, TopFg, TopBg, BottomFg, BottomBg> Over<&Cell<BottomFg, BottomBg>, ()> | ||
for Cell<TopFg, TopBg> | ||
where | ||
Cell<TopFg, TopBg>: Over<Cell<BottomFg>, Cell<BottomFg>>, | ||
{ | ||
fn over(self) -> Cell<NewBg> { | ||
//~^ ERROR cannot find type `NewBg` in this scope | ||
self.over(); | ||
} | ||
} | ||
|
||
pub fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
error[E0412]: cannot find type `Color` in this scope | ||
--> $DIR/trait-selection-ice-84727.rs:5:17 | ||
| | ||
LL | foreground: Color<Fg>, | ||
| ^^^^^ not found in this scope | ||
|
||
error[E0412]: cannot find type `Color` in this scope | ||
--> $DIR/trait-selection-ice-84727.rs:7:17 | ||
| | ||
LL | background: Color<Bg>, | ||
| ^^^^^ not found in this scope | ||
|
||
error[E0412]: cannot find type `Color` in this scope | ||
--> $DIR/trait-selection-ice-84727.rs:18:16 | ||
| | ||
LL | Self: Over<Color<BottomBg>, Cell<NewFg>>, | ||
| ^^^^^ not found in this scope | ||
|
||
error[E0412]: cannot find type `NewBg` in this scope | ||
--> $DIR/trait-selection-ice-84727.rs:32:27 | ||
| | ||
LL | fn over(self) -> Cell<NewBg> { | ||
| ^^^^^ not found in this scope | ||
| | ||
help: you might be missing a type parameter | ||
| | ||
LL | impl<'b, TopFg, TopBg, BottomFg, BottomBg, NewBg> Over<&Cell<BottomFg, BottomBg>, ()> | ||
| +++++++ | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/trait-selection-ice-84727.rs:21:22 | ||
| | ||
LL | fn over(self) -> Cell<NewFg> { | ||
| ---- ^^^^^^^^^^^ expected `Cell<NewFg>`, found `()` | ||
| | | ||
| implicitly returns `()` as its body has no tail or `return` expression | ||
LL | | ||
LL | self.over(); | ||
| - help: remove this semicolon to return this value | ||
| | ||
= note: expected struct `Cell<NewFg>` | ||
found unit type `()` | ||
|
||
error: aborting due to 5 previous errors | ||
|
||
Some errors have detailed explanations: E0308, E0412. | ||
For more information about an error, try `rustc --explain E0308`. |