-
Notifications
You must be signed in to change notification settings - Fork 501
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
Clarify that free constants are always evaluated at compile time #1328
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
See rust-lang/rust#93838 It seems like everyone is onboard with blessing this behavior as stable.
XrXr
force-pushed
the
unamed-const-eval-timing
branch
from
February 3, 2023 20:42
2e15db6
to
86691a1
Compare
I don't think we want to do any special-casing based on the name (or lack thereof) of a constant. This rule applies to all non-associated constants and should be documented as such. |
Especially since it seems that there is no test in rust-lang/rust that covers the unamed constant case (even though the implementation covers it). rust-lang/rust#93838 (comment)
XrXr
changed the title
Clarify that unnamed constants are always evaluated at compile time
Clarify that free constants are always evaluated at compile time
Feb 14, 2023
scottmcm
approved these changes
Mar 14, 2023
Discussed in the @rust-lang/lang meeting and concluded that this represents existing consensus. Ship it! |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Mar 28, 2023
Update books ## rust-lang/nomicon 1 commits in 1f3e4cd4fd88b5b5d45feb86a11b6d2f93e5a974..b5f7500fc40775096c2bbd204eae096612cf9047 2023-03-27 13:47:36 UTC to 2023-03-27 13:47:36 UTC - Fix typo in 3.8 Subtyping and Variance (rust-lang/nomicon#395) ## rust-lang/reference 4 commits in 24c87f6663aed55b05d2cc286878f28f21918825..3c47807a3131b3c7cacb508f52632078d253cd0a 2023-03-26 18:42:43 UTC to 2023-03-14 18:28:23 UTC - Relax ordering rules for `asm!` operands (rust-lang/reference#1323) - Improve labeled blocks documentation (rust-lang/reference#1342) - Inline assembly: Fix repeated and unordered items in guaranteed directives (rust-lang/reference#1341) - Clarify that free constants are always evaluated at compile time (rust-lang/reference#1328) ## rust-lang/rust-by-example 7 commits in af0998b7473839ca75563ba3d3e7fd0160bef235..cfbfd648ce33926c3490f24de9a5b56cce404b88 2023-03-21 12:05:17 UTC to 2023-03-21 11:58:20 UTC - Fix two typos in the asm chapter (rust-lang/rust-by-example#1692) - Change `runtime` error to `compile time` error (rust-lang/rust-by-example#1690) - Fix tests running on non-x86 platforms. (rust-lang/rust-by-example#1687) - Remove trailing semicolon from macro expression (rust-lang/rust-by-example#1683) - Explained why it should not work in Chapter 4.1 (rust-lang/rust-by-example#1682) - Fix comment to mention the correct type of error (rust-lang/rust-by-example#1680) - Improve the content for `read_lines` (rust-lang/rust-by-example#1679) ## rust-lang/rustc-dev-guide 9 commits in b1b6d69..d08baa1 2023-03-26 17:55:53 UTC to 2023-03-14 03:50:20 UTC - Add locale_resources (rust-lang/rustc-dev-guide#1651) - Don't require $GITHUB_TOKEN to build locally (rust-lang/rustc-dev-guide#1652) - bootsrapping stages overview list (rust-lang/rustc-dev-guide#1555) - Update labels overview (rust-lang/rustc-dev-guide#1639) - first mention of type, and add a link (rust-lang/rustc-dev-guide#1643) - Add SIP solution for macOS users (rust-lang/rustc-dev-guide#1636) - Add chapter on fuzzing (rust-lang/rustc-dev-guide#1646) - Fix "Crate disambiguator" in libs-and-metadata.md (rust-lang/rustc-dev-guide#1648) - Update rustdoc-internals.md (rust-lang/rustc-dev-guide#1644)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See rust-lang/rust#93838
It seems like everyone is onboard with blessing this (useful) behavior as stable.