Skip to content
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

segfault on trivial usage of MutexARC<int> #5419

Closed
danglick opened this issue Mar 17, 2013 · 2 comments
Closed

segfault on trivial usage of MutexARC<int> #5419

danglick opened this issue Mar 17, 2013 · 2 comments

Comments

@danglick
Copy link

Following program segfaults using rust 0.5 on Fedora 17:

extern mod std;

use core::task::;
use std::
;

fn main() {
let value = 0;
let marc = arc::MutexARC(value);

for int::range(0, 5) |_| {
do spawn {
do marc.access |v| { *v += 1; }
}
}
}

@thestinger
Copy link
Contributor

@danglick: The code doesn't compile with master/incoming.

foo.rs:12:3: 12:7 error: illegal by-move capture of captured outer immutable variable in a stack closure
foo.rs:12 do marc.access |v| { *v += 1; }

@danglick
Copy link
Author

Sorry, rust newbie error, I was missing the call to marc.clone(). Glad that the compiler has now been fixed to protect me from myself. :)

oli-obk pushed a commit to oli-obk/rust that referenced this issue May 2, 2020
Downgrade unreadable_literal to pedantic

As motivated by rust-lang#5418. This is the top most commonly suppressed Clippy style lint, which indicates that the community has decided they don't share Clippy's opinion on the best style of this.

I've left the lint in as pedantic, though it could be that "restriction" would be better -- I can see this lint being useful as an opt-in restriction in some codebases.

changelog: Remove unreadable_literal from default set of enabled lints
oli-obk pushed a commit to oli-obk/rust that referenced this issue May 2, 2020
Rollup of 11 pull requests

Successful merges:

 - rust-lang#5406 (Fix update_lints)
 - rust-lang#5409 (Downgrade let_unit_value to pedantic)
 - rust-lang#5410 (Downgrade trivially_copy_pass_by_ref to pedantic)
 - rust-lang#5412 (Downgrade inefficient_to_string to pedantic)
 - rust-lang#5415 (Add new lint for `Result<T, E>.map_or(None, Some(T))`)
 - rust-lang#5417 (Update doc links and mentioned names in docs)
 - rust-lang#5419 (Downgrade unreadable_literal to pedantic)
 - rust-lang#5420 (Downgrade new_ret_no_self to pedantic)
 - rust-lang#5422 (CONTRIBUTING.md: fix broken triage link)
 - rust-lang#5424 (Incorrect suspicious_op_assign_impl)
 - rust-lang#5425 (Ehance opt_as_ref_deref lint.)

Failed merges:

 - rust-lang#5345 (Add lint for float in array comparison)
 - rust-lang#5411 (Downgrade implicit_hasher to pedantic)
 - rust-lang#5428 (Move cognitive_complexity to nursery)

r? @ghost

changelog: rollup
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

No branches or pull requests

2 participants