Skip to content

Commit 6d03c8d

Browse files
committed
fix comments
1 parent c9772d7 commit 6d03c8d

File tree

1 file changed

+5
-5
lines changed
  • compiler/rustc_const_eval/src/interpret

1 file changed

+5
-5
lines changed

compiler/rustc_const_eval/src/interpret/intern.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -168,18 +168,18 @@ impl<'rt, 'mir, 'tcx: 'mir, M: CompileTimeMachine<'mir, 'tcx, const_eval::Memory
168168
mplace: &MPlaceTy<'tcx>,
169169
fields: impl Iterator<Item = InterpResult<'tcx, Self::V>>,
170170
) -> InterpResult<'tcx> {
171-
// We want to walk the aggregate to look for reference types to intern. While doing that we
171+
// We want to walk the aggregate to look for references to intern. While doing that we
172172
// also need to take special care of interior mutability.
173173
//
174-
// As an optimization, however, if the allocation does not contain any pointers: we don't
174+
// As an optimization, however, if the allocation does not contain any references: we don't
175175
// need to do the walk. It can be costly for big arrays for example (e.g. issue #93215).
176176
let is_walk_needed = |mplace: &MPlaceTy<'tcx>| -> InterpResult<'tcx, bool> {
177177
// ZSTs cannot contain pointers, we can avoid the interning walk.
178178
if mplace.layout.is_zst() {
179179
return Ok(false);
180180
}
181181

182-
// Now, check whether this allocation contains reference types (as relocations).
182+
// Now, check whether this allocation could contain references.
183183
//
184184
// Note, this check may sometimes not be cheap, so we only do it when the walk we'd like
185185
// to avoid could be expensive: on the potentially larger types, arrays and slices,
@@ -191,8 +191,8 @@ impl<'rt, 'mir, 'tcx: 'mir, M: CompileTimeMachine<'mir, 'tcx, const_eval::Memory
191191
return Ok(true);
192192
};
193193

194-
// If there are no refs or relocations in this allocation, we can avoid the
195-
// interning walk.
194+
// If there are no relocations in this allocation, it does not contain references
195+
// that point to another allocation, and we can avoid the interning walk.
196196
if let Some(alloc) = self.ecx.get_ptr_alloc(mplace.ptr, size, align)? {
197197
if !alloc.has_relocations() {
198198
return Ok(false);

0 commit comments

Comments
 (0)