Skip to content
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

Rollup of 8 pull requests #93452

Closed
wants to merge 21 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5e97fc9
Make `NonNull::new` `const`
lilasta Jan 23, 2022
1ab97db
add note suggesting that predicate is satisfied but is not const
compiler-errors Jan 27, 2022
c6de4d5
drive-by: use is_const and is_const_if_const
compiler-errors Jan 27, 2022
c6f6e3e
do not register infer var for GAT projection in opaque
compiler-errors Jan 27, 2022
da0d506
kmc-solid: Implement `FileDesc::duplicate`
kawadakk Jan 28, 2022
cdd0873
Add a test case for using NonNull::new in const context
lilasta Jan 28, 2022
2188c55
Move unstable is_{arch}_feature_detected! macros to std::arch
Amanieu Jan 28, 2022
9a814b8
Update stdarch submodule
Amanieu Jan 28, 2022
9d65342
fix nit
lcnr Jan 28, 2022
f9e0eb3
remove unused `jemallocator` crate
lqd Jan 28, 2022
5b2747a
Add test for old ICE
BGR360 Dec 27, 2021
2819d90
Add test for old ICE in #91594
BGR360 Dec 27, 2021
3f849a8
Add test for old ICE in #89066
BGR360 Dec 27, 2021
2b684a3
Rollup merge of #92312 - BGR360:needs-test, r=Mark-Simulacrum
matthiaskrgr Jan 29, 2022
cb97b8a
Rollup merge of #93236 - woppopo:const_nonnull_new, r=oli-obk
matthiaskrgr Jan 29, 2022
8e9fecf
Rollup merge of #93358 - compiler-errors:is-not-const, r=fee1-dead
matthiaskrgr Jan 29, 2022
7fa7e02
Rollup merge of #93362 - compiler-errors:ice-gat-in-rpit, r=oli-obk
matthiaskrgr Jan 29, 2022
be7249a
Rollup merge of #93410 - solid-rs:feat-kmc-solid-net-dup, r=dtolnay
matthiaskrgr Jan 29, 2022
45f9ac8
Rollup merge of #93414 - Amanieu:std_arch_detect, r=m-ou-se
matthiaskrgr Jan 29, 2022
0aac06f
Rollup merge of #93424 - lcnr:nit, r=spastorino
matthiaskrgr Jan 29, 2022
49cae39
Rollup merge of #93431 - lqd:remove-jemallocator, r=Mark-Simulacrum
matthiaskrgr Jan 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Make NonNull::new const
  • Loading branch information
lilasta committed Jan 23, 2022
commit 5e97fc9aa265cb523a16cbe035c638eb35257cf5
3 changes: 2 additions & 1 deletion library/core/src/ptr/non_null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,9 @@ impl<T: ?Sized> NonNull<T> {
/// }
/// ```
#[stable(feature = "nonnull", since = "1.25.0")]
#[rustc_const_unstable(feature = "const_nonnull_new", issue = "93235")]
#[inline]
pub fn new(ptr: *mut T) -> Option<Self> {
pub const fn new(ptr: *mut T) -> Option<Self> {
if !ptr.is_null() {
// SAFETY: The pointer is already checked and is not null
Some(unsafe { Self::new_unchecked(ptr) })
Expand Down