Skip to content

Commit f5bda0d

Browse files
committed
---
yaml --- r: 149039 b: refs/heads/try2 c: c7710cd h: refs/heads/master i: 149037: 0ac3eda 149035: 8a4b022 149031: 5ac67b8 149023: 2e87924 v: v3
1 parent 0d2941b commit f5bda0d

File tree

8 files changed

+25
-19
lines changed

8 files changed

+25
-19
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: d433b80e026960b28ba660ebdb09175237e02e05
8+
refs/heads/try2: c7710cdf4563533b211a16cb02a9b4cb70ed3ca9
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/guide-ffi.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ use std::cast;
178178
use std::libc::{c_void, size_t, malloc, free};
179179
use std::mem;
180180
use std::ptr;
181-
use std::unstable::intrinsics;
182181
183182
// Define a wrapper around the handle returned by the foreign code.
184183
// Unique<T> has the same semantics as ~T
@@ -200,7 +199,7 @@ impl<T: Send> Unique<T> {
200199
// `*ptr` is uninitialized, and `*ptr = value` would attempt to destroy it
201200
// move_val_init moves a value into this memory without
202201
// attempting to drop the original value.
203-
intrinsics::move_val_init(&mut *ptr, value);
202+
mem::move_val_init(&mut *ptr, value);
204203
Unique{ptr: ptr}
205204
}
206205
}

branches/try2/src/libarena/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ use collections::list;
3232
use std::cast::{transmute, transmute_mut, transmute_mut_region};
3333
use std::cast;
3434
use std::cell::{Cell, RefCell};
35+
use std::mem;
3536
use std::num;
3637
use std::ptr;
3738
use std::kinds::marker;
38-
use std::mem;
3939
use std::rc::Rc;
4040
use std::rt::global_heap;
4141
use std::unstable::intrinsics::{TyDesc, get_tydesc};
@@ -216,7 +216,7 @@ impl Arena {
216216
unsafe {
217217
let ptr = self.alloc_pod_inner(mem::size_of::<T>(), mem::min_align_of::<T>());
218218
let ptr: *mut T = transmute(ptr);
219-
intrinsics::move_val_init(&mut (*ptr), op());
219+
mem::move_val_init(&mut (*ptr), op());
220220
return transmute(ptr);
221221
}
222222
}
@@ -278,7 +278,7 @@ impl Arena {
278278
// has *not* been initialized yet.
279279
*ty_ptr = transmute(tydesc);
280280
// Actually initialize it
281-
intrinsics::move_val_init(&mut(*ptr), op());
281+
mem::move_val_init(&mut(*ptr), op());
282282
// Now that we are done, update the tydesc to indicate that
283283
// the object is there.
284284
*ty_ptr = bitpack_tydesc_ptr(tydesc, true);
@@ -379,7 +379,7 @@ impl TypedArenaChunk {
379379
let mut chunk = unsafe {
380380
let chunk = global_heap::exchange_malloc(size);
381381
let mut chunk: ~TypedArenaChunk = cast::transmute(chunk);
382-
intrinsics::move_val_init(&mut chunk.next, next);
382+
mem::move_val_init(&mut chunk.next, next);
383383
chunk
384384
};
385385

@@ -466,7 +466,7 @@ impl<T> TypedArena<T> {
466466
}
467467

468468
let ptr: &'a mut T = cast::transmute(this.ptr);
469-
intrinsics::move_val_init(ptr, object);
469+
mem::move_val_init(ptr, object);
470470
this.ptr = this.ptr.offset(1);
471471
let ptr: &'a T = ptr;
472472
ptr

branches/try2/src/libcollections/priority_queue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#[allow(missing_doc)];
1414

1515
use std::clone::Clone;
16-
use std::unstable::intrinsics::{move_val_init, init};
16+
use std::mem::{move_val_init, init};
1717
use std::util::{replace, swap};
1818
use std::vec;
1919

branches/try2/src/libstd/mem.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ pub unsafe fn uninit<T>() -> T {
8383
intrinsics::uninit()
8484
}
8585

86+
/// Move a value to an uninitialized memory location.
87+
///
88+
/// Drop glue is not run on the destination.
89+
#[inline]
90+
pub unsafe fn move_val_init<T>(dst: &mut T, src: T) {
91+
intrinsics::move_val_init(dst, src)
92+
}
93+
94+
8695
#[cfg(test)]
8796
mod tests {
8897
use mem::*;

branches/try2/src/libstd/vec.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ use mem::size_of;
120120
use kinds::marker;
121121
use uint;
122122
use unstable::finally::Finally;
123-
use unstable::intrinsics;
124123
use unstable::raw::{Repr, Slice, Vec};
125124
use util;
126125

@@ -137,7 +136,7 @@ pub fn from_fn<T>(n_elts: uint, op: |uint| -> T) -> ~[T] {
137136
let mut i: uint = 0u;
138137
(|| {
139138
while i < n_elts {
140-
intrinsics::move_val_init(&mut(*ptr::mut_offset(p, i as int)), op(i));
139+
mem::move_val_init(&mut(*ptr::mut_offset(p, i as int)), op(i));
141140
i += 1u;
142141
}
143142
}).finally(|| {
@@ -164,7 +163,7 @@ pub fn from_elem<T:Clone>(n_elts: uint, t: T) -> ~[T] {
164163
let mut i = 0u;
165164
(|| {
166165
while i < n_elts {
167-
intrinsics::move_val_init(&mut(*ptr::mut_offset(p, i as int)), t.clone());
166+
mem::move_val_init(&mut(*ptr::mut_offset(p, i as int)), t.clone());
168167
i += 1u;
169168
}
170169
}).finally(|| {
@@ -1495,7 +1494,7 @@ impl<T> OwnedVector<T> for ~[T] {
14951494
(**repr).fill += mem::nonzero_size_of::<T>();
14961495
let p = to_unsafe_ptr(&((**repr).data));
14971496
let p = ptr::offset(p, fill as int) as *mut T;
1498-
intrinsics::move_val_init(&mut(*p), t);
1497+
mem::move_val_init(&mut(*p), t);
14991498
}
15001499
}
15011500

@@ -1552,7 +1551,7 @@ impl<T> OwnedVector<T> for ~[T] {
15521551
ptr::copy_memory(p.offset(1), p, len - i);
15531552
// Write it in, overwriting the first copy of the `i`th
15541553
// element.
1555-
intrinsics::move_val_init(&mut *p, x);
1554+
mem::move_val_init(&mut *p, x);
15561555
self.set_len(len + 1);
15571556
}
15581557
}
@@ -2397,7 +2396,7 @@ impl<'a,T> MutableVector<'a, T> for &'a mut [T] {
23972396

23982397
#[inline]
23992398
unsafe fn init_elem(self, i: uint, val: T) {
2400-
intrinsics::move_val_init(&mut (*self.as_mut_ptr().offset(i as int)), val);
2399+
mem::move_val_init(&mut (*self.as_mut_ptr().offset(i as int)), val);
24012400
}
24022401

24032402
#[inline]

branches/try2/src/libstd/vec_ng.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ use clone::Clone;
1717
use iter::{DoubleEndedIterator, Iterator};
1818
use num::CheckedMul;
1919
use container::Container;
20-
use mem::size_of;
20+
use mem::{size_of, move_val_init};
2121
use cast::{forget, transmute};
2222
use rt::global_heap::{malloc_raw, realloc_raw};
2323
use vec::{ImmutableVector, Items, MutableVector};
2424
use unstable::raw::Slice;
2525
use ptr::{offset, read_ptr};
2626
use libc::{free, c_void};
27-
use unstable::intrinsics::move_val_init;
2827

2928
pub struct Vec<T> {
3029
priv len: uint,

branches/try2/src/test/run-pass/type-use-i1-versus-i8.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::unstable;
11+
use std::mem;
1212

1313
pub fn main() {
1414
unsafe {
1515
let mut x: bool = false;
1616
// this line breaks it
17-
unstable::intrinsics::move_val_init(&mut x, false);
17+
mem::move_val_init(&mut x, false);
1818
}
1919
}

0 commit comments

Comments
 (0)