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

use is_inside_const_context for in_constant util fn #10679

Merged
merged 1 commit into from
Apr 23, 2023

Conversation

y21
Copy link
Member

@y21 y21 commented Apr 20, 2023

Fixes #10452.

This PR improves the in_constant util function to detect more cases of const contexts. Previously this function would not detect cases like expressions in array length position or expression in an inline const block const { .. }.

changelog: [bool_to_int_with_if]: recognize array length operand as being in a const context and don't suggest usize::from there

@rustbot
Copy link
Collaborator

rustbot commented Apr 20, 2023

r? @Jarcho

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 20, 2023
@y21 y21 changed the title use is_inside_const_context for in_constant util fn use is_inside_const_context for in_constant util fn Apr 20, 2023
@Jarcho
Copy link
Contributor

Jarcho commented Apr 23, 2023

Nice that there's a function in rustc for that now.

Thank you. @bors r+

@bors
Copy link
Collaborator

bors commented Apr 23, 2023

📌 Commit 654d12f has been approved by Jarcho

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Apr 23, 2023

⌛ Testing commit 654d12f with merge 496c110...

@bors
Copy link
Collaborator

bors commented Apr 23, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Jarcho
Pushing 496c110 to master...

@bors bors merged commit 496c110 into rust-lang:master Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FP bool-to-int-with-if in const context
4 participants