-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace int/uint by isize/usize in libstd/thread.rs #22510
Merged
bors
merged 1 commit into
rust-lang:master
from
GuillaumeGomez:audit-integer-libstd-thread
Mar 2, 2015
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,7 +170,7 @@ pub struct Builder { | |
// A name for the thread-to-be, for identification in panic messages | ||
name: Option<String>, | ||
// The size of the stack for the spawned thread | ||
stack_size: Option<uint>, | ||
stack_size: Option<usize>, | ||
// Thread-local stdout | ||
stdout: Option<Box<Writer + Send + 'static>>, | ||
// Thread-local stderr | ||
|
@@ -200,7 +200,7 @@ impl Builder { | |
|
||
/// Set the size of the stack for the new thread. | ||
#[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 | ||
} | ||
|
@@ -283,8 +283,8 @@ 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 int; | ||
let my_stack_top = addr as uint; | ||
let addr = &something_around_the_top_of_the_stack as *const isize; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is fine |
||
let my_stack_top = addr as usize; | ||
let my_stack_bottom = my_stack_top - stack_size + 1024; | ||
unsafe { | ||
stack::record_os_managed_stack_bounds(my_stack_bottom, my_stack_top); | ||
|
@@ -779,7 +779,7 @@ mod test { | |
|
||
let (tx, rx) = channel(); | ||
|
||
fn f(i: int, tx: Sender<()>) { | ||
fn f(i: i32, tx: Sender<()>) { | ||
let tx = tx.clone(); | ||
thread::spawn(move|| { | ||
if i == 0 { | ||
|
@@ -808,13 +808,13 @@ mod test { | |
} | ||
|
||
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_in_parent = (&*x) as *const int as uint; | ||
let x_in_parent = (&*x) as *const isize as u32; | ||
|
||
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(); | ||
})); | ||
|
||
|
@@ -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: uint = 16; | ||
fn child_no(x: uint) -> Thunk<'static> { | ||
static GENERATIONS: usize = 16; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. u32 |
||
fn child_no(x: usize) -> Thunk<'static> { | ||
return Thunk::new(move|| { | ||
if x < GENERATIONS { | ||
thread::spawn(move|| child_no(x+1).invoke(())); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine