Skip to content

Update example in "Rust Inside Other Languages" #26311

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

Merged
merged 1 commit into from
Jun 16, 2015
Merged

Conversation

jooert
Copy link
Contributor

@jooert jooert commented Jun 15, 2015

Use result of the computation to prevent the compiler from optimising
too much. Change _x to x and therefore remove the paragraph about
the underscore.

Fixes #25855.

r? @steveklabnik

@@ -66,10 +66,15 @@ threads = []
5_000_000.times do
count += 1
end

Thread.current[:output] = count
Copy link
Member

Choose a reason for hiding this comment

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

hmmm, this changes it from the rust significantly, doesn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably, my ruby is not very up to par. Would it be better to just return count from the threads and then collect the values using t.value?

Copy link
Member

Choose a reason for hiding this comment

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

yeah, that seems better 👍

Use result of the computation to prevent the compiler from optimising
too much. Change `_x` to `x` and therefore remove the paragraph about
the underscore.

Fixes rust-lang#25855.
@jooert
Copy link
Contributor Author

jooert commented Jun 15, 2015

Updated.

@steveklabnik
Copy link
Member

@bors: r+

@bors
Copy link
Collaborator

bors commented Jun 15, 2015

📌 Commit 3e7ab1b has been approved by steveklabnik

@steveklabnik
Copy link
Member

Thanks! :)

@bors
Copy link
Collaborator

bors commented Jun 15, 2015

⌛ Testing commit 3e7ab1b with merge 8b31bd3...

@bors
Copy link
Collaborator

bors commented Jun 15, 2015

⛄ The build was interrupted to prioritize another pull request.

bors added a commit that referenced this pull request Jun 15, 2015
Use result of the computation to prevent the compiler from optimising
too much. Change `_x` to `x` and therefore remove the paragraph about
the underscore.

Fixes #25855.

r? @steveklabnik
@bors
Copy link
Collaborator

bors commented Jun 15, 2015

⌛ Testing commit 3e7ab1b with merge 906ad72...

@bors bors merged commit 3e7ab1b into rust-lang:master Jun 16, 2015
@jooert jooert deleted the fix25855 branch June 16, 2015 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants