Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/libstd/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ impl Builder {
// address at which our stack started).
let main = move || {
let something_around_the_top_of_the_stack = 1;
let addr = &something_around_the_top_of_the_stack as *const isize;
let addr = &something_around_the_top_of_the_stack as *const i32;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's irrelevant what something_around_the_top_of_the_stack is, so i32 is just okay.

let my_stack_top = addr as usize;
let my_stack_bottom = my_stack_top - stack_size + 1024;
unsafe {
Expand Down Expand Up @@ -808,13 +808,13 @@ mod test {
}

fn avoid_copying_the_body<F>(spawnfn: F) where F: FnOnce(Thunk<'static>) {
let (tx, rx) = channel::<u32>();
let (tx, rx) = channel();

let x = box 1;
let x_in_parent = (&*x) as *const isize as u32;
let x_in_parent = (&*x) as *const i32 as usize;

spawnfn(Thunk::new(move|| {
let x_in_child = (&*x) as *const isize as u32;
let x_in_child = (&*x) as *const i32 as usize;
tx.send(x_in_child).unwrap();
}));

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