add test for ICE Where clause Binder(..)
was applicable to Obligation(..)
but now is not
Fixes https://github.com/rust-lang/rust/issues/84727
This commit is contained in:
parent
5f95fc1dff
commit
6fe555549b
38
tests/ui/traits/trait-selection-ice-84727.rs
Normal file
38
tests/ui/traits/trait-selection-ice-84727.rs
Normal file
@ -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() {}
|
47
tests/ui/traits/trait-selection-ice-84727.stderr
Normal file
47
tests/ui/traits/trait-selection-ice-84727.stderr
Normal file
@ -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`.
|
Loading…
x
Reference in New Issue
Block a user