Skip to content

Commit 1cc8b6e

Browse files
committed
Auto merge of rust-lang#22510 - GuillaumeGomez:audit-integer-libstd-thread, r=alexcrichton
Part of rust-lang#22240.
2 parents c514205 + 6d74279 commit 1cc8b6e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/libstd/thread.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ pub struct Builder {
170170
// A name for the thread-to-be, for identification in panic messages
171171
name: Option<String>,
172172
// The size of the stack for the spawned thread
173-
stack_size: Option<uint>,
173+
stack_size: Option<usize>,
174174
// Thread-local stdout
175175
stdout: Option<Box<Writer + Send + 'static>>,
176176
// Thread-local stderr
@@ -200,7 +200,7 @@ impl Builder {
200200

201201
/// Set the size of the stack for the new thread.
202202
#[stable(feature = "rust1", since = "1.0.0")]
203-
pub fn stack_size(mut self, size: uint) -> Builder {
203+
pub fn stack_size(mut self, size: usize) -> Builder {
204204
self.stack_size = Some(size);
205205
self
206206
}
@@ -283,8 +283,8 @@ impl Builder {
283283
// address at which our stack started).
284284
let main = move || {
285285
let something_around_the_top_of_the_stack = 1;
286-
let addr = &something_around_the_top_of_the_stack as *const int;
287-
let my_stack_top = addr as uint;
286+
let addr = &something_around_the_top_of_the_stack as *const isize;
287+
let my_stack_top = addr as usize;
288288
let my_stack_bottom = my_stack_top - stack_size + 1024;
289289
unsafe {
290290
stack::record_os_managed_stack_bounds(my_stack_bottom, my_stack_top);
@@ -779,7 +779,7 @@ mod test {
779779

780780
let (tx, rx) = channel();
781781

782-
fn f(i: int, tx: Sender<()>) {
782+
fn f(i: i32, tx: Sender<()>) {
783783
let tx = tx.clone();
784784
thread::spawn(move|| {
785785
if i == 0 {
@@ -808,13 +808,13 @@ mod test {
808808
}
809809

810810
fn avoid_copying_the_body<F>(spawnfn: F) where F: FnOnce(Thunk<'static>) {
811-
let (tx, rx) = channel::<uint>();
811+
let (tx, rx) = channel::<u32>();
812812

813813
let x = box 1;
814-
let x_in_parent = (&*x) as *const int as uint;
814+
let x_in_parent = (&*x) as *const isize as u32;
815815

816816
spawnfn(Thunk::new(move|| {
817-
let x_in_child = (&*x) as *const int as uint;
817+
let x_in_child = (&*x) as *const isize as u32;
818818
tx.send(x_in_child).unwrap();
819819
}));
820820

@@ -853,8 +853,8 @@ mod test {
853853
// climbing the task tree to dereference each ancestor. (See #1789)
854854
// (well, it would if the constant were 8000+ - I lowered it to be more
855855
// valgrind-friendly. try this at home, instead..!)
856-
static GENERATIONS: uint = 16;
857-
fn child_no(x: uint) -> Thunk<'static> {
856+
static GENERATIONS: usize = 16;
857+
fn child_no(x: usize) -> Thunk<'static> {
858858
return Thunk::new(move|| {
859859
if x < GENERATIONS {
860860
thread::spawn(move|| child_no(x+1).invoke(()));

0 commit comments

Comments
 (0)