Skip to content

Try to ensure usize marker does not get merged - #69651

Merged
bors merged 1 commit into
rust-lang:masterfrom
Mark-Simulacrum:black-box-marker
Mar 8, 2020
Merged

Try to ensure usize marker does not get merged#69651
bors merged 1 commit into
rust-lang:masterfrom
Mark-Simulacrum:black-box-marker

Conversation

@Mark-Simulacrum

@Mark-SimulacrumMark-Simulacrum commented Mar 3, 2020

Copy link
Copy Markdown
Member

This follows up on this conversation. However, I'm not confident this is quite correct, so feedback is appreciated, as always.

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 3, 2020
Comment threadsrc/libcore/fmt/mod.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you make this return Ok(()), you could actually call it before reading the usize from Argument, ensuring that what this closure does is guaranteed to happen, giving more confidence that if there was UB, it was invoked by calling the fn pointer which should be safe to call.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

It's a bit annoying to call the formatter as we don't have a &mut Formatter<'_> around and I'd rather not manufacture one just for this. I think we could likely thread it through but I think that hurts readability and such so I'd rather not.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh, right, that method doesn't take the formatter, fair enough.

Comment threadsrc/libcore/fmt/mod.rs Outdated
@Mark-Simulacrum

Copy link
Copy Markdown
MemberAuthor

Changed to black_box(*ptr).

Comment threadsrc/libcore/fmt/mod.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are we using black_box here for functional correctness?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Yes, we were, I think I agree we probably shouldn't be. Switched to a volatile read.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you :)

@eddyb

eddyb commented Mar 5, 2020

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Mar 5, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit a9259fb has been approved by eddyb

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 5, 2020
Centril added a commit to Centril/rust that referenced this pull request Mar 8, 2020
…=eddyb
Try to ensure usize marker does not get merged
This follows up on [this conversation](rust-lang#69209 (comment)). However, I'm not confident this is quite correct, so feedback is appreciated, as always.
@CentrilCentril mentioned this pull request Mar 8, 2020
bors added a commit that referenced this pull request Mar 8, 2020
Rollup of 8 pull requests
Successful merges:
- #69631 (remove non-sysroot sources from rust-src component)
- #69646 (Miri visitor: detect primitive types based on type, not layout (also, more tests))
- #69651 (Try to ensure usize marker does not get merged)
- #69668 (More documentation and simplification of BTreeMap's internals)
- #69685 (unix: Don't override existing SIGSEGV/BUS handlers)
- #69771 (Cleanup E0390 explanation)
- #69777 (Add missing ` in doc for File::with_options())
- #69812 (Refactorings to method/probe.rs and CrateId)
Failed merges:
r? @ghost
@CentrilCentril mentioned this pull request Mar 8, 2020
bors added a commit that referenced this pull request Mar 8, 2020
Rollup of 7 pull requests
Successful merges:
- #69631 (remove non-sysroot sources from rust-src component)
- #69646 (Miri visitor: detect primitive types based on type, not layout (also, more tests))
- #69651 (Try to ensure usize marker does not get merged)
- #69668 (More documentation and simplification of BTreeMap's internals)
- #69771 (Cleanup E0390 explanation)
- #69777 (Add missing ` in doc for File::with_options())
- #69812 (Refactorings to method/probe.rs and CrateId)
Failed merges:
r? @ghost
@bors
bors merged commit 8ce45d8 into rust-lang:masterMar 8, 2020
@Mark-Simulacrum
Mark-Simulacrum deleted the black-box-marker branch March 17, 2024 16:13
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@Mark-Simulacrum@eddyb@bors@Centril@rust-highfive