I have problem with my code, it behaves in different ways,
if compiled with different versions of rustc
.
Here simplified code (the real one compiled and run on android, and f
and main
in different crates):
use std::collections::HashSet;
#[derive(PartialEq, Debug, Hash, Eq, Clone)]
enum SentenceType {
None,
AAM,
//...many
RMC,
GGA,
//..many
}
fn f(s: HashSet<SentenceType>) {
println!("s: {:?}", s);
}
fn main() {
f([SentenceType::RMC, SentenceType::GGA]
.iter()
.cloned()
.collect());
}
if I compiled with stable (rustc 1.18.0 (03fc9d622 2017-06-06)
),
all works fine, and it prints s: {GGA, RMC}
,
but if code compiled with beta or nightly (.19.0-beta.2 (a175ee509 2017-06-15)
/1.20.0-nightly (622e7e648 2017-06-21)
) it prints:
s: {XTE, HTD, HMR, LRI, BWW, XTR, ZDA, RMC, LRF, TTM, GXA, DBT, APB, ACA, ZTG, ALM, RMA, RTE, LR1, HDG, HDT, GLC, TRF, MLA, VHW, VLW, SFI, APA, DSC, RPM, STN, HSC, DSR, HDM, VDR, TLL, LR3, BWC, AAM, ASD, DSE, RSA, GSV, DBK, DPT, GBS, BWR, GNS, ROO, None, ACK, RMB, VSD, ZFO, AIR, OSD, GGA, MSS, ACS, LR2, TXT, HMS, ALR, DBS, SSD, MWD, ABK, FSI, DSI, GSA, OLN, LCD, DTM, GTD, GMP, BEC, MTW, DCN, ZDL, VBW, GLL, VPW, GRS, VWR, MWV, TLB, CUR, VTG, BOD, WNC}
I can fix problem for beta/nightly with such code:
let mut s = HashSet::new();
s.insert(SentenceType::RMC);
s.insert(SentenceType::GGA);
Because of problem can be reprodiciable only on Android/arm and in partly closed source program, before make attempt to dig it farther, I want to make sure:
- May be something wrong in code in question?
- Any known
rustc
bugs that may cause this? - Any hints to debug this?