From 6d03c8d751128ce064fac4f607e5478db41b04b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Tue, 28 Jun 2022 22:08:28 +0200 Subject: [PATCH] fix comments --- compiler/rustc_const_eval/src/interpret/intern.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_const_eval/src/interpret/intern.rs b/compiler/rustc_const_eval/src/interpret/intern.rs index 2655568090c..2f384247caa 100644 --- a/compiler/rustc_const_eval/src/interpret/intern.rs +++ b/compiler/rustc_const_eval/src/interpret/intern.rs @@ -168,10 +168,10 @@ impl<'rt, 'mir, 'tcx: 'mir, M: CompileTimeMachine<'mir, 'tcx, const_eval::Memory mplace: &MPlaceTy<'tcx>, fields: impl Iterator>, ) -> InterpResult<'tcx> { - // We want to walk the aggregate to look for reference types to intern. While doing that we + // We want to walk the aggregate to look for references to intern. While doing that we // also need to take special care of interior mutability. // - // As an optimization, however, if the allocation does not contain any pointers: we don't + // As an optimization, however, if the allocation does not contain any references: we don't // need to do the walk. It can be costly for big arrays for example (e.g. issue #93215). let is_walk_needed = |mplace: &MPlaceTy<'tcx>| -> InterpResult<'tcx, bool> { // ZSTs cannot contain pointers, we can avoid the interning walk. @@ -179,7 +179,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: CompileTimeMachine<'mir, 'tcx, const_eval::Memory return Ok(false); } - // Now, check whether this allocation contains reference types (as relocations). + // Now, check whether this allocation could contain references. // // Note, this check may sometimes not be cheap, so we only do it when the walk we'd like // 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 return Ok(true); }; - // If there are no refs or relocations in this allocation, we can avoid the - // interning walk. + // If there are no relocations in this allocation, it does not contain references + // that point to another allocation, and we can avoid the interning walk. if let Some(alloc) = self.ecx.get_ptr_alloc(mplace.ptr, size, align)? { if !alloc.has_relocations() { return Ok(false);