Skip to content

Commit

Permalink
fine-tune comment
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung authored and zachs18 committed Feb 20, 2025
1 parent 6493cd8 commit e3f5db0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions compiler/rustc_const_eval/src/interpret/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1264,12 +1264,11 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValueVisitor<'tcx, M> for ValidityVisitor<'rt,
}
}

// *After* all of this, check the ABI. We need to check the ABI to handle
// types like `NonNull` where the `Scalar` info is more restrictive than what
// the fields say (`rustc_layout_scalar_valid_range_start`).
// But in most cases, this will just propagate what the fields say,
// and then we want the error to point at the field -- so, first recurse,
// then check ABI.
// *After* all of this, check further information stored in the layout. We need to check
// this to handle types like `NonNull` where the `Scalar` info is more restrictive than what
// the fields say (`rustc_layout_scalar_valid_range_start`). But in most cases, this will
// just propagate what the fields say, and then we want the error to point at the field --
// so, we first recurse, then we do this check.
//
// FIXME: We could avoid some redundant checks here. For newtypes wrapping
// scalars, we do the same check on every "level" (e.g., first we check
Expand Down

0 comments on commit e3f5db0

Please sign in to comment.