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

add check for ConstKind::Value(_) to in_operand() #113107

Merged
merged 2 commits into from
Jun 29, 2023

Conversation

mj10021
Copy link
Contributor

@mj10021 mj10021 commented Jun 27, 2023

Added check for valtree value to close #113012 which fixes the issue, although I am not sure if adding the check there is sound or not cc @oli-obk

@rustbot
Copy link
Collaborator

rustbot commented Jun 27, 2023

r? @davidtwco

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

@rustbot rustbot 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 Jun 27, 2023
@mj10021
Copy link
Contributor Author

mj10021 commented Jun 27, 2023

should I add a copy the example from the issue into a test?

@oli-obk
Copy link
Contributor

oli-obk commented Jun 28, 2023

It's not wronger than the code path for ConstantKind::Val(..), though we should analyze at some point whether either of these are entirely correct here. Please remove the valtree fixme above now that valtrees are addressed.

@davidtwco
Copy link
Member

r? @oli-obk

@rustbot rustbot assigned oli-obk and unassigned davidtwco Jun 28, 2023
@mj10021
Copy link
Contributor Author

mj10021 commented Jun 28, 2023

It's not wronger than the code path for ConstantKind::Val(..), though we should analyze at some point whether either of these are entirely correct here. Please remove the valtree fixme above now that valtrees are addressed.

Happy to do any work on that if it would be helpful, although I probably would need some guidance

@oli-obk
Copy link
Contributor

oli-obk commented Jun 28, 2023

@bors r+ rollup

Happy to do any work on that if it would be helpful, although I probably would need some guidance

I believe the ConstValue::Val and ConstKind::Value cases can only happen for primitives, as they come from literals (1, "foo", ...). So what we could do is check that the type is a type that can't possibly violate any of the checks that we have here (&str, the inter and float types, &[u8], I think those are all that could show up here).

@bors
Copy link
Contributor

bors commented Jun 28, 2023

📌 Commit 71362c7 has been approved by oli-obk

It is now in the queue for this repository.

@bors bors 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 Jun 28, 2023
@mj10021
Copy link
Contributor Author

mj10021 commented Jun 28, 2023

@bors r+ rollup

Happy to do any work on that if it would be helpful, although I probably would need some guidance

I believe the ConstValue::Val and ConstKind::Value cases can only happen for primitives, as they come from literals (1, "foo", ...). So what we could do is check that the type is a type that can't possibly violate any of the checks that we have here (&str, the inter and float types, &[u8], I think those are all that could show up here).

Ok great I can give that a go

bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 29, 2023
Rollup of 5 pull requests

Successful merges:

 - rust-lang#112946 (Improve cgu naming and ordering)
 - rust-lang#113048 (Fix build on Solaris where fd-lock cannot be used.)
 - rust-lang#113100 (Fix display of long items in search results)
 - rust-lang#113107 (add check for ConstKind::Value(_) to in_operand())
 - rust-lang#113119 (rustdoc: Reduce internal function visibility.)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 74d6958 into rust-lang:master Jun 29, 2023
11 checks passed
@rustbot rustbot added this to the 1.72.0 milestone Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE with range pattern inside struct initializer at compile time
5 participants