@@ -252,7 +252,9 @@ impl<'tcx, Tag: Provenance> ImmTy<'tcx, Tag> {
252252impl < ' mir , ' tcx : ' mir , M : Machine < ' mir , ' tcx > > InterpCx < ' mir , ' tcx , M > {
253253 /// Try reading an immediate in memory; this is interesting particularly for `ScalarPair`.
254254 /// Returns `None` if the layout does not permit loading this as a value.
255- fn try_read_immediate_from_mplace (
255+ ///
256+ /// This is an internal function; call `read_immediate` instead.
257+ fn read_immediate_from_mplace_raw (
256258 & self ,
257259 mplace : & MPlaceTy < ' tcx , M :: PointerTag > ,
258260 force : bool ,
@@ -312,24 +314,25 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
312314 return Ok ( None ) ;
313315 }
314316
315- /// Try returning an immediate for the operand.
316- /// If the layout does not permit loading this as an immediate, return where in memory
317- /// we can find the data.
317+ /// Try returning an immediate for the operand. If the layout does not permit loading this as an
318+ /// immediate, return where in memory we can find the data.
318319 /// Note that for a given layout, this operation will either always fail or always
319320 /// succeed! Whether it succeeds depends on whether the layout can be represented
320321 /// in an `Immediate`, not on which data is stored there currently.
321322 ///
322323 /// If `force` is `true`, then even scalars with fields that can be ununit will be
323324 /// read. This means the load is lossy and should not be written back!
324325 /// This flag exists only for validity checking.
325- pub fn try_read_immediate (
326+ ///
327+ /// This is an internal function that should not usually be used; call `read_immediate` instead.
328+ pub fn read_immediate_raw (
326329 & self ,
327330 src : & OpTy < ' tcx , M :: PointerTag > ,
328331 force : bool ,
329332 ) -> InterpResult < ' tcx , Result < ImmTy < ' tcx , M :: PointerTag > , MPlaceTy < ' tcx , M :: PointerTag > > > {
330333 Ok ( match src. try_as_mplace ( ) {
331334 Ok ( ref mplace) => {
332- if let Some ( val) = self . try_read_immediate_from_mplace ( mplace, force) ? {
335+ if let Some ( val) = self . read_immediate_from_mplace_raw ( mplace, force) ? {
333336 Ok ( val)
334337 } else {
335338 Err ( * mplace)
@@ -345,7 +348,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
345348 & self ,
346349 op : & OpTy < ' tcx , M :: PointerTag > ,
347350 ) -> InterpResult < ' tcx , ImmTy < ' tcx , M :: PointerTag > > {
348- if let Ok ( imm) = self . try_read_immediate ( op, /*force*/ false ) ? {
351+ if let Ok ( imm) = self . read_immediate_raw ( op, /*force*/ false ) ? {
349352 Ok ( imm)
350353 } else {
351354 span_bug ! ( self . cur_span( ) , "primitive read failed for type: {:?}" , op. layout. ty) ;
0 commit comments