Skip to content

Commit 8deac32

Browse files
committed
---
yaml --- r: 83178 b: refs/heads/auto c: 34d376f h: refs/heads/master v: v3
1 parent 7c5f053 commit 8deac32

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+329
-310
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: cf844abced94b74913985c7cffb6bd0b9a9b3445
16+
refs/heads/auto: 34d376f3cf234dc714fcfab7639affd3967dc16d
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/doc/po/ja/rust.md.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1842,7 +1842,7 @@ msgid ""
18421842
"The type parameters can also be explicitly supplied in a trailing [path]"
18431843
"(#paths) component after the function name. This might be necessary if there "
18441844
"is not sufficient context to determine the type parameters. For example, "
1845-
"`sys::size_of::<u32>() == 4`."
1845+
"`mem::size_of::<u32>() == 4`."
18461846
msgstr ""
18471847

18481848
#. type: Plain text

branches/auto/doc/po/ja/tutorial-ffi.md.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ msgid ""
327327
"impl<T: Send> Unique<T> {\n"
328328
" pub fn new(value: T) -> Unique<T> {\n"
329329
" unsafe {\n"
330-
" let ptr = malloc(std::sys::size_of::<T>() as size_t) as *mut T;\n"
330+
" let ptr = malloc(std::mem::size_of::<T>() as size_t) as *mut T;\n"
331331
" assert!(!ptr::is_null(ptr));\n"
332332
" // `*ptr` is uninitialized, and `*ptr = value` would attempt to destroy it\n"
333333
" intrinsics::move_val_init(&mut *ptr, value);\n"

branches/auto/doc/po/rust.md.pot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1842,7 +1842,7 @@ msgid ""
18421842
"The type parameters can also be explicitly supplied in a trailing [path]"
18431843
"(#paths) component after the function name. This might be necessary if there "
18441844
"is not sufficient context to determine the type parameters. For example, "
1845-
"`sys::size_of::<u32>() == 4`."
1845+
"`mem::size_of::<u32>() == 4`."
18461846
msgstr ""
18471847

18481848
#. type: Plain text

branches/auto/doc/po/tutorial-ffi.md.pot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ msgid ""
327327
"impl<T: Send> Unique<T> {\n"
328328
" pub fn new(value: T) -> Unique<T> {\n"
329329
" unsafe {\n"
330-
" let ptr = malloc(std::sys::size_of::<T>() as size_t) as *mut T;\n"
330+
" let ptr = malloc(std::mem::size_of::<T>() as size_t) as *mut T;\n"
331331
" assert!(!ptr::is_null(ptr));\n"
332332
" // `*ptr` is uninitialized, and `*ptr = value` would attempt to destroy it\n"
333333
" intrinsics::move_val_init(&mut *ptr, value);\n"

branches/auto/doc/rust.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ with `int`, and require the closure parameter to have type
975975
The type parameters can also be explicitly supplied in a trailing
976976
[path](#paths) component after the function name. This might be necessary
977977
if there is not sufficient context to determine the type parameters. For
978-
example, `sys::size_of::<u32>() == 4`.
978+
example, `mem::size_of::<u32>() == 4`.
979979

980980
Since a parameter type is opaque to the generic function, the set of
981981
operations that can be performed on it is limited. Values of parameter

branches/auto/doc/tutorial-ffi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ impl<T: Send> Unique<T> {
300300
#[inline(never)];
301301
302302
unsafe {
303-
let ptr = malloc(std::sys::size_of::<T>() as size_t) as *mut T;
303+
let ptr = malloc(std::mem::size_of::<T>() as size_t) as *mut T;
304304
assert!(!ptr::is_null(ptr));
305305
// `*ptr` is uninitialized, and `*ptr = value` would attempt to destroy it
306306
intrinsics::move_val_init(&mut *ptr, value);

branches/auto/src/libextra/arena.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use std::cast::{transmute, transmute_mut, transmute_mut_region};
4242
use std::cast;
4343
use std::num;
4444
use std::ptr;
45-
use std::sys;
45+
use std::mem;
4646
use std::uint;
4747
use std::vec;
4848
use std::unstable::intrinsics;
@@ -123,7 +123,7 @@ unsafe fn destroy_chunk(chunk: &Chunk) {
123123
let (tydesc, is_done) = un_bitpack_tydesc_ptr(*tydesc_data);
124124
let (size, align) = ((*tydesc).size, (*tydesc).align);
125125

126-
let after_tydesc = idx + sys::size_of::<*TyDesc>();
126+
let after_tydesc = idx + mem::size_of::<*TyDesc>();
127127

128128
let start = round_up_to(after_tydesc, align);
129129

@@ -134,7 +134,7 @@ unsafe fn destroy_chunk(chunk: &Chunk) {
134134
}
135135

136136
// Find where the next tydesc lives
137-
idx = round_up_to(start + size, sys::pref_align_of::<*TyDesc>());
137+
idx = round_up_to(start + size, mem::pref_align_of::<*TyDesc>());
138138
}
139139
}
140140

@@ -220,7 +220,7 @@ impl Arena {
220220
let head = transmute_mut_region(&mut self.head);
221221

222222
tydesc_start = head.fill;
223-
after_tydesc = head.fill + sys::size_of::<*TyDesc>();
223+
after_tydesc = head.fill + mem::size_of::<*TyDesc>();
224224
start = round_up_to(after_tydesc, align);
225225
end = start + n_bytes;
226226
}
@@ -230,7 +230,7 @@ impl Arena {
230230
}
231231

232232
let head = transmute_mut_region(&mut self.head);
233-
head.fill = round_up_to(end, sys::pref_align_of::<*TyDesc>());
233+
head.fill = round_up_to(end, mem::pref_align_of::<*TyDesc>());
234234

235235
//debug2!("idx = {}, size = {}, align = {}, fill = {}",
236236
// start, n_bytes, align, head.fill);

branches/auto/src/librustc/middle/trans/_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,7 @@ fn trans_match_inner(scope_cx: @mut Block,
19171917
Infallible
19181918
}
19191919
};
1920-
let lldiscr = discr_datum.to_zeroable_ref_llval(bcx);
1920+
let lldiscr = discr_datum.to_ref_llval(bcx);
19211921
compile_submatch(bcx, matches, [lldiscr], chk);
19221922

19231923
let mut arm_cxs = ~[];
@@ -1996,7 +1996,7 @@ pub fn store_local(bcx: @mut Block,
19961996
if bcx.sess().asm_comments() {
19971997
add_comment(bcx, "creating zeroable ref llval");
19981998
}
1999-
let llptr = init_datum.to_zeroable_ref_llval(bcx);
1999+
let llptr = init_datum.to_ref_llval(bcx);
20002000
return bind_irrefutable_pat(bcx, pat, llptr, BindLocal);
20012001
}
20022002
}

branches/auto/src/librustc/middle/trans/datum.rs

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -473,38 +473,25 @@ impl Datum {
473473
C_null(type_of::type_of(bcx.ccx(), self.ty).ptr_to())
474474
} else {
475475
let slot = alloc_ty(bcx, self.ty, "");
476+
// The store created here can be modified through a reference, for example:
477+
//
478+
// // free the old allocation, and change the pointer to a new allocation
479+
// fn foo(x: &mut ~u8) {
480+
// *x = ~5;
481+
// }
482+
//
483+
// foo(&mut ~5);
476484
Store(bcx, self.val, slot);
485+
// The old cleanup needs to be cancelled, in order for the destructor to observe
486+
// any changes made through the reference.
487+
self.cancel_clean(bcx);
488+
add_clean_temp_mem(bcx, slot, self.ty);
477489
slot
478490
}
479491
}
480492
}
481493
}
482494

483-
pub fn to_zeroable_ref_llval(&self, bcx: @mut Block) -> ValueRef {
484-
/*!
485-
* Returns a by-ref llvalue that can be zeroed in order to
486-
* cancel cleanup. This is a kind of hokey bridge used
487-
* to adapt to the match code. Please don't use it for new code.
488-
*/
489-
490-
match self.mode {
491-
// All by-ref datums are zeroable, even if we *could* just
492-
// cancel the cleanup.
493-
ByRef(_) => self.val,
494-
495-
// By value datums can't be zeroed (where would you store
496-
// the zero?) so we have to spill them. Add a temp cleanup
497-
// for this spilled value and cancel the cleanup on this
498-
// current value.
499-
ByValue => {
500-
let slot = self.to_ref_llval(bcx);
501-
self.cancel_clean(bcx);
502-
add_clean_temp_mem(bcx, slot, self.ty);
503-
slot
504-
}
505-
}
506-
}
507-
508495
pub fn appropriate_mode(&self, ccx: &mut CrateContext) -> DatumMode {
509496
/*! See the `appropriate_mode()` function */
510497

branches/auto/src/librustdoc/html/format.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,12 @@ impl fmt::Default for clean::Path {
115115
fn resolved_path(w: &mut io::Writer, id: ast::NodeId, p: &clean::Path,
116116
print_all: bool) {
117117
path(w, p, print_all,
118-
|_cache, loc| { Some("../".repeat(loc.len())) },
118+
|_cache, loc| {
119+
match p.segments[0].name.as_slice() {
120+
"super" => Some("../".repeat(loc.len() - 1)),
121+
_ => Some("../".repeat(loc.len())),
122+
}
123+
},
119124
|cache| {
120125
match cache.paths.find(&id) {
121126
None => None,

branches/auto/src/librustdoc/html/render.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ use std::rt::io::file::{FileInfo, DirectoryInfo};
4444
use std::rt::io::file;
4545
use std::rt::io;
4646
use std::rt::io::Reader;
47-
use std::os;
4847
use std::str;
4948
use std::task;
5049
use std::unstable::finally::Finally;
@@ -687,15 +686,7 @@ impl Context {
687686
Process(Context, clean::Item),
688687
}
689688
enum Progress { JobNew, JobDone }
690-
691-
let workers = match os::getenv("RUSTDOC_WORKERS") {
692-
Some(s) => {
693-
match from_str::<uint>(s) {
694-
Some(n) => n, None => fail2!("{} not a number", s)
695-
}
696-
}
697-
None => 10,
698-
};
689+
static WORKERS: int = 10;
699690

700691
let mut item = match crate.module.take() {
701692
Some(i) => i,
@@ -715,7 +706,7 @@ impl Context {
715706
// using the same channel/port. Through this, the crate is recursed on
716707
// in a hierarchical fashion, and parallelization is only achieved if
717708
// one node in the hierarchy has more than one child (very common).
718-
for i in range(0, workers) {
709+
for i in range(0, WORKERS) {
719710
let port = port.clone();
720711
let chan = chan.clone();
721712
let prog_chan = prog_chan.clone();
@@ -770,7 +761,7 @@ impl Context {
770761
if jobs == 0 { break }
771762
}
772763

773-
for _ in range(0, workers) {
764+
for _ in range(0, WORKERS) {
774765
chan.send(Die);
775766
}
776767
}

branches/auto/src/libstd/at_vec.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use clone::Clone;
1414
use container::Container;
1515
use iter::Iterator;
1616
use option::{Option, Some, None};
17-
use sys;
17+
use mem;
1818
use unstable::raw::Repr;
1919
use vec::{ImmutableVector, OwnedVector};
2020

@@ -26,7 +26,7 @@ use vec::{ImmutableVector, OwnedVector};
2626
pub fn capacity<T>(v: @[T]) -> uint {
2727
unsafe {
2828
let box = v.repr();
29-
(*box).data.alloc / sys::size_of::<T>()
29+
(*box).data.alloc / mem::size_of::<T>()
3030
}
3131
}
3232

@@ -160,7 +160,7 @@ pub mod raw {
160160
use cast::{transmute, transmute_copy};
161161
use libc;
162162
use ptr;
163-
use sys;
163+
use mem;
164164
use uint;
165165
use unstable::intrinsics::{move_val_init, TyDesc};
166166
use unstable::intrinsics;
@@ -176,7 +176,7 @@ pub mod raw {
176176
#[inline]
177177
pub unsafe fn set_len<T>(v: &mut @[T], new_len: uint) {
178178
let repr: *mut Box<Vec<T>> = cast::transmute_copy(v);
179-
(*repr).data.fill = new_len * sys::size_of::<T>();
179+
(*repr).data.fill = new_len * mem::size_of::<T>();
180180
}
181181

182182
/**
@@ -199,7 +199,7 @@ pub mod raw {
199199
unsafe fn push_fast<T>(v: &mut @[T], initval: T) {
200200
let repr: *mut Box<Vec<T>> = cast::transmute_copy(v);
201201
let amt = v.len();
202-
(*repr).data.fill += sys::size_of::<T>();
202+
(*repr).data.fill += mem::size_of::<T>();
203203
let p = ptr::offset(&(*repr).data.data as *T, amt as int) as *mut T;
204204
move_val_init(&mut(*p), initval);
205205
}
@@ -236,7 +236,7 @@ pub mod raw {
236236
unsafe {
237237
if n > (**ptr).data.alloc / (*ty).size {
238238
let alloc = n * (*ty).size;
239-
let total_size = alloc + sys::size_of::<Vec<()>>();
239+
let total_size = alloc + mem::size_of::<Vec<()>>();
240240
if alloc / (*ty).size != n || total_size < alloc {
241241
fail2!("vector size is too large: {}", n);
242242
}

branches/auto/src/libstd/cast.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! Unsafe casting functions
1212
1313
use ptr::RawPtr;
14-
use sys;
14+
use mem;
1515
use unstable::intrinsics;
1616

1717
/// Casts the value at `src` to U. The two types must have the same length.
@@ -21,7 +21,7 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
2121
let mut dest: U = intrinsics::uninit();
2222
let dest_ptr: *mut u8 = transmute(&mut dest);
2323
let src_ptr: *u8 = transmute(src);
24-
intrinsics::memcpy32(dest_ptr, src_ptr, sys::size_of::<U>() as u32);
24+
intrinsics::memcpy32(dest_ptr, src_ptr, mem::size_of::<U>() as u32);
2525
dest
2626
}
2727

@@ -32,7 +32,7 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
3232
let mut dest: U = intrinsics::uninit();
3333
let dest_ptr: *mut u8 = transmute(&mut dest);
3434
let src_ptr: *u8 = transmute(src);
35-
intrinsics::memcpy64(dest_ptr, src_ptr, sys::size_of::<U>() as u64);
35+
intrinsics::memcpy64(dest_ptr, src_ptr, mem::size_of::<U>() as u64);
3636
dest
3737
}
3838

branches/auto/src/libstd/cleanup.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn debug_mem() -> bool {
6868
/// Destroys all managed memory (i.e. @ boxes) held by the current task.
6969
pub unsafe fn annihilate() {
7070
use rt::local_heap::local_free;
71-
use sys;
71+
use mem;
7272
use managed;
7373

7474
let mut stats = AnnihilateStats {
@@ -115,7 +115,7 @@ pub unsafe fn annihilate() {
115115
if !uniq {
116116
stats.n_bytes_freed +=
117117
(*((*box).type_desc)).size
118-
+ sys::size_of::<raw::Box<()>>();
118+
+ mem::size_of::<raw::Box<()>>();
119119
local_free(box as *i8);
120120
}
121121
true

0 commit comments

Comments
 (0)