diff options
| author | bors <bors@rust-lang.org> | 2025-01-26 09:26:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-01-26 09:26:34 +0000 |
| commit | d9b4598d7e8ce233b8bd4fe89182b759238ea246 (patch) | |
| tree | 58acc5b6358a87f5beefff60fba7e917085a0d66 /compiler/rustc_mir_transform/src/instsimplify.rs | |
| parent | c2270becb63d4c52a2740137db2e9b49246f9362 (diff) | |
| parent | e9a566002dc3ca20920baa70ba3bf59c2798819a (diff) | |
| download | rust-d9b4598d7e8ce233b8bd4fe89182b759238ea246.tar.gz rust-d9b4598d7e8ce233b8bd4fe89182b759238ea246.zip | |
Auto merge of #135753 - compiler-errors:from-ty-const, r=oli-obk
Get rid of `mir::Const::from_ty_const` This function is strange, because it turns valtrees into `mir::Const::Value`, but the rest of the const variants stay as type system consts. All of the callsites except for one in `instsimplify` (array length simplification of `ptr_metadata` call) just go through the valtree arm of the function, so it's easier to just create a `mir::Const` directly for those. For the instsimplify case, if we have a type system const we should *keep* having a type system const, rather than turning it into a `mir::Const::Value`; it doesn't really matter in practice, though, bc `usize` has no padding, but it feels more principled.
Diffstat (limited to 'compiler/rustc_mir_transform/src/instsimplify.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/instsimplify.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_mir_transform/src/instsimplify.rs b/compiler/rustc_mir_transform/src/instsimplify.rs index 090dcee4261..4b9ebd40b85 100644 --- a/compiler/rustc_mir_transform/src/instsimplify.rs +++ b/compiler/rustc_mir_transform/src/instsimplify.rs @@ -171,7 +171,7 @@ impl<'tcx> InstSimplifyContext<'_, 'tcx> { if let Rvalue::Len(ref place) = *rvalue { let place_ty = place.ty(self.local_decls, self.tcx).ty; if let ty::Array(_, len) = *place_ty.kind() { - let const_ = Const::from_ty_const(len, self.tcx.types.usize, self.tcx); + let const_ = Const::Ty(self.tcx.types.usize, len); let constant = ConstOperand { span: DUMMY_SP, const_, user_ty: None }; *rvalue = Rvalue::Use(Operand::Constant(Box::new(constant))); } |
