add test for #104779 opaque types, patterns and subtyping ICE: IndexMap: key not found
Fixes #104779
This commit is contained in:
parent
2f9a240b91
commit
e54bff7109
@ -0,0 +1,26 @@
|
|||||||
|
// issue: rust-lang/rust#104779
|
||||||
|
// ICE region infer, IndexMap: key not found
|
||||||
|
|
||||||
|
struct Inv<'a>(&'a mut &'a ());
|
||||||
|
enum Foo<T> {
|
||||||
|
Bar,
|
||||||
|
Var(T),
|
||||||
|
}
|
||||||
|
type Subtype = Foo<for<'a, 'b> fn(Inv<'a>, Inv<'b>)>;
|
||||||
|
type Supertype = Foo<for<'a> fn(Inv<'a>, Inv<'a>)>;
|
||||||
|
|
||||||
|
fn foo() -> impl Sized {
|
||||||
|
//~^ WARN function cannot return without recursing
|
||||||
|
loop {
|
||||||
|
match foo() {
|
||||||
|
//~^ ERROR higher-ranked subtype error
|
||||||
|
//~^^ ERROR higher-ranked subtype error
|
||||||
|
Subtype::Bar => (),
|
||||||
|
//~^ ERROR higher-ranked subtype error
|
||||||
|
//~^^ ERROR higher-ranked subtype error
|
||||||
|
Supertype::Var(x) => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn main() {}
|
@ -0,0 +1,42 @@
|
|||||||
|
warning: function cannot return without recursing
|
||||||
|
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:12:1
|
||||||
|
|
|
||||||
|
LL | fn foo() -> impl Sized {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
|
||||||
|
...
|
||||||
|
LL | match foo() {
|
||||||
|
| ----- recursive call site
|
||||||
|
|
|
||||||
|
= help: a `loop` may express intention better if this is on purpose
|
||||||
|
= note: `#[warn(unconditional_recursion)]` on by default
|
||||||
|
|
||||||
|
error: higher-ranked subtype error
|
||||||
|
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:15:15
|
||||||
|
|
|
||||||
|
LL | match foo() {
|
||||||
|
| ^^^^^
|
||||||
|
|
||||||
|
error: higher-ranked subtype error
|
||||||
|
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:15:15
|
||||||
|
|
|
||||||
|
LL | match foo() {
|
||||||
|
| ^^^^^
|
||||||
|
|
|
||||||
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||||
|
|
||||||
|
error: higher-ranked subtype error
|
||||||
|
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:18:13
|
||||||
|
|
|
||||||
|
LL | Subtype::Bar => (),
|
||||||
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: higher-ranked subtype error
|
||||||
|
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:18:13
|
||||||
|
|
|
||||||
|
LL | Subtype::Bar => (),
|
||||||
|
| ^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||||
|
|
||||||
|
error: aborting due to 4 previous errors; 1 warning emitted
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user