-
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.
Rollup merge of #113103 - cjgillot:normalize-inhabited, r=compiler-er…
…rors Normalize types when applying uninhabited predicate. Fixes #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() {} |