Replace int/uint by isize/usize
This commit is contained in:
parent
8902936552
commit
6d74279234
@ -170,7 +170,7 @@ pub struct Builder {
|
|||||||
// A name for the thread-to-be, for identification in panic messages
|
// A name for the thread-to-be, for identification in panic messages
|
||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
// The size of the stack for the spawned thread
|
// The size of the stack for the spawned thread
|
||||||
stack_size: Option<uint>,
|
stack_size: Option<usize>,
|
||||||
// Thread-local stdout
|
// Thread-local stdout
|
||||||
stdout: Option<Box<Writer + Send + 'static>>,
|
stdout: Option<Box<Writer + Send + 'static>>,
|
||||||
// Thread-local stderr
|
// Thread-local stderr
|
||||||
@ -200,7 +200,7 @@ impl Builder {
|
|||||||
|
|
||||||
/// Set the size of the stack for the new thread.
|
/// Set the size of the stack for the new thread.
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub fn stack_size(mut self, size: uint) -> Builder {
|
pub fn stack_size(mut self, size: usize) -> Builder {
|
||||||
self.stack_size = Some(size);
|
self.stack_size = Some(size);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@ -283,8 +283,8 @@ impl Builder {
|
|||||||
// address at which our stack started).
|
// address at which our stack started).
|
||||||
let main = move || {
|
let main = move || {
|
||||||
let something_around_the_top_of_the_stack = 1;
|
let something_around_the_top_of_the_stack = 1;
|
||||||
let addr = &something_around_the_top_of_the_stack as *const int;
|
let addr = &something_around_the_top_of_the_stack as *const isize;
|
||||||
let my_stack_top = addr as uint;
|
let my_stack_top = addr as usize;
|
||||||
let my_stack_bottom = my_stack_top - stack_size + 1024;
|
let my_stack_bottom = my_stack_top - stack_size + 1024;
|
||||||
unsafe {
|
unsafe {
|
||||||
stack::record_os_managed_stack_bounds(my_stack_bottom, my_stack_top);
|
stack::record_os_managed_stack_bounds(my_stack_bottom, my_stack_top);
|
||||||
@ -779,7 +779,7 @@ mod test {
|
|||||||
|
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
|
|
||||||
fn f(i: int, tx: Sender<()>) {
|
fn f(i: i32, tx: Sender<()>) {
|
||||||
let tx = tx.clone();
|
let tx = tx.clone();
|
||||||
thread::spawn(move|| {
|
thread::spawn(move|| {
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
@ -808,13 +808,13 @@ mod test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn avoid_copying_the_body<F>(spawnfn: F) where F: FnOnce(Thunk<'static>) {
|
fn avoid_copying_the_body<F>(spawnfn: F) where F: FnOnce(Thunk<'static>) {
|
||||||
let (tx, rx) = channel::<uint>();
|
let (tx, rx) = channel::<u32>();
|
||||||
|
|
||||||
let x = box 1;
|
let x = box 1;
|
||||||
let x_in_parent = (&*x) as *const int as uint;
|
let x_in_parent = (&*x) as *const isize as u32;
|
||||||
|
|
||||||
spawnfn(Thunk::new(move|| {
|
spawnfn(Thunk::new(move|| {
|
||||||
let x_in_child = (&*x) as *const int as uint;
|
let x_in_child = (&*x) as *const isize as u32;
|
||||||
tx.send(x_in_child).unwrap();
|
tx.send(x_in_child).unwrap();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -853,8 +853,8 @@ mod test {
|
|||||||
// climbing the task tree to dereference each ancestor. (See #1789)
|
// climbing the task tree to dereference each ancestor. (See #1789)
|
||||||
// (well, it would if the constant were 8000+ - I lowered it to be more
|
// (well, it would if the constant were 8000+ - I lowered it to be more
|
||||||
// valgrind-friendly. try this at home, instead..!)
|
// valgrind-friendly. try this at home, instead..!)
|
||||||
static GENERATIONS: uint = 16;
|
static GENERATIONS: usize = 16;
|
||||||
fn child_no(x: uint) -> Thunk<'static> {
|
fn child_no(x: usize) -> Thunk<'static> {
|
||||||
return Thunk::new(move|| {
|
return Thunk::new(move|| {
|
||||||
if x < GENERATIONS {
|
if x < GENERATIONS {
|
||||||
thread::spawn(move|| child_no(x+1).invoke(()));
|
thread::spawn(move|| child_no(x+1).invoke(()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user