-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Document unsafe blocks in core::fmt #69011
Conversation
I'm relatively familiar with this code and can likely do a review here, so let's r? @Mark-Simulacrum to take some work off @RalfJung. |
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.
Generally fine to resolve most of the comments with just adding FIXMEs when it comes to changing the code, I think.
I also pinged folks on the comments I was not sure about.
cc @rust-lang/wg-unsafe-code-guidelines (I believe the mention doesn't work for non-members) |
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.
r=me with comment fixed and commits squashed into one
src/libcore/fmt/float.rs
Outdated
@@ -16,6 +14,7 @@ fn float_to_decimal_common_exact<T>( | |||
where | |||
T: flt2dec::DecodableFloat, | |||
{ | |||
// SAFETY: Possible undefined behavior, see FIXME |
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.
Could we make these refer to some marker, e.g., FIXME(MaybeUninit)
or an issue number or so, and then use that in the actual FIXME as well?
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.
The FIXMEs already point to #53491, does that work or would it be better if changed these lines to // SAFETY: Possible undefined behavior, see FIXME(#53491)
also?
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.
Yes, exactly, currently it's not clear which FIXME this is telling you to see.
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.
I believe this is the only thing left to resolve here.
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
It looks like a new macro with some unsafe blocks was added to master. I'm fixing that now. |
☔ The latest upstream changes (presumably #69484) made this pull request unmergeable. Please resolve the merge conflicts. |
Looks like this needs a rebase -- which will remove a few of the FIXMEs -- and otherwise I think is good to go. |
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.
Please also squash into one commit.
src/libcore/fmt/float.rs
Outdated
@@ -16,6 +14,7 @@ fn float_to_decimal_common_exact<T>( | |||
where | |||
T: flt2dec::DecodableFloat, | |||
{ | |||
// SAFETY: Possible undefined behavior, see FIXME |
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.
I believe this is the only thing left to resolve here.
c3106f9
to
3d146a3
Compare
@Mark-Simulacrum This is ready for review again. Thanks! |
@bors r+ Thanks! |
📌 Commit 3d146a3 has been approved by |
…rk-Simulacrum Document unsafe blocks in core::fmt r? @RalfJung CC: @rust-lang/wg-unsafe-code-guidelines rust-lang#66219 Sorry for the hiatus, but here's a few more files with the unsafe blocks documented! I think working on it smaller chunks like this will be easier for everyone.
…rk-Simulacrum Document unsafe blocks in core::fmt r? @RalfJung CC: @rust-lang/wg-unsafe-code-guidelines rust-lang#66219 Sorry for the hiatus, but here's a few more files with the unsafe blocks documented! I think working on it smaller chunks like this will be easier for everyone.
Rollup of 10 pull requests Successful merges: - #68899 (Add Display and Error impls for proc_macro::LexError) - #69011 (Document unsafe blocks in core::fmt) - #69674 (Rename DefKind::Method and TraitItemKind::Method ) - #69705 (Toolstate: remove redundant beta-week check.) - #69722 (Tweak output for invalid negative impl AST errors) - #69747 (Rename rustc guide) - #69792 (Implement Error for TryReserveError) - #69830 (miri: ICE on invalid terminators) - #69921 (rustdoc: remove unused import) - #69945 (update outdated comment) Failed merges: r? @ghost
r? @RalfJung
CC: @rust-lang/wg-unsafe-code-guidelines
#66219
Sorry for the hiatus, but here's a few more files with the unsafe blocks documented! I think working on it smaller chunks like this will be easier for everyone.