Skip to content

Commit

Permalink
Clean up marker types and Unsafe initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed Mar 21, 2014
1 parent 181875c commit 1d98fe1
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions src/libstd/cell.rs
Expand Up @@ -22,19 +22,17 @@ use ty::Unsafe;
/// A mutable memory location that admits only `Pod` data.
pub struct Cell<T> {
priv value: Unsafe<T>,
priv marker1: marker::InvariantType<T>,
priv marker2: marker::NoFreeze,
priv marker3: marker::NoShare,
priv marker1: marker::NoFreeze,
priv marker2: marker::NoShare,
}

impl<T:Pod> Cell<T> {
/// Creates a new `Cell` containing the given value.
pub fn new(value: T) -> Cell<T> {
Cell {
value: Unsafe{value: value, marker1: marker::InvariantType::<T>},
marker1: marker::InvariantType::<T>,
marker2: marker::NoFreeze,
marker3: marker::NoShare,
value: Unsafe::new(value),
marker1: marker::NoFreeze,
marker2: marker::NoShare,
}
}

Expand Down Expand Up @@ -75,10 +73,9 @@ impl<T: fmt::Show> fmt::Show for Cell<T> {
pub struct RefCell<T> {
priv value: Unsafe<T>,
priv borrow: BorrowFlag,
priv marker1: marker::InvariantType<T>,
priv marker2: marker::NoFreeze,
priv marker3: marker::NoPod,
priv marker4: marker::NoShare,
priv marker1: marker::NoFreeze,
priv marker2: marker::NoPod,
priv marker3: marker::NoShare,
}

// Values [1, MAX-1] represent the number of `Ref` active
Expand All @@ -91,11 +88,10 @@ impl<T> RefCell<T> {
/// Create a new `RefCell` containing `value`
pub fn new(value: T) -> RefCell<T> {
RefCell {
marker1: marker::InvariantType::<T>,
marker2: marker::NoFreeze,
marker3: marker::NoPod,
marker4: marker::NoShare,
value: Unsafe{value: value, marker1: marker::InvariantType::<T>},
marker1: marker::NoFreeze,
marker2: marker::NoPod,
marker3: marker::NoShare,
value: Unsafe::new(value),
borrow: UNUSED,
}
}
Expand Down

9 comments on commit 1d98fe1

@bors
Copy link
Contributor

@bors bors commented on 1d98fe1 Mar 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at sfackler@1d98fe1

@bors
Copy link
Contributor

@bors bors commented on 1d98fe1 Mar 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging sfackler/rust/clean-refcell = 1d98fe1 into auto

@bors
Copy link
Contributor

@bors bors commented on 1d98fe1 Mar 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sfackler/rust/clean-refcell = 1d98fe1 merged ok, testing candidate = 20d428af

@bors
Copy link
Contributor

@bors bors commented on 1d98fe1 Mar 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 1d98fe1 Mar 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at sfackler@1d98fe1

@bors
Copy link
Contributor

@bors bors commented on 1d98fe1 Mar 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging sfackler/rust/clean-refcell = 1d98fe1 into auto

@bors
Copy link
Contributor

@bors bors commented on 1d98fe1 Mar 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sfackler/rust/clean-refcell = 1d98fe1 merged ok, testing candidate = 30165e0

@bors
Copy link
Contributor

@bors bors commented on 1d98fe1 Mar 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 1d98fe1 Mar 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 30165e0

Please sign in to comment.