-
Notifications
You must be signed in to change notification settings - Fork 385
Format tests and benches with rustfmt (1-50 of 300) #2244
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
Conversation
@@ -13,9 +13,7 @@ pub fn main() { | |||
let b = &mut a as *mut u32; | |||
let c = EvilSend(b); | |||
unsafe { | |||
let j1 = spawn(move || { | |||
*c.0 |
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.
If we add a trailing ;
here, does rustfmt keep the braces? I think I'd prefer that, for symmetry with the other spawn
.
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.
Rustc does not allow that.
error: unused unary operation that must be used
--> tests/fail/data_race/read_write_race.rs:17
|
17 | *c.0;
| ^^^^ the unary operation produces a value
|
= note: `-D unused-must-use` implied by `-D unused`
help: use `let _ = ...` to ignore the resulting value
|
17 | let _ = *c.0;
| +++++++
And with let _ = *c.0;
, miri does not detect the data race so the test fails.
I can use return *c.0;
.
Is it the case that this formats test-cargo-miri, bench-cargo-miri, benches completely? Can you add that part to CI already? |
|
Yeah "let _ = place;" does not even evaluate the place. (Not a Miri choice, this is done during MIR building.) "let _val = place;" should work.
|
Changed to |
@bors r+ |
📌 Commit 53580c1 has been approved by |
☀️ Test successful - checks-actions |
Extracted from #2097.
I filtered this PR to contain exclusively "easy" cases to start off with, i.e. where there is no compiletest_rs (or other) comment in the vicinity that might need to get manually repositioned.