

const_eval: allow function pointer signatures containing &mut T in const con...
source link: https://github.com/rust-lang/rust/pull/116015
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

const_eval: allow function pointer signatures containing &mut T in const contexts #116015
Conversation
Contributor
potentially fixes #114994
We utilize a TypeVisitor
here in order to more easily handle control flow.
- In the event the typekind the Visitor sees is a function pointer, we skip over it
- However, otherwise we do one of two things:
- If we find a mutable reference, check it, then continue visiting types
- If we find any other type, continue visiting types
This means we will check if the function pointer itself is mutable, but not if any of the types within are.
Collaborator
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cjgillot (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Contributor
cc @oli-obk as it touches const-fn checks. |
added T-lang Relevant to the language team, which will review and decide on the PR/issue. I-lang-nominated Indicates that an issue has been nominated for discussion during a lang team meeting.
and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Contributor
Nominating for T-lang FCP as this enables more code to compile. Specifically this allows mutable references in |
Contributor
@rfcbot fcp merge |
Team member @tmandry has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it.
labels
Contributor
@oli-obk I'm fine with this PR, but it'd be nice to have examples of other places where |
Contributor
@rfcbot reviewed |
@nikomatsakis: See #57349 for the remaining blockers for |
added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised.
and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.
labels
🔔 This is now entering its final comment period, as per the review above. 🔔 |
Member
Cc @rust-lang/wg-const-eval |
removed the I-lang-nominated Indicates that an issue has been nominated for discussion during a lang team meeting. label
added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting
and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised.
labels
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
Contributor
@bors r+ |
added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
labels
Contributor
⌛ Testing commit d975ae5 with merge 2104b0df847b11a4e8ffa9aeca363838e5cc4830... |
Contributor
💔 Test failed - checks-actions |
added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
labels
Contributor
@bors retry |
added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
labels
Contributor
☀️ Test successful - checks-actions |
Collaborator
Finished benchmarking commit (139f63a): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)Results CyclesResults Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 627.527s -> 628.233s (0.11%) |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Successfully merging this pull request may close these issues.
Function pointer signature containing &mut T
should work in const context
Recommend
-
8
Future::join and const-eval— 2021-01-16 Happy new year everyone! Today we're trying something new: less of a blog post, more of research notes. This is less of a "here's something I've concluded",...
-
10
Function alias vs Function pointer alias Last weekend (4/4/2021) I was sitting down and working on my San Diego C++ agenda for the 25th upcoming session.
-
13
The function pointer to the __attribute __ ((const)) function? advertisements How (in GCC/"GNU C") do you declare a function pointer which poi...
-
8
New issue Allow ~const bounds on trait assoc functions #88418
-
4
Provide some examples of the const keyword and it’s use with pointers The const keyword is used when we want to make something – like a variable – have read-only access. Here’s a simple example of the const keyword: Simple...
-
15
Conversation Member
-
10
Const Eval (Un)Safety Rules Sept. 15, 2022 · Felix Klock on behalf of The Compiler Team ...
-
8
本文简单介绍了const对象的作用、初始化及其有效区,并展开说明了const与引用和指针结合之后的使用方法和注意点。 const用来定义一个常量,也就是一个不可修改的变量。在程序中,我们通常需要用到一种变量,在整个程序的生命周期都不会发生改变...
-
9
allow mutating function args through &raw const #111517
-
6
const-eval: make misalignment a hard error #115524 Merged ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK