diff options
| author | Ralf Jung <post@ralfj.de> | 2019-08-28 09:44:48 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2019-09-15 14:25:30 +0200 |
| commit | 224e2e5e9e1d03db1a80455d08bb1d6d8686ec3a (patch) | |
| tree | bf504fd4fa59d87cbc88fb081e36582e150b02ea | |
| parent | 342481185255acef5e44af8023bab372314afe51 (diff) | |
| download | rust-224e2e5e9e1d03db1a80455d08bb1d6d8686ec3a.tar.gz rust-224e2e5e9e1d03db1a80455d08bb1d6d8686ec3a.zip | |
explain ty == None
| -rw-r--r-- | src/librustc_mir/interpret/intern.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/librustc_mir/interpret/intern.rs b/src/librustc_mir/interpret/intern.rs index 606f5064345..0031dbc4d0d 100644 --- a/src/librustc_mir/interpret/intern.rs +++ b/src/librustc_mir/interpret/intern.rs @@ -57,6 +57,8 @@ struct IsStaticOrFn; /// `mode` is the mode of the environment where we found this pointer. /// `mutablity` is the mutability of the place to be interned; even if that says /// `immutable` things might become mutable if `ty` is not frozen. +/// `ty` can be `None` if there is no potential interior mutability +/// to account for (e.g. for vtables). fn intern_shallow<'rt, 'mir, 'tcx>( ecx: &'rt mut CompileTimeEvalContext<'mir, 'tcx>, leftover_allocations: &'rt mut FxHashSet<AllocId>, @@ -97,6 +99,7 @@ fn intern_shallow<'rt, 'mir, 'tcx>( // read-only memory, and also by Miri when evluating other constants/statics that // access this one. if mode == InternMode::Static { + // When `ty` is `None`, we assume no interior mutability. let frozen = ty.map_or(true, |ty| ty.is_freeze( ecx.tcx.tcx, ecx.param_env, |
