Skip to content

Commit 3424811

Browse files
committed
assert that nobody asks for mutable constants
1 parent 14e3506 commit 3424811

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/librustc_mir/interpret/intern.rs

+4
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ fn intern_shallow<'rt, 'mir, 'tcx>(
116116
// But we still intern that as immutable as the memory cannot be changed once the
117117
// initial value was computed.
118118
// Constants are never mutable.
119+
assert_eq!(
120+
mutability, Mutability::Immutable,
121+
"Something went very wrong: mutability requested for a constant"
122+
);
119123
alloc.mutability = Mutability::Immutable;
120124
};
121125
// link the alloc id to the actual allocation

0 commit comments

Comments
 (0)