Skip to content

Commit b62d978

Browse files
committed
rename EvalResult to InterpResult
fix tidy error remove unnecessary whitespace
1 parent 428943c commit b62d978

21 files changed

+257
-254
lines changed

src/librustc/mir/interpret/allocation.rs

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! The virtual memory representation of the MIR interpreter.
22
33
use super::{
4-
Pointer, EvalResult, AllocId, ScalarMaybeUndef, write_target_uint, read_target_uint, Scalar,
4+
Pointer, InterpResult, AllocId, ScalarMaybeUndef, write_target_uint, read_target_uint, Scalar,
55
truncate,
66
};
77

@@ -62,7 +62,7 @@ pub trait AllocationExtra<Tag, MemoryExtra>: ::std::fmt::Debug + Clone {
6262
_alloc: &Allocation<Tag, Self>,
6363
_ptr: Pointer<Tag>,
6464
_size: Size,
65-
) -> EvalResult<'tcx> {
65+
) -> InterpResult<'tcx> {
6666
Ok(())
6767
}
6868

@@ -72,7 +72,7 @@ pub trait AllocationExtra<Tag, MemoryExtra>: ::std::fmt::Debug + Clone {
7272
_alloc: &mut Allocation<Tag, Self>,
7373
_ptr: Pointer<Tag>,
7474
_size: Size,
75-
) -> EvalResult<'tcx> {
75+
) -> InterpResult<'tcx> {
7676
Ok(())
7777
}
7878

@@ -83,7 +83,7 @@ pub trait AllocationExtra<Tag, MemoryExtra>: ::std::fmt::Debug + Clone {
8383
_alloc: &mut Allocation<Tag, Self>,
8484
_ptr: Pointer<Tag>,
8585
_size: Size,
86-
) -> EvalResult<'tcx> {
86+
) -> InterpResult<'tcx> {
8787
Ok(())
8888
}
8989
}
@@ -140,7 +140,7 @@ impl<'tcx, Tag, Extra> Allocation<Tag, Extra> {
140140
fn check_bounds_ptr(
141141
&self,
142142
ptr: Pointer<Tag>,
143-
) -> EvalResult<'tcx> {
143+
) -> InterpResult<'tcx> {
144144
let allocation_size = self.bytes.len() as u64;
145145
ptr.check_in_alloc(Size::from_bytes(allocation_size), InboundsCheck::Live)
146146
}
@@ -152,7 +152,7 @@ impl<'tcx, Tag, Extra> Allocation<Tag, Extra> {
152152
cx: &impl HasDataLayout,
153153
ptr: Pointer<Tag>,
154154
size: Size,
155-
) -> EvalResult<'tcx> {
155+
) -> InterpResult<'tcx> {
156156
// if ptr.offset is in bounds, then so is ptr (because offset checks for overflow)
157157
self.check_bounds_ptr(ptr.offset(size, cx)?)
158158
}
@@ -173,7 +173,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
173173
ptr: Pointer<Tag>,
174174
size: Size,
175175
check_defined_and_ptr: bool,
176-
) -> EvalResult<'tcx, &[u8]>
176+
) -> InterpResult<'tcx, &[u8]>
177177
// FIXME: Working around https://github.com/rust-lang/rust/issues/56209
178178
where Extra: AllocationExtra<Tag, MemoryExtra>
179179
{
@@ -201,7 +201,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
201201
cx: &impl HasDataLayout,
202202
ptr: Pointer<Tag>,
203203
size: Size,
204-
) -> EvalResult<'tcx, &[u8]>
204+
) -> InterpResult<'tcx, &[u8]>
205205
// FIXME: Working around https://github.com/rust-lang/rust/issues/56209
206206
where Extra: AllocationExtra<Tag, MemoryExtra>
207207
{
@@ -216,7 +216,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
216216
cx: &impl HasDataLayout,
217217
ptr: Pointer<Tag>,
218218
size: Size,
219-
) -> EvalResult<'tcx, &[u8]>
219+
) -> InterpResult<'tcx, &[u8]>
220220
// FIXME: Working around https://github.com/rust-lang/rust/issues/56209
221221
where Extra: AllocationExtra<Tag, MemoryExtra>
222222
{
@@ -230,7 +230,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
230230
cx: &impl HasDataLayout,
231231
ptr: Pointer<Tag>,
232232
size: Size,
233-
) -> EvalResult<'tcx, &mut [u8]>
233+
) -> InterpResult<'tcx, &mut [u8]>
234234
// FIXME: Working around https://github.com/rust-lang/rust/issues/56209
235235
where Extra: AllocationExtra<Tag, MemoryExtra>
236236
{
@@ -257,7 +257,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
257257
&self,
258258
cx: &impl HasDataLayout,
259259
ptr: Pointer<Tag>,
260-
) -> EvalResult<'tcx, &[u8]>
260+
) -> InterpResult<'tcx, &[u8]>
261261
// FIXME: Working around https://github.com/rust-lang/rust/issues/56209
262262
where Extra: AllocationExtra<Tag, MemoryExtra>
263263
{
@@ -284,7 +284,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
284284
ptr: Pointer<Tag>,
285285
size: Size,
286286
allow_ptr_and_undef: bool,
287-
) -> EvalResult<'tcx>
287+
) -> InterpResult<'tcx>
288288
// FIXME: Working around https://github.com/rust-lang/rust/issues/56209
289289
where Extra: AllocationExtra<Tag, MemoryExtra>
290290
{
@@ -306,7 +306,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
306306
cx: &impl HasDataLayout,
307307
ptr: Pointer<Tag>,
308308
src: &[u8],
309-
) -> EvalResult<'tcx>
309+
) -> InterpResult<'tcx>
310310
// FIXME: Working around https://github.com/rust-lang/rust/issues/56209
311311
where Extra: AllocationExtra<Tag, MemoryExtra>
312312
{
@@ -322,7 +322,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
322322
ptr: Pointer<Tag>,
323323
val: u8,
324324
count: Size
325-
) -> EvalResult<'tcx>
325+
) -> InterpResult<'tcx>
326326
// FIXME: Working around https://github.com/rust-lang/rust/issues/56209
327327
where Extra: AllocationExtra<Tag, MemoryExtra>
328328
{
@@ -346,7 +346,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
346346
cx: &impl HasDataLayout,
347347
ptr: Pointer<Tag>,
348348
size: Size
349-
) -> EvalResult<'tcx, ScalarMaybeUndef<Tag>>
349+
) -> InterpResult<'tcx, ScalarMaybeUndef<Tag>>
350350
// FIXME: Working around https://github.com/rust-lang/rust/issues/56209
351351
where Extra: AllocationExtra<Tag, MemoryExtra>
352352
{
@@ -383,7 +383,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
383383
&self,
384384
cx: &impl HasDataLayout,
385385
ptr: Pointer<Tag>,
386-
) -> EvalResult<'tcx, ScalarMaybeUndef<Tag>>
386+
) -> InterpResult<'tcx, ScalarMaybeUndef<Tag>>
387387
// FIXME: Working around https://github.com/rust-lang/rust/issues/56209
388388
where Extra: AllocationExtra<Tag, MemoryExtra>
389389
{
@@ -404,7 +404,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
404404
ptr: Pointer<Tag>,
405405
val: ScalarMaybeUndef<Tag>,
406406
type_size: Size,
407-
) -> EvalResult<'tcx>
407+
) -> InterpResult<'tcx>
408408
// FIXME: Working around https://github.com/rust-lang/rust/issues/56209
409409
where Extra: AllocationExtra<Tag, MemoryExtra>
410410
{
@@ -451,7 +451,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
451451
cx: &impl HasDataLayout,
452452
ptr: Pointer<Tag>,
453453
val: ScalarMaybeUndef<Tag>
454-
) -> EvalResult<'tcx>
454+
) -> InterpResult<'tcx>
455455
// FIXME: Working around https://github.com/rust-lang/rust/issues/56209
456456
where Extra: AllocationExtra<Tag, MemoryExtra>
457457
{
@@ -483,7 +483,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
483483
cx: &impl HasDataLayout,
484484
ptr: Pointer<Tag>,
485485
size: Size,
486-
) -> EvalResult<'tcx> {
486+
) -> InterpResult<'tcx> {
487487
if self.relocations(cx, ptr, size).is_empty() {
488488
Ok(())
489489
} else {
@@ -502,7 +502,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
502502
cx: &impl HasDataLayout,
503503
ptr: Pointer<Tag>,
504504
size: Size,
505-
) -> EvalResult<'tcx> {
505+
) -> InterpResult<'tcx> {
506506
// Find the start and end of the given range and its outermost relocations.
507507
let (first, last) = {
508508
// Find all relocations overlapping the given range.
@@ -540,7 +540,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
540540
cx: &impl HasDataLayout,
541541
ptr: Pointer<Tag>,
542542
size: Size,
543-
) -> EvalResult<'tcx> {
543+
) -> InterpResult<'tcx> {
544544
self.check_relocations(cx, ptr, Size::ZERO)?;
545545
self.check_relocations(cx, ptr.offset(size, cx)?, Size::ZERO)?;
546546
Ok(())
@@ -553,7 +553,7 @@ impl<'tcx, Tag, Extra> Allocation<Tag, Extra> {
553553
/// Checks that a range of bytes is defined. If not, returns the `ReadUndefBytes`
554554
/// error which will report the first byte which is undefined.
555555
#[inline]
556-
fn check_defined(&self, ptr: Pointer<Tag>, size: Size) -> EvalResult<'tcx> {
556+
fn check_defined(&self, ptr: Pointer<Tag>, size: Size) -> InterpResult<'tcx> {
557557
self.undef_mask.is_range_defined(
558558
ptr.offset,
559559
ptr.offset + size,
@@ -565,7 +565,7 @@ impl<'tcx, Tag, Extra> Allocation<Tag, Extra> {
565565
ptr: Pointer<Tag>,
566566
size: Size,
567567
new_state: bool,
568-
) -> EvalResult<'tcx> {
568+
) -> InterpResult<'tcx> {
569569
if size.bytes() == 0 {
570570
return Ok(());
571571
}

src/librustc/mir/interpret/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ pub enum InterpError<'tcx, O> {
310310
InfiniteLoop,
311311
}
312312

313-
pub type EvalResult<'tcx, T = ()> = Result<T, EvalError<'tcx>>;
313+
pub type InterpResult<'tcx, T = ()> = Result<T, EvalError<'tcx>>;
314314

315315
impl<'tcx, O> InterpError<'tcx, O> {
316316
pub fn description(&self) -> &str {

src/librustc/mir/interpret/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mod allocation;
1111
mod pointer;
1212

1313
pub use self::error::{
14-
EvalError, EvalResult, InterpError, AssertMessage, ConstEvalErr, struct_error,
14+
EvalError, InterpResult, InterpError, AssertMessage, ConstEvalErr, struct_error,
1515
FrameInfo, ConstEvalRawResult, ConstEvalResult, ErrorHandled,
1616
};
1717

src/librustc/mir/interpret/pointer.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::ty::layout::{self, HasDataLayout, Size};
33
use rustc_macros::HashStable;
44

55
use super::{
6-
AllocId, EvalResult, InboundsCheck,
6+
AllocId, InterpResult, InboundsCheck,
77
};
88

99
////////////////////////////////////////////////////////////////////////////////
@@ -26,7 +26,7 @@ pub trait PointerArithmetic: layout::HasDataLayout {
2626
}
2727

2828
#[inline]
29-
fn offset<'tcx>(&self, val: u64, i: u64) -> EvalResult<'tcx, u64> {
29+
fn offset<'tcx>(&self, val: u64, i: u64) -> InterpResult<'tcx, u64> {
3030
let (res, over) = self.overflowing_offset(val, i);
3131
if over { err!(Overflow(mir::BinOp::Add)) } else { Ok(res) }
3232
}
@@ -39,7 +39,7 @@ pub trait PointerArithmetic: layout::HasDataLayout {
3939
}
4040

4141
#[inline]
42-
fn signed_offset<'tcx>(&self, val: u64, i: i64) -> EvalResult<'tcx, u64> {
42+
fn signed_offset<'tcx>(&self, val: u64, i: i64) -> InterpResult<'tcx, u64> {
4343
let (res, over) = self.overflowing_signed_offset(val, i128::from(i));
4444
if over { err!(Overflow(mir::BinOp::Add)) } else { Ok(res) }
4545
}
@@ -109,7 +109,7 @@ impl<'tcx, Tag> Pointer<Tag> {
109109
}
110110

111111
#[inline]
112-
pub fn offset(self, i: Size, cx: &impl HasDataLayout) -> EvalResult<'tcx, Self> {
112+
pub fn offset(self, i: Size, cx: &impl HasDataLayout) -> InterpResult<'tcx, Self> {
113113
Ok(Pointer::new_with_tag(
114114
self.alloc_id,
115115
Size::from_bytes(cx.data_layout().offset(self.offset.bytes(), i.bytes())?),
@@ -129,7 +129,7 @@ impl<'tcx, Tag> Pointer<Tag> {
129129
}
130130

131131
#[inline]
132-
pub fn signed_offset(self, i: i64, cx: &impl HasDataLayout) -> EvalResult<'tcx, Self> {
132+
pub fn signed_offset(self, i: i64, cx: &impl HasDataLayout) -> InterpResult<'tcx, Self> {
133133
Ok(Pointer::new_with_tag(
134134
self.alloc_id,
135135
Size::from_bytes(cx.data_layout().signed_offset(self.offset.bytes(), i)?),
@@ -158,7 +158,7 @@ impl<'tcx, Tag> Pointer<Tag> {
158158
self,
159159
allocation_size: Size,
160160
check: InboundsCheck,
161-
) -> EvalResult<'tcx, ()> {
161+
) -> InterpResult<'tcx, ()> {
162162
if self.offset > allocation_size {
163163
err!(PointerOutOfBounds {
164164
ptr: self.erase_tag(),

0 commit comments

Comments
 (0)