Skip to content
Permalink
Browse files

assert that nobody asks for mutable constants

  • Loading branch information...
RalfJung committed Aug 28, 2019
1 parent 14e3506 commit 342481185255acef5e44af8023bab372314afe51
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/librustc_mir/interpret/intern.rs
@@ -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
// initial value was computed.
// Constants are never mutable.
assert_eq!(
mutability, Mutability::Immutable,
"Something went very wrong: mutability requested for a constant"
);
alloc.mutability = Mutability::Immutable;
};
// link the alloc id to the actual allocation

0 comments on commit 3424811

Please sign in to comment.
You can’t perform that action at this time.