rust/tests/ui/structs-enums/compare-generic-enums.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
291 B
Rust
Raw Normal View History

// run-pass
#![allow(non_camel_case_types)]
type an_int = isize;
fn cmp(x: Option<an_int>, y: Option<isize>) -> bool {
x == y
}
pub fn main() {
2013-03-29 01:39:09 +00:00
assert!(!cmp(Some(3), None));
assert!(!cmp(Some(3), Some(4)));
assert!(cmp(Some(3), Some(3)));
assert!(cmp(None, None));
}