-
Notifications
You must be signed in to change notification settings - Fork 14k
sgx: avoid unnecessarily creating a slice #149113
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
|
r? @ChrisDenton rustbot has assigned @ChrisDenton. Use |
So the Safety documentation section of the trait method seems to imply that the following invariant must be upheld
However, I think that may be incorrect. I think a similar invariant is upheld by the |
dfdc989 to
7ad3c5c
Compare
|
It is also generally odd to have a safety comment on a trait impl that's not the same as the one in the trait itself -- callers that use a generic Anyway I won't be conducting a refactor of that trait here, I just noticed this little improvement inside the slice impl. I will leave follow-up cleanup to people that understand the surrounding context better :) |
|
Potential followups aside, this is strictly an improvement so... @bors r+ rollup |
…enton sgx: avoid unnecessarily creating a slice Cc `@jethrogb` -- no idea why this created a slice only to directly convert it back to a raw pointer, but we can avoid this and in fact make the entire function safe. I didn't change the function signature (it's still an `unsafe fn`) as I know nothing about the surrounding code.
Rollup of 9 pull requests Successful merges: - #149033 (autodiff rlib handling) - #149088 (Add missing trailing period to RustDoc for fn create_dir().) - #149111 (fs: Run file lock tests on all platforms that support it) - #149113 (sgx: avoid unnecessarily creating a slice) - #149123 (std: sys: fs: uefi: Fix FileAttr size) - #149125 (In `BTreeMap::eq`, do not compare the elements if the sizes are different.) - #149133 (Remove an unused variable) - #149134 (std: sys: net: uefi: Implement read_vectored) - #149139 (Enable host tools for aarch64-unknown-linux-ohos) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 9 pull requests Successful merges: - #149033 (autodiff rlib handling) - #149088 (Add missing trailing period to RustDoc for fn create_dir().) - #149111 (fs: Run file lock tests on all platforms that support it) - #149113 (sgx: avoid unnecessarily creating a slice) - #149123 (std: sys: fs: uefi: Fix FileAttr size) - #149133 (Remove an unused variable) - #149139 (Enable host tools for aarch64-unknown-linux-ohos) - #149144 (Reject `async fn` in `const impl` during AST validation) - #149154 (Fix platform supports docs tiny typo) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #149113 - RalfJung:sgx-less-unsafe, r=ChrisDenton sgx: avoid unnecessarily creating a slice Cc ``@jethrogb`` -- no idea why this created a slice only to directly convert it back to a raw pointer, but we can avoid this and in fact make the entire function safe. I didn't change the function signature (it's still an `unsafe fn`) as I know nothing about the surrounding code.
Cc @jethrogb -- no idea why this created a slice only to directly convert it back to a raw pointer, but we can avoid this and in fact make the entire function safe. I didn't change the function signature (it's still an
unsafe fn) as I know nothing about the surrounding code.