Closed
Description
#[deriving(PartialEq)]
pub enum Foo {
Bar,
Baz,
Quux
}
Generates:
// rustc --pretty expanded test.rs
#![feature(phase)]
#![no_std]
#![feature(globs)]
#[phase(plugin, link)]
extern crate std = "std";
extern crate rt = "native";
#[prelude_import]
use std::prelude::*;
pub enum Foo { Bar, Baz, Quux, }
#[automatically_derived]
impl ::std::cmp::PartialEq for Foo {
#[inline]
fn eq(&self, __arg_0: &Foo) -> ::bool {
match (&*self, &*__arg_0) {
(&Bar, &Bar) => true,
(&Baz, &Baz) => true,
(&Quux, &Quux) => true,
_ => {
let __self_vi =
match *self {
Bar(..) => 0u,
Baz(..) => 1u,
Quux(..) => 2u,
};
let __arg_1_vi =
match *__arg_0 {
Bar(..) => 0u,
Baz(..) => 1u,
Quux(..) => 2u,
};
false
}
}
}
#[inline]
fn ne(&self, __arg_0: &Foo) -> ::bool {
match (&*self, &*__arg_0) {
(&Bar, &Bar) => false,
(&Baz, &Baz) => false,
(&Quux, &Quux) => false,
_ => {
let __self_vi =
match *self {
Bar(..) => 0u,
Baz(..) => 1u,
Quux(..) => 2u,
};
let __arg_1_vi =
match *__arg_0 {
Bar(..) => 0u,
Baz(..) => 1u,
Quux(..) => 2u,
};
true
}
}
}
}
The following code copied from above is unused:
let __self_vi =
match *self {
Bar(..) => 0u,
Baz(..) => 1u,
Quux(..) => 2u,
};
let __arg_1_vi =
match *__arg_0 {
Bar(..) => 0u,
Baz(..) => 1u,
Quux(..) => 2u,
};