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

Update unsafe in const functions documentation #484

Merged
merged 2 commits into from
Dec 23, 2018

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Dec 23, 2018

fixes #482

cc @Centril

src/items/functions.md Outdated Show resolved Hide resolved
Copy link
Contributor

@Centril Centril left a comment

Choose a reason for hiding this comment

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

Thanks!

@Centril Centril merged commit e5751c9 into rust-lang:master Dec 23, 2018
@BatmanAoD
Copy link
Member

Just for my own understanding: it looks like this doesn't actually permit anything truly "unsafe" inside const fn, except maybe inside the standard library?

Is there ongoing discussion somewhere about additional unsafe features we might want to permit inside const fn? I'm interested in what the definition of undefined behavior would be inside a const fn. (Come to think of it, I'm now also wondering what the implications of undefined behavior inside a C++ constexpr function are, and whether the standard even addresses that...)

@oli-obk oli-obk deleted the patch-2 branch February 25, 2019 10:14
@oli-obk
Copy link
Contributor Author

oli-obk commented Feb 25, 2019

A few truly unsafe things are tracked in rust-lang/rust#57563 but you are right, we need to figure out our story around unsafe and const safety. This is tracked somewhat in rust-lang/const-eval#14

@Centril
Copy link
Contributor

Centril commented Feb 25, 2019

Just for my own understanding: it looks like this doesn't actually permit anything truly "unsafe" inside const fn, except maybe inside the standard library?

https://doc.rust-lang.org/nightly/std/num/struct.NonZeroU8.html#method.new_unchecked

@BatmanAoD
Copy link
Member

@Centril Ah, okay, I can see how calling that in user code would be truly "unsafe". Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document min_const_unsafe_fn
3 participants