Skip to content

Commit

Permalink
rustc_codegen_ssa: derive copy and clone for various enums
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiasko committed May 25, 2022
1 parent 8f0f6e3 commit 4620b9f
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,6 @@ enum ExtremumOperation {
Min,
}

trait EnumClone {
fn clone(&self) -> Self;
}

impl EnumClone for AtomicOrdering {
fn clone(&self) -> Self {
match *self {
AtomicOrdering::Unordered => AtomicOrdering::Unordered,
AtomicOrdering::Relaxed => AtomicOrdering::Relaxed,
AtomicOrdering::Acquire => AtomicOrdering::Acquire,
AtomicOrdering::Release => AtomicOrdering::Release,
AtomicOrdering::AcquireRelease => AtomicOrdering::AcquireRelease,
AtomicOrdering::SequentiallyConsistent => AtomicOrdering::SequentiallyConsistent,
}
}
}

pub struct Builder<'a: 'gcc, 'gcc, 'tcx> {
pub cx: &'a CodegenCx<'gcc, 'tcx>,
pub block: Block<'gcc>,
Expand All @@ -102,9 +85,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
match order {
// TODO(antoyo): does this make sense?
AtomicOrdering::AcquireRelease | AtomicOrdering::Release => AtomicOrdering::Acquire,
_ => order.clone(),
_ => order,
};
let previous_value = self.atomic_load(dst.get_type(), dst, load_ordering.clone(), Size::from_bytes(size));
let previous_value = self.atomic_load(dst.get_type(), dst, load_ordering, Size::from_bytes(size));
let previous_var = func.new_local(None, previous_value.get_type(), "previous_value");
let return_value = func.new_local(None, previous_value.get_type(), "return_value");
self.llbb().add_assignment(None, previous_var, previous_value);
Expand Down

0 comments on commit 4620b9f

Please sign in to comment.