forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#113103 - cjgillot:normalize-inhabited, r=co…
…mpiler-errors Normalize types when applying uninhabited predicate. Fixes rust-lang#112997
- Loading branch information
Showing
2 changed files
with
44 additions
and
1 deletion.
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
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,32 @@ | ||
// check-pass | ||
|
||
#![feature(never_type, exhaustive_patterns)] | ||
|
||
trait Tag { | ||
type TagType; | ||
} | ||
|
||
enum Keep {} | ||
enum Erase {} | ||
|
||
impl Tag for Keep { | ||
type TagType = (); | ||
} | ||
|
||
impl Tag for Erase { | ||
type TagType = !; | ||
} | ||
|
||
enum TagInt<T: Tag> { | ||
Untagged(i32), | ||
Tagged(T::TagType, i32) | ||
} | ||
|
||
fn test(keep: TagInt<Keep>, erase: TagInt<Erase>) { | ||
match erase { | ||
TagInt::Untagged(_) => (), | ||
TagInt::Tagged(_, _) => () | ||
}; | ||
} | ||
|
||
fn main() {} |