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

ConstOperand is duplicated and mir::Const is missing #71

Open
RalfJung opened this issue Mar 23, 2024 · 1 comment · Fixed by rust-lang/rust#126410
Open

ConstOperand is duplicated and mir::Const is missing #71

RalfJung opened this issue Mar 23, 2024 · 1 comment · Fixed by rust-lang/rust#126410

Comments

@RalfJung
Copy link
Member

In rustc, the main types related to consts are

  • ty::Const: a const that appears in the type system e.g. an array length or a const generic. These must always be valtree-compatible.
  • mir::Const: a const that appears in MIR. These can have arbitrary type.
  • mir::ConstOperand: basically a Spanned<mir::Const> but also with some user_ty thing where I honestly don't know what it is for

smir has mir::ConstOperand as well. However it also has mir::Constant which is an exact duplicate of mir::ConstOperand up to field renaming! And furthermore, there is nothing that corresponds to rustc's mir::Const, which is odd.

@RalfJung
Copy link
Member Author

With rust-lang/rust#125967, mir::Const now exists as MirConst.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jun 15, 2024
…-obk

smir: merge identical Constant and ConstOperand types

The first commit renames the const operand visitor functions on regular MIR to match the type name, that was forgotten in the original rename.

The second commit changes stable MIR, fixing rust-lang/project-stable-mir#71. Previously there were two different smir types for the MIR type `ConstOperand`, one used in `Operand` and one in `VarDebugInfoContents`.

Maybe we should have done this with rust-lang#125967, so there's only a single breaking change... but I saw that PR too late.

Fixes rust-lang/project-stable-mir#71
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jun 15, 2024
Rollup merge of rust-lang#126410 - RalfJung:smir-const-operand, r=oli-obk

smir: merge identical Constant and ConstOperand types

The first commit renames the const operand visitor functions on regular MIR to match the type name, that was forgotten in the original rename.

The second commit changes stable MIR, fixing rust-lang/project-stable-mir#71. Previously there were two different smir types for the MIR type `ConstOperand`, one used in `Operand` and one in `VarDebugInfoContents`.

Maybe we should have done this with rust-lang#125967, so there's only a single breaking change... but I saw that PR too late.

Fixes rust-lang/project-stable-mir#71
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant