assert that nobody asks for mutable constants

This commit is contained in:
Ralf Jung 2019-08-28 08:31:51 +02:00
parent 14e3506738
commit 3424811852

View File

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