Skip to content

Commit 50559ce

Browse files
committed
Valtrees for primitive types are fine.
1 parent f6aa3ee commit 50559ce

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/rustc_middle/src/mir/consts.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,9 @@ impl<'tcx> Const<'tcx> {
509509
Const::Ty(c) => match c.kind() {
510510
ty::ConstKind::Param(..) => true,
511511
// A valtree may be a reference. Valtree references correspond to a
512-
// different allocation each time they are evaluated.
513-
ty::ConstKind::Value(_) => false,
512+
// different allocation each time they are evaluated. Valtrees for primitive
513+
// types are fine though.
514+
ty::ConstKind::Value(_) => c.ty().is_primitive(),
514515
ty::ConstKind::Unevaluated(..) | ty::ConstKind::Expr(..) => false,
515516
// Should not appear in runtime MIR.
516517
ty::ConstKind::Infer(..)

0 commit comments

Comments
 (0)