-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Implement const fn {size,align}_of. #42859
Conversation
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.
One nit, one question I just wanted to clarify.
#[inline] | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[cfg(not(stage0))] | ||
pub const fn size_of<T>() -> usize { |
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.
Not that I necessarily object to this, but this would be an "insta-stable" change, right?
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.
This change itself yes, but calling any function in a const context still requires #[feature(const_fn)]
.
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.
Oh, does it? I thought we enabled calls, but not declarations, of const fns.
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.
Or at least I couldn't remember which it is.
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.
There’s discussion of doing this, but it hasn’t happened yet as far as #24111 says.
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.
is_shuffle = true; | ||
} | ||
|
||
_ => {} |
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.
maybe add assert!(!self.tcx.is_const_fn(def_id))
?
This is pretty simple. =) |
@nikomatsakis Yeah, this could've been done months ago... |
on IRC, @eddyb noted that we ought to have some tests. Indeed! I'm basically happy here. @rust-lang/lang -- everybody happy with making |
r=me with tests, presuming that it still takes a feature gate to call a const fn |
Can we unreserve |
@whitequark I would wait until you can use these functions from constants in stable. |
What about |
@whitequark I'd just use a macro for that. Or have some sort of static reflection capabilities that allow e.g. "indexing by a field" to access the value, safely etc. |
I really want |
I think it shouldn't be a lot of work to implement... I wish I had more time to work on rustc. |
☔ The latest upstream changes (presumably #42417) made this pull request unmergeable. Please resolve the merge conflicts. |
This rocks so hard! |
be029e8
to
7615c86
Compare
@nikomatsakis sounds great to me! |
|
3600acf
to
123799d
Compare
@bors r+ |
📌 Commit 123799d has been approved by |
@nikomatsakis There are still no testcases FWIW. |
Still waiting on tests. =) |
1e58b2d
to
148718b
Compare
@bors r=nikomatsakis |
📌 Commit 148718b has been approved by |
⌛ Testing commit 148718b with merge 42caa5d8031350c501bba1fb32b7ff8b93892474... |
💔 Test failed - status-travis |
Macs are having some issues on travis
|
@retep998 https://www.traviscistatus.com/incidents/74lc35kpxs0y
What's wrong with all the CI problems today… 😕 |
@bors retry |
⌛ Testing commit 148718b with merge 4ada3a1d0887c79cfbf293fe46d2e7fee18a20ab... |
💔 Test failed - status-appveyor |
I wonder which revocation server is offline and who is responsible for keeping it online?
|
@retep998 Probably related https://appveyor.statuspage.io/incidents/m2vdvw39kdk8
|
@bors: retry
…On Wed, Jul 19, 2017 at 7:36 AM, kennytm ***@***.***> wrote:
@retep998 <https://github.com/retep998> Probably related
https://appveyor.statuspage.io/incidents/m2vdvw39kdk8
The issue is a "broken" route between Rackspace data center and US-based
CDN edge server for api.nuget.org. Unfortunately, there is no ETA yet. We
continue working with nuget team to resolve the issue as soon as possible.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#42859 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAD95IA6tLAJQ2VF5zisqDTO26V5BFK2ks5sPfhDgaJpZM4ODqxq>
.
|
Implement const fn {size,align}_of. Fixes #34078. r? @nikomatsakis
☀️ Test successful - status-appveyor, status-travis |
Fixes #34078.
r? @nikomatsakis