Skip to content

Commit f6b57e4

Browse files
committed
wrong-hashset-issue-42918.rs
1 parent 14f84f3 commit f6b57e4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tests/ui/hashmap/hashset-enum-variant.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
1+
//! Checks that `HashSet` initialization with enum variants correctly includes only
2+
//! specified variants, preventing platform-specific bugs
3+
//! where all enum variants were mistakenly included
4+
//!
5+
//! Regression test for <https://github.com/rust-lang/rust/issues/42918>
6+
17
//@ run-pass
2-
//
3-
#![allow(dead_code)]
48
//@ compile-flags: -O
59

10+
#![allow(dead_code)]
11+
612
use std::collections::HashSet;
713

814
#[derive(PartialEq, Debug, Hash, Eq, Clone, PartialOrd, Ord)]
915
enum MyEnum {
1016
E0,
11-
1217
E1,
13-
1418
E2,
1519
E3,
1620
E4,
17-
1821
E5,
1922
E6,
2023
E7,
2124
}
2225

23-
2426
fn main() {
2527
use MyEnum::*;
2628
let s: HashSet<_> = [E4, E1].iter().cloned().collect();

0 commit comments

Comments
 (0)