-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add missing examples for NonNull #87547
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @kennytm (rust-highfive has picked a reviewer for you, use r? to override) |
6cf5fc8
to
8f7dba8
Compare
8f7dba8
to
4ace7e7
Compare
Updated! |
This comment has been minimized.
This comment has been minimized.
4ace7e7
to
cfe9858
Compare
This comment has been minimized.
This comment has been minimized.
cfe9858
to
1bbe618
Compare
@bors: r=kennytm rollup |
📌 Commit 1bbe618 has been approved by |
…kennytm Add missing examples for NonNull
Rollup of 9 pull requests Successful merges: - rust-lang#86072 (Cross compiling rustc_llvm on Darwin requires zlib.) - rust-lang#87385 (Make `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` warn by default) - rust-lang#87547 (Add missing examples for NonNull) - rust-lang#87557 (Fix issue with autofix for ambiguous associated function from Rust 2021 prelude when struct is generic) - rust-lang#87559 (Tweak borrowing suggestion in `for` loop) - rust-lang#87596 (Add warning when whitespace is not skipped after an escaped newline) - rust-lang#87606 (Add some TAIT-related regression tests) - rust-lang#87609 (Add docs about performance and `Iterator::map` to `[T; N]::map`) - rust-lang#87616 (Fix missing word in rustdoc book) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
/// let ptr = unsafe { NonNull::new_unchecked(&mut x as *mut _) }; | ||
/// | ||
/// // NEVER DO THAT!!! | ||
/// let ptr = unsafe { NonNull::<u32>::new_unchecked(std::ptr::null_mut()) }; |
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 mark testcases that cause UB as no_run
(see e.g. the MaybeUninit
docs).
Otherwise, https://github.com/rust-lang/miri-test-libstd/ will fail.
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.
See #87653
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.
Noted!
mark a UB doctest as no_run See rust-lang#87547 (comment) Cc `@GuillaumeGomez` `@kennytm`
No description provided.