]> git.lizzy.rs Git - rust.git/blob - src/test/ui/enum-discriminant/issue-46519.rs
Auto merge of #106349 - LeSeulArtichaut:dyn-star-tracking-issue, r=jackh726
[rust.git] / src / test / ui / enum-discriminant / issue-46519.rs
1 // run-pass
2 // compile-flags:--test -O
3
4 // needs-unwind
5
6 #[test]
7 #[should_panic(expected = "creating inhabited type")]
8 fn test() {
9     FontLanguageOverride::system_font(SystemFont::new());
10 }
11
12 pub enum FontLanguageOverride {
13     Normal,
14     Override(&'static str),
15     System(SystemFont)
16 }
17
18 pub enum SystemFont {}
19
20 impl FontLanguageOverride {
21     fn system_font(f: SystemFont) -> Self {
22         FontLanguageOverride::System(f)
23     }
24 }
25
26 impl SystemFont {
27     fn new() -> Self {
28         panic!("creating inhabited type")
29     }
30 }