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

Make NonNull::dangling a const fn #54657

Closed
wants to merge 1 commit into from

Conversation

Amanieu
Copy link
Member

@Amanieu Amanieu commented Sep 28, 2018

This is useful for other const fn constructors

@rust-highfive
Copy link
Collaborator

r? @aidanhs

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 28, 2018
@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@Amanieu
Copy link
Member Author

Amanieu commented Sep 29, 2018

Why is let and unsafe allowed in const fn in the stage0 std build, but not in the stage1 build?

@Amanieu
Copy link
Member Author

Amanieu commented Sep 29, 2018

It seems that this is due to #53555, closing for now.

@Amanieu Amanieu closed this Sep 29, 2018
@@ -2874,10 +2874,9 @@ impl<T: Sized> NonNull<T> {
/// sentinel value. Types that lazily allocate must track initialization by
/// some other means.
#[stable(feature = "nonnull", since = "1.25.0")]
pub fn dangling() -> Self {
pub const fn dangling() -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can add:

 #[rustc_const_unstable(feature = "const_ptr_dangling")]

and I think it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants