Skip to content

Commit 3b35d1c

Browse files
committed
---
yaml --- r: 50471 b: refs/heads/auto c: c4d2b79 h: refs/heads/master i: 50469: dc5de11 50467: f428ace 50463: a4af562 v: v3
1 parent 1fdb011 commit 3b35d1c

File tree

7 files changed

+28
-26
lines changed

7 files changed

+28
-26
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 397a47852849ac2e286508f2315e695f5d8168cf
17+
refs/heads/auto: c4d2b7999a12b8c9111ae1d897c476c052ddc05a
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167

branches/auto/src/libcore/at_vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ pub mod raw {
208208
*/
209209
#[inline(always)]
210210
pub unsafe fn set_len<T>(v: @[T], new_len: uint) {
211-
let repr: **mut VecRepr = ::cast::reinterpret_cast(&addr_of(&v));
211+
let repr: **VecRepr = ::cast::reinterpret_cast(&addr_of(&v));
212212
(**repr).unboxed.fill = new_len * sys::size_of::<T>();
213213
}
214214

@@ -226,7 +226,7 @@ pub mod raw {
226226

227227
#[inline(always)] // really pretty please
228228
pub unsafe fn push_fast<T>(v: &mut @[T], initval: T) {
229-
let repr: **mut VecRepr = ::cast::reinterpret_cast(&v);
229+
let repr: **VecRepr = ::cast::reinterpret_cast(&v);
230230
let fill = (**repr).unboxed.fill;
231231
(**repr).unboxed.fill += sys::size_of::<T>();
232232
let p = addr_of(&((**repr).unboxed.data));

branches/auto/src/libcore/cell.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! A mutable, nullable memory location
1212
13-
use cast::transmute_mut;
13+
use cast::transmute;
1414
use prelude::*;
1515

1616
/*
@@ -20,12 +20,16 @@ Similar to a mutable option type, but friendlier.
2020
*/
2121

2222
pub struct Cell<T> {
23-
value: Option<T>
23+
mut value: Option<T>
2424
}
2525

2626
impl<T:cmp::Eq> cmp::Eq for Cell<T> {
2727
fn eq(&self, other: &Cell<T>) -> bool {
28-
(self.value) == (other.value)
28+
unsafe {
29+
let frozen_self: &Option<T> = transmute(&mut self.value);
30+
let frozen_other: &Option<T> = transmute(&mut other.value);
31+
frozen_self == frozen_other
32+
}
2933
}
3034
fn ne(&self, other: &Cell<T>) -> bool { !self.eq(other) }
3135
}
@@ -42,7 +46,6 @@ pub fn empty_cell<T>() -> Cell<T> {
4246
pub impl<T> Cell<T> {
4347
/// Yields the value, failing if the cell is empty.
4448
fn take(&self) -> T {
45-
let mut self = unsafe { transmute_mut(self) };
4649
if self.is_empty() {
4750
fail!(~"attempt to take an empty cell");
4851
}
@@ -54,7 +57,6 @@ pub impl<T> Cell<T> {
5457
5558
/// Returns the value, failing if the cell is full.
5659
fn put_back(&self, value: T) {
57-
let mut self = unsafe { transmute_mut(self) };
5860
if !self.is_empty() {
5961
fail!(~"attempt to put a value back into a full cell");
6062
}

branches/auto/src/libcore/str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,8 +2274,8 @@ pub mod raw {
22742274

22752275
/// Sets the length of the string and adds the null terminator
22762276
pub unsafe fn set_len(v: &mut ~str, new_len: uint) {
2277-
let v: **mut vec::raw::VecRepr = cast::transmute(v);
2278-
let repr: *mut vec::raw::VecRepr = *v;
2277+
let v: **vec::raw::VecRepr = cast::transmute(v);
2278+
let repr: *vec::raw::VecRepr = *v;
22792279
(*repr).unboxed.fill = new_len + 1u;
22802280
let null = ptr::mut_offset(cast::transmute(&((*repr).unboxed.data)),
22812281
new_len);

branches/auto/src/libcore/unstable.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,21 @@ fn compare_and_swap(address: &mut int, oldval: int, newval: int) -> bool {
106106
****************************************************************************/
107107

108108
struct ArcData<T> {
109-
count: libc::intptr_t,
109+
mut count: libc::intptr_t,
110110
// FIXME(#3224) should be able to make this non-option to save memory
111-
data: Option<T>,
111+
mut data: Option<T>,
112112
}
113113

114114
struct ArcDestruct<T> {
115-
data: *libc::c_void,
115+
mut data: *libc::c_void,
116116
}
117117

118118
#[unsafe_destructor]
119119
impl<T> Drop for ArcDestruct<T>{
120120
fn finalize(&self) {
121121
unsafe {
122122
do task::unkillable {
123-
let mut data: ~ArcData<T> = cast::reinterpret_cast(&self.data);
123+
let data: ~ArcData<T> = cast::reinterpret_cast(&self.data);
124124
let new_count =
125125
intrinsics::atomic_xsub(&mut data.count, 1) - 1;
126126
assert!(new_count >= 0);
@@ -185,7 +185,7 @@ pub unsafe fn get_shared_immutable_state<'a,T:Owned>(
185185
pub unsafe fn clone_shared_mutable_state<T:Owned>(rc: &SharedMutableState<T>)
186186
-> SharedMutableState<T> {
187187
unsafe {
188-
let mut ptr: ~ArcData<T> = cast::reinterpret_cast(&(*rc).data);
188+
let ptr: ~ArcData<T> = cast::reinterpret_cast(&(*rc).data);
189189
let new_count = intrinsics::atomic_xadd(&mut ptr.count, 1) + 1;
190190
assert!(new_count >= 2);
191191
cast::forget(ptr);
@@ -252,15 +252,15 @@ pub impl LittleLock {
252252
}
253253
}
254254

255-
struct ExData<T> { lock: LittleLock, failed: bool, data: T, }
255+
struct ExData<T> { lock: LittleLock, mut failed: bool, mut data: T, }
256256
/**
257257
* An arc over mutable data that is protected by a lock. For library use only.
258258
*/
259259
pub struct Exclusive<T> { x: SharedMutableState<ExData<T>> }
260260

261261
pub fn exclusive<T:Owned>(user_data: T) -> Exclusive<T> {
262262
let data = ExData {
263-
lock: LittleLock(), failed: false, data: user_data
263+
lock: LittleLock(), mut failed: false, mut data: user_data
264264
};
265265
Exclusive { x: unsafe { shared_mutable_state(data) } }
266266
}

branches/auto/src/libcore/vec.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ pub fn push<T>(v: &mut ~[T], initval: T) {
633633
// This doesn't bother to make sure we have space.
634634
#[inline(always)] // really pretty please
635635
unsafe fn push_fast<T>(v: &mut ~[T], initval: T) {
636-
let repr: **mut raw::VecRepr = ::cast::transmute(v);
636+
let repr: **raw::VecRepr = ::cast::transmute(v);
637637
let fill = (**repr).unboxed.fill;
638638
(**repr).unboxed.fill += sys::nonzero_size_of::<T>();
639639
let p = addr_of(&((**repr).unboxed.data));
@@ -2148,8 +2148,8 @@ pub unsafe fn from_buf<T>(ptr: *T, elts: uint) -> ~[T] {
21482148

21492149
/// The internal 'unboxed' representation of a vector
21502150
pub struct UnboxedVecRepr {
2151-
fill: uint,
2152-
alloc: uint,
2151+
mut fill: uint,
2152+
mut alloc: uint,
21532153
data: u8
21542154
}
21552155

@@ -2171,8 +2171,8 @@ pub mod raw {
21712171
}
21722172

21732173
pub struct SliceRepr {
2174-
data: *u8,
2175-
len: uint
2174+
mut data: *u8,
2175+
mut len: uint
21762176
}
21772177

21782178
/**
@@ -2184,7 +2184,7 @@ pub mod raw {
21842184
*/
21852185
#[inline(always)]
21862186
pub unsafe fn set_len<T>(v: &mut ~[T], new_len: uint) {
2187-
let repr: **mut VecRepr = ::cast::transmute(v);
2187+
let repr: **VecRepr = ::cast::transmute(v);
21882188
(**repr).unboxed.fill = new_len * sys::nonzero_size_of::<T>();
21892189
}
21902190

branches/auto/src/libstd/net_url.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use core::to_str::ToStr;
2525
use core::to_str;
2626
use core::uint;
2727

28-
#[deriving(Eq)]
28+
#[deriving(Clone, Eq)]
2929
struct Url {
3030
scheme: ~str,
3131
user: Option<UserInfo>,
@@ -36,7 +36,7 @@ struct Url {
3636
fragment: Option<~str>
3737
}
3838

39-
#[deriving(Eq)]
39+
#[deriving(Clone, Eq)]
4040
struct UserInfo {
4141
user: ~str,
4242
pass: Option<~str>
@@ -398,7 +398,7 @@ pub fn get_scheme(rawurl: &str) -> Result<(~str, ~str), ~str> {
398398
return Err(~"url: Scheme must be terminated with a colon.");
399399
}
400400

401-
#[deriving(Eq)]
401+
#[deriving(Clone, Eq)]
402402
enum Input {
403403
Digit, // all digits
404404
Hex, // digits and letters a-f

0 commit comments

Comments
 (0)