-
Notifications
You must be signed in to change notification settings - Fork 552
const functions: separate rule about users and rule about what is allowed in such functions #2013
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
Conversation
This comment has been minimized.
This comment has been minimized.
There were two sections defining const functions, which was a little confusing to me and made it a little difficult to maintain them. This combines them so that there is only one section. It could have gone in either chapter, but I arbitrarily picked const-eval. This removes `items.fn.const.extern`. The reference generally assumes that if something can be defined, it can be used unless explicitly restricted. This used to be a restriction, but it morphed over time as `extern` support was slowly added. I noticed that `const-eval.const-fn.type-restrictions` is not clear to me and needs further work to explain the type restrictions.
b4bb6e7
to
b71f831
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
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.
Thanks! I found the existing text was a little awkward, so I did a little bit of reworking. There were two separate sections defining "const functions". Instead of trying to conjure some logic for how to split them, I decided to just merge them.
Update books ## rust-lang/book 1 commits in 33f1af40cc44dde7e3e892f7a508e6f427d2cbc6..1d7c3e6abec2d5a9bfac798b29b7855b95025426 2025-09-28 21:24:16 UTC to 2025-09-28 21:24:16 UTC - Chunk of chapters from copyedit (rust-lang/book#4506) ## rust-lang/edition-guide 1 commits in aa6ce337c0adf7a63e33960d184270f2a45ab9ef..e2ed891f00361efc26616d82590b1c85d7a8920e 2025-10-01 17:11:54 UTC to 2025-10-01 17:11:54 UTC - link to never type fallback lint as deny by default (rust-lang/edition-guide#377) ## rust-lang/nomicon 1 commits in f17a018b9989430967d1c58e9a12c51169abc744..23fc2682f8fcb887f77d0eaabba708809f834c11 2025-09-24 10:10:31 UTC to 2025-09-24 10:10:31 UTC - a typo in ffi.md (rust-lang/nomicon#502) ## rust-lang/reference 13 commits in cc7247d8dfaef4c39000bb12c55c32ba5b5ba976..e11adf6016a362766eea5a3f9832e193994dd0c8 2025-09-29 00:55:42 UTC to 2025-09-23 23:33:32 UTC - const functions: separate rule about users and rule about what is allowed in such functions (rust-lang/reference#2013) - use "tuple enum variant" more consistently (rust-lang/reference#2015) - Remove caveats related to `format_args!` expansion (rust-lang/reference#2017) - RISC-V: Extension Updates (including document references) (rust-lang/reference#2002) - Move inferred sentence to an example block (rust-lang/reference#2019) - Add triagebot range-diff feature (rust-lang/reference#2011) - use AND when searching for multiple terms (rust-lang/reference#2016) - enumerations.md: fix pluralisation (rust-lang/reference#2014) - const_eval.md: use sentence case for section title, for consistency (rust-lang/reference#2012) - destructors.md: improve readability by adding pauses (rust-lang/reference#2007) - RISC-V: Add vector state registers (rust-lang/reference#2005) - destructors.md: point to core:: instead of std:: (rust-lang/reference#2006) - Create Whitespace grammar productions (rust-lang/reference#1991)
Update books ## rust-lang/book 1 commits in 33f1af40cc44dde7e3e892f7a508e6f427d2cbc6..1d7c3e6abec2d5a9bfac798b29b7855b95025426 2025-09-28 21:24:16 UTC to 2025-09-28 21:24:16 UTC - Chunk of chapters from copyedit (rust-lang/book#4506) ## rust-lang/edition-guide 1 commits in aa6ce337c0adf7a63e33960d184270f2a45ab9ef..e2ed891f00361efc26616d82590b1c85d7a8920e 2025-10-01 17:11:54 UTC to 2025-10-01 17:11:54 UTC - link to never type fallback lint as deny by default (rust-lang/edition-guide#377) ## rust-lang/nomicon 1 commits in f17a018b9989430967d1c58e9a12c51169abc744..23fc2682f8fcb887f77d0eaabba708809f834c11 2025-09-24 10:10:31 UTC to 2025-09-24 10:10:31 UTC - a typo in ffi.md (rust-lang/nomicon#502) ## rust-lang/reference 13 commits in cc7247d8dfaef4c39000bb12c55c32ba5b5ba976..e11adf6016a362766eea5a3f9832e193994dd0c8 2025-09-29 00:55:42 UTC to 2025-09-23 23:33:32 UTC - const functions: separate rule about users and rule about what is allowed in such functions (rust-lang/reference#2013) - use "tuple enum variant" more consistently (rust-lang/reference#2015) - Remove caveats related to `format_args!` expansion (rust-lang/reference#2017) - RISC-V: Extension Updates (including document references) (rust-lang/reference#2002) - Move inferred sentence to an example block (rust-lang/reference#2019) - Add triagebot range-diff feature (rust-lang/reference#2011) - use AND when searching for multiple terms (rust-lang/reference#2016) - enumerations.md: fix pluralisation (rust-lang/reference#2014) - const_eval.md: use sentence case for section title, for consistency (rust-lang/reference#2012) - destructors.md: improve readability by adding pauses (rust-lang/reference#2007) - RISC-V: Add vector state registers (rust-lang/reference#2005) - destructors.md: point to core:: instead of std:: (rust-lang/reference#2006) - Create Whitespace grammar productions (rust-lang/reference#1991)
Update books ## rust-lang/book 1 commits in 33f1af40cc44dde7e3e892f7a508e6f427d2cbc6..1d7c3e6abec2d5a9bfac798b29b7855b95025426 2025-09-28 21:24:16 UTC to 2025-09-28 21:24:16 UTC - Chunk of chapters from copyedit (rust-lang/book#4506) ## rust-lang/edition-guide 1 commits in aa6ce337c0adf7a63e33960d184270f2a45ab9ef..e2ed891f00361efc26616d82590b1c85d7a8920e 2025-10-01 17:11:54 UTC to 2025-10-01 17:11:54 UTC - link to never type fallback lint as deny by default (rust-lang/edition-guide#377) ## rust-lang/nomicon 1 commits in f17a018b9989430967d1c58e9a12c51169abc744..23fc2682f8fcb887f77d0eaabba708809f834c11 2025-09-24 10:10:31 UTC to 2025-09-24 10:10:31 UTC - a typo in ffi.md (rust-lang/nomicon#502) ## rust-lang/reference 13 commits in cc7247d8dfaef4c39000bb12c55c32ba5b5ba976..e11adf6016a362766eea5a3f9832e193994dd0c8 2025-09-29 00:55:42 UTC to 2025-09-23 23:33:32 UTC - const functions: separate rule about users and rule about what is allowed in such functions (rust-lang/reference#2013) - use "tuple enum variant" more consistently (rust-lang/reference#2015) - Remove caveats related to `format_args!` expansion (rust-lang/reference#2017) - RISC-V: Extension Updates (including document references) (rust-lang/reference#2002) - Move inferred sentence to an example block (rust-lang/reference#2019) - Add triagebot range-diff feature (rust-lang/reference#2011) - use AND when searching for multiple terms (rust-lang/reference#2016) - enumerations.md: fix pluralisation (rust-lang/reference#2014) - const_eval.md: use sentence case for section title, for consistency (rust-lang/reference#2012) - destructors.md: improve readability by adding pauses (rust-lang/reference#2007) - RISC-V: Add vector state registers (rust-lang/reference#2005) - destructors.md: point to core:: instead of std:: (rust-lang/reference#2006) - Create Whitespace grammar productions (rust-lang/reference#1991)
Update books ## rust-lang/book 1 commits in 33f1af40cc44dde7e3e892f7a508e6f427d2cbc6..1d7c3e6abec2d5a9bfac798b29b7855b95025426 2025-09-28 21:24:16 UTC to 2025-09-28 21:24:16 UTC - Chunk of chapters from copyedit (rust-lang/book#4506) ## rust-lang/edition-guide 1 commits in aa6ce337c0adf7a63e33960d184270f2a45ab9ef..e2ed891f00361efc26616d82590b1c85d7a8920e 2025-10-01 17:11:54 UTC to 2025-10-01 17:11:54 UTC - link to never type fallback lint as deny by default (rust-lang/edition-guide#377) ## rust-lang/nomicon 1 commits in f17a018b9989430967d1c58e9a12c51169abc744..23fc2682f8fcb887f77d0eaabba708809f834c11 2025-09-24 10:10:31 UTC to 2025-09-24 10:10:31 UTC - a typo in ffi.md (rust-lang/nomicon#502) ## rust-lang/reference 13 commits in cc7247d8dfaef4c39000bb12c55c32ba5b5ba976..e11adf6016a362766eea5a3f9832e193994dd0c8 2025-09-29 00:55:42 UTC to 2025-09-23 23:33:32 UTC - const functions: separate rule about users and rule about what is allowed in such functions (rust-lang/reference#2013) - use "tuple enum variant" more consistently (rust-lang/reference#2015) - Remove caveats related to `format_args!` expansion (rust-lang/reference#2017) - RISC-V: Extension Updates (including document references) (rust-lang/reference#2002) - Move inferred sentence to an example block (rust-lang/reference#2019) - Add triagebot range-diff feature (rust-lang/reference#2011) - use AND when searching for multiple terms (rust-lang/reference#2016) - enumerations.md: fix pluralisation (rust-lang/reference#2014) - const_eval.md: use sentence case for section title, for consistency (rust-lang/reference#2012) - destructors.md: improve readability by adding pauses (rust-lang/reference#2007) - RISC-V: Add vector state registers (rust-lang/reference#2005) - destructors.md: point to core:: instead of std:: (rust-lang/reference#2006) - Create Whitespace grammar productions (rust-lang/reference#1991)
Rollup merge of #147236 - rustbot:docs-update, r=ehuss Update books ## rust-lang/book 1 commits in 33f1af40cc44dde7e3e892f7a508e6f427d2cbc6..1d7c3e6abec2d5a9bfac798b29b7855b95025426 2025-09-28 21:24:16 UTC to 2025-09-28 21:24:16 UTC - Chunk of chapters from copyedit (rust-lang/book#4506) ## rust-lang/edition-guide 1 commits in aa6ce337c0adf7a63e33960d184270f2a45ab9ef..e2ed891f00361efc26616d82590b1c85d7a8920e 2025-10-01 17:11:54 UTC to 2025-10-01 17:11:54 UTC - link to never type fallback lint as deny by default (rust-lang/edition-guide#377) ## rust-lang/nomicon 1 commits in f17a018b9989430967d1c58e9a12c51169abc744..23fc2682f8fcb887f77d0eaabba708809f834c11 2025-09-24 10:10:31 UTC to 2025-09-24 10:10:31 UTC - a typo in ffi.md (rust-lang/nomicon#502) ## rust-lang/reference 13 commits in cc7247d8dfaef4c39000bb12c55c32ba5b5ba976..e11adf6016a362766eea5a3f9832e193994dd0c8 2025-09-29 00:55:42 UTC to 2025-09-23 23:33:32 UTC - const functions: separate rule about users and rule about what is allowed in such functions (rust-lang/reference#2013) - use "tuple enum variant" more consistently (rust-lang/reference#2015) - Remove caveats related to `format_args!` expansion (rust-lang/reference#2017) - RISC-V: Extension Updates (including document references) (rust-lang/reference#2002) - Move inferred sentence to an example block (rust-lang/reference#2019) - Add triagebot range-diff feature (rust-lang/reference#2011) - use AND when searching for multiple terms (rust-lang/reference#2016) - enumerations.md: fix pluralisation (rust-lang/reference#2014) - const_eval.md: use sentence case for section title, for consistency (rust-lang/reference#2012) - destructors.md: improve readability by adding pauses (rust-lang/reference#2007) - RISC-V: Add vector state registers (rust-lang/reference#2005) - destructors.md: point to core:: instead of std:: (rust-lang/reference#2006) - Create Whitespace grammar productions (rust-lang/reference#1991)
Update books ## rust-lang/book 1 commits in 33f1af40cc44dde7e3e892f7a508e6f427d2cbc6..1d7c3e6abec2d5a9bfac798b29b7855b95025426 2025-09-28 21:24:16 UTC to 2025-09-28 21:24:16 UTC - Chunk of chapters from copyedit (rust-lang/book#4506) ## rust-lang/edition-guide 1 commits in aa6ce337c0adf7a63e33960d184270f2a45ab9ef..e2ed891f00361efc26616d82590b1c85d7a8920e 2025-10-01 17:11:54 UTC to 2025-10-01 17:11:54 UTC - link to never type fallback lint as deny by default (rust-lang/edition-guide#377) ## rust-lang/nomicon 1 commits in f17a018b9989430967d1c58e9a12c51169abc744..23fc2682f8fcb887f77d0eaabba708809f834c11 2025-09-24 10:10:31 UTC to 2025-09-24 10:10:31 UTC - a typo in ffi.md (rust-lang/nomicon#502) ## rust-lang/reference 13 commits in cc7247d8dfaef4c39000bb12c55c32ba5b5ba976..e11adf6016a362766eea5a3f9832e193994dd0c8 2025-09-29 00:55:42 UTC to 2025-09-23 23:33:32 UTC - const functions: separate rule about users and rule about what is allowed in such functions (rust-lang/reference#2013) - use "tuple enum variant" more consistently (rust-lang/reference#2015) - Remove caveats related to `format_args!` expansion (rust-lang/reference#2017) - RISC-V: Extension Updates (including document references) (rust-lang/reference#2002) - Move inferred sentence to an example block (rust-lang/reference#2019) - Add triagebot range-diff feature (rust-lang/reference#2011) - use AND when searching for multiple terms (rust-lang/reference#2016) - enumerations.md: fix pluralisation (rust-lang/reference#2014) - const_eval.md: use sentence case for section title, for consistency (rust-lang/reference#2012) - destructors.md: improve readability by adding pauses (rust-lang/reference#2007) - RISC-V: Add vector state registers (rust-lang/reference#2005) - destructors.md: point to core:: instead of std:: (rust-lang/reference#2006) - Create Whitespace grammar productions (rust-lang/reference#1991)
Update books ## rust-lang/book 1 commits in 33f1af40cc44dde7e3e892f7a508e6f427d2cbc6..1d7c3e6abec2d5a9bfac798b29b7855b95025426 2025-09-28 21:24:16 UTC to 2025-09-28 21:24:16 UTC - Chunk of chapters from copyedit (rust-lang/book#4506) ## rust-lang/edition-guide 1 commits in aa6ce337c0adf7a63e33960d184270f2a45ab9ef..e2ed891f00361efc26616d82590b1c85d7a8920e 2025-10-01 17:11:54 UTC to 2025-10-01 17:11:54 UTC - link to never type fallback lint as deny by default (rust-lang/edition-guide#377) ## rust-lang/nomicon 1 commits in f17a018b9989430967d1c58e9a12c51169abc744..23fc2682f8fcb887f77d0eaabba708809f834c11 2025-09-24 10:10:31 UTC to 2025-09-24 10:10:31 UTC - a typo in ffi.md (rust-lang/nomicon#502) ## rust-lang/reference 13 commits in cc7247d8dfaef4c39000bb12c55c32ba5b5ba976..e11adf6016a362766eea5a3f9832e193994dd0c8 2025-09-29 00:55:42 UTC to 2025-09-23 23:33:32 UTC - const functions: separate rule about users and rule about what is allowed in such functions (rust-lang/reference#2013) - use "tuple enum variant" more consistently (rust-lang/reference#2015) - Remove caveats related to `format_args!` expansion (rust-lang/reference#2017) - RISC-V: Extension Updates (including document references) (rust-lang/reference#2002) - Move inferred sentence to an example block (rust-lang/reference#2019) - Add triagebot range-diff feature (rust-lang/reference#2011) - use AND when searching for multiple terms (rust-lang/reference#2016) - enumerations.md: fix pluralisation (rust-lang/reference#2014) - const_eval.md: use sentence case for section title, for consistency (rust-lang/reference#2012) - destructors.md: improve readability by adding pauses (rust-lang/reference#2007) - RISC-V: Add vector state registers (rust-lang/reference#2005) - destructors.md: point to core:: instead of std:: (rust-lang/reference#2006) - Create Whitespace grammar productions (rust-lang/reference#1991)
No description provided.