Skip to content

Instantly share code, notes, and snippets.

@sunnyone
Created December 15, 2017 14:51
Show Gist options
  • Save sunnyone/5bbd41ffe29c1ec3ff26ccda24834359 to your computer and use it in GitHub Desktop.
Save sunnyone/5bbd41ffe29c1ec3ff26ccda24834359 to your computer and use it in GitHub Desktop.
PartialEq generated
// #[derive(PartialEq)]
// pub enum Option2<T> {
// None,
// Some(T),
// }
// $ rustc option.rs -Z unstable-options --pretty=expanded
#![feature(prelude_import)]
#![no_std]
#[prelude_import]
use std::prelude::v1::*;
#[macro_use]
extern crate std as std;
pub enum Option2<T> { None, Some(T), }
#[automatically_derived]
#[allow(unused_qualifications)]
impl <T: ::std::cmp::PartialEq> ::std::cmp::PartialEq for Option2<T> {
#[inline]
fn eq(&self, __arg_0: &Option2<T>) -> bool {
{
let __self_vi =
unsafe { ::std::intrinsics::discriminant_value(&*self) } as
i32;
let __arg_1_vi =
unsafe { ::std::intrinsics::discriminant_value(&*__arg_0) } as
i32;
if true && __self_vi == __arg_1_vi {
match (&*self, &*__arg_0) {
(&Option2::None, &Option2::None) => true,
(&Option2::Some(ref __self_0),
&Option2::Some(ref __arg_1_0)) =>
true && (*__self_0) == (*__arg_1_0),
_ => unsafe { ::std::intrinsics::unreachable() }
}
} else { false }
}
}
#[inline]
fn ne(&self, __arg_0: &Option2<T>) -> bool {
{
let __self_vi =
unsafe { ::std::intrinsics::discriminant_value(&*self) } as
i32;
let __arg_1_vi =
unsafe { ::std::intrinsics::discriminant_value(&*__arg_0) } as
i32;
if true && __self_vi == __arg_1_vi {
match (&*self, &*__arg_0) {
(&Option2::None, &Option2::None) => false,
(&Option2::Some(ref __self_0),
&Option2::Some(ref __arg_1_0)) =>
false || (*__self_0) != (*__arg_1_0),
_ => unsafe { ::std::intrinsics::unreachable() }
}
} else { true }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment