#[deny(unsafe_op_in_unsafe_fn)] in sys/sgx#77346
Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cramertj (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
jyn514
left a comment
There was a problem hiding this comment.
You need to run x.py fmt:
Diff in /checkout/library/std/src/sys/sgx/mod.rs at line 122:
Running `"/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/rustfmt" "--config-path" "/checkout" "--edition" "2018" "--unstable-features" "--skip-children" "--check" "/checkout/library/std/src/sys/sgx/mod.rs"` failed.
If you're running `tidy`, try again with `--bless`. Or, if you just want to format code, run `./x.py fmt` instead.
pub unsafe fn strlen(mut s: *const c_char) -> usize {
let mut n = 0;
- while unsafe {*s} != 0 {
+ while unsafe { *s } != 0 {
n += 1;
s = unsafe { s.offset(1) };
}
Mark-Simulacrum
left a comment
There was a problem hiding this comment.
Left a few comments, but didn't go through the whole PR -- it looks like the general pattern they suggest holds in other places though, so would be good to update those too. Let me know if I can explain anything better.
library/std/src/sys/sgx/abi/tls.rs
Outdated
There was a problem hiding this comment.
This doesn't appear to explain why it's safe to call? I would at least want a FIXME if we can't document these functions appropriately.
|
@Mark-Simulacrum Fixed review comments, but couldn't figure out how to document the TLS ptr calls, so added a FIXME there. |
|
Please squash commits; r=me with that done. |
Run `./x.py` fmt Add reference link Fix reference link Apply review suggestions.
|
@Mark-Simulacrum Done. |
|
@bors r+ |
|
📌 Commit 1fb0a1d has been approved by |
|
☀️ Test successful - checks-actions, checks-azure |
This is part of #73904.
Enclose unsafe operations in unsafe blocks in
libstd/sys/sgx.