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.
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 aSpanned<mir::Const>
but also with someuser_ty
thing where I honestly don't know what it is forsmir has
mir::ConstOperand
as well. However it also hasmir::Constant
which is an exact duplicate ofmir::ConstOperand
up to field renaming! And furthermore, there is nothing that corresponds to rustc'smir::Const
, which is odd.