-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const #115972
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
r? @oli-obk
the |
This comment has been minimized.
This comment has been minimized.
(why did triagebot not ping me for the cg_clif changes?) |
It didn't ping anyone for the interpreter changes either. rustbot just entirely missed this PR in terms of pinging people. |
1ef572a
to
5f773d2
Compare
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 This PR changes MIR cc @oli-obk, @RalfJung, @JakobDegen, @davidtwco, @celinval, @vakaras This PR changes Stable MIR cc @oli-obk, @celinval, @spastorino Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes might have occurred in exhaustiveness checking cc @Nadrieril Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri |
Done that.
I went with |
This comment has been minimized.
This comment has been minimized.
5f773d2
to
c94410c
Compare
@bors r+ p=1 bitrotty |
rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const Also, be more consistent with the `to/eval_bits` methods... we had some that take a type and some that take a size, and then sometimes the one that takes a type is called `bits_for_ty`. Turns out that `ty::Const`/`mir::ConstKind` carry their type with them, so we don't need to even pass the type to those `eval_bits` functions at all. However this is not properly consistent yet: in `ty` we have most of the methods on `ty::Const`, but in `mir` we have them on `mir::ConstKind`. And indeed those two types are the ones that correspond to each other. So `mir::ConstantKind` should actually be renamed to `mir::Const`. But what to do with `mir::Constant`? It carries around a span, that's really more like a constant operand that appears as a MIR operand... it's more suited for `syntax.rs` than `consts.rs`, but the bigger question is, which name should it get if we want to align the `mir` and `ty` types? `ConstOperand`? `ConstOp`? `Literal`? It's not a literal but it has a field called `literal` so it would at least be consistently wrong-ish... `@oli-obk` any ideas?
…llaumeGomez Rollup of 5 pull requests Successful merges: - rust-lang#104385 (Raise minimum supported Apple OS versions) - rust-lang#115936 (Prevent promotion of const fn calls in inline consts) - rust-lang#115972 (rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const) - rust-lang#116007 (Call panic_display directly in const_panic_fmt.) - rust-lang#116019 (Delete obsolete `--disable-per-crate-search` rustdoc flag) r? `@ghost` `@rustbot` modify labels: rollup
…llaumeGomez Rollup of 5 pull requests Successful merges: - rust-lang#115257 (Improve invalid UTF-8 lint by finding the expression initializer) - rust-lang#115936 (Prevent promotion of const fn calls in inline consts) - rust-lang#115972 (rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const) - rust-lang#116007 (Call panic_display directly in const_panic_fmt.) - rust-lang#116019 (Delete obsolete `--disable-per-crate-search` rustdoc flag) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#115972 - RalfJung:const-consistency, r=oli-obk rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const Also, be more consistent with the `to/eval_bits` methods... we had some that take a type and some that take a size, and then sometimes the one that takes a type is called `bits_for_ty`. Turns out that `ty::Const`/`mir::ConstKind` carry their type with them, so we don't need to even pass the type to those `eval_bits` functions at all. However this is not properly consistent yet: in `ty` we have most of the methods on `ty::Const`, but in `mir` we have them on `mir::ConstKind`. And indeed those two types are the ones that correspond to each other. So `mir::ConstantKind` should actually be renamed to `mir::Const`. But what to do with `mir::Constant`? It carries around a span, that's really more like a constant operand that appears as a MIR operand... it's more suited for `syntax.rs` than `consts.rs`, but the bigger question is, which name should it get if we want to align the `mir` and `ty` types? `ConstOperand`? `ConstOp`? `Literal`? It's not a literal but it has a field called `literal` so it would at least be consistently wrong-ish... ``@oli-obk`` any ideas?
FWIW smir still uses the old names, I was not sure what the process was for changing those. We should align them with the new internal names eventually, I hope. |
Yea, we'll clean up on the SMIR side ourselves |
rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const Also, be more consistent with the `to/eval_bits` methods... we had some that take a type and some that take a size, and then sometimes the one that takes a type is called `bits_for_ty`. Turns out that `ty::Const`/`mir::ConstKind` carry their type with them, so we don't need to even pass the type to those `eval_bits` functions at all. However this is not properly consistent yet: in `ty` we have most of the methods on `ty::Const`, but in `mir` we have them on `mir::ConstKind`. And indeed those two types are the ones that correspond to each other. So `mir::ConstantKind` should actually be renamed to `mir::Const`. But what to do with `mir::Constant`? It carries around a span, that's really more like a constant operand that appears as a MIR operand... it's more suited for `syntax.rs` than `consts.rs`, but the bigger question is, which name should it get if we want to align the `mir` and `ty` types? `ConstOperand`? `ConstOp`? `Literal`? It's not a literal but it has a field called `literal` so it would at least be consistently wrong-ish... ``@oli-obk`` any ideas?
rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const Also, be more consistent with the `to/eval_bits` methods... we had some that take a type and some that take a size, and then sometimes the one that takes a type is called `bits_for_ty`. Turns out that `ty::Const`/`mir::ConstKind` carry their type with them, so we don't need to even pass the type to those `eval_bits` functions at all. However this is not properly consistent yet: in `ty` we have most of the methods on `ty::Const`, but in `mir` we have them on `mir::ConstKind`. And indeed those two types are the ones that correspond to each other. So `mir::ConstantKind` should actually be renamed to `mir::Const`. But what to do with `mir::Constant`? It carries around a span, that's really more like a constant operand that appears as a MIR operand... it's more suited for `syntax.rs` than `consts.rs`, but the bigger question is, which name should it get if we want to align the `mir` and `ty` types? `ConstOperand`? `ConstOp`? `Literal`? It's not a literal but it has a field called `literal` so it would at least be consistently wrong-ish... ``@oli-obk`` any ideas?
Also, be more consistent with the
to/eval_bits
methods... we had some that take a type and some that take a size, and then sometimes the one that takes a type is calledbits_for_ty
.Turns out that
ty::Const
/mir::ConstKind
carry their type with them, so we don't need to even pass the type to thoseeval_bits
functions at all.However this is not properly consistent yet: in
ty
we have most of the methods onty::Const
, but inmir
we have them onmir::ConstKind
. And indeed those two types are the ones that correspond to each other. Somir::ConstantKind
should actually be renamed tomir::Const
. But what to do withmir::Constant
? It carries around a span, that's really more like a constant operand that appears as a MIR operand... it's more suited forsyntax.rs
thanconsts.rs
, but the bigger question is, which name should it get if we want to align themir
andty
types?ConstOperand
?ConstOp
?Literal
? It's not a literal but it has a field calledliteral
so it would at least be consistently wrong-ish...@oli-obk any ideas?