forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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 rust-lang#104779 opaque types, patterns and subtyping IC…
…E: IndexMap: key not found Fixes rust-lang#104779
- Loading branch information
1 parent
6c71e59
commit 2b4ca91
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.rs
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,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() {} |
42 changes: 42 additions & 0 deletions
42
tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.stderr
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,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 | ||
|