Skip to content

Improve miri error reporting in check_in_alloc #59627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
May 27, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
725199c
Improve miri's error reporting in check_in_alloc
LooMaclin Apr 2, 2019
7b4bc69
Improve miri's error reporting in check_in_alloc
LooMaclin Apr 2, 2019
705d75e
Improve miri's error reporting in check_in_alloc
LooMaclin Apr 2, 2019
4c4dbb1
Improve miri's error reporting in check_in_alloc
LooMaclin Apr 2, 2019
3449fa9
Merge branch 'master' into issue_57128_improve_miri_error_reporting_i…
LooMaclin Apr 2, 2019
2a738bb
Improve miri's error reporting in check_in_alloc
LooMaclin Apr 8, 2019
980db98
Improve miri's error reporting in check_in_alloc
LooMaclin Apr 8, 2019
e5b6fab
Improve miri's error reporting in check_in_alloc
LooMaclin Apr 8, 2019
11464e7
Improve miri's error reporting in check_in_alloc
LooMaclin Apr 8, 2019
32ba4bd
Improve miri's error reporting in check_in_alloc
LooMaclin Apr 8, 2019
9147e26
Improve miri's error reporting in check_in_alloc
LooMaclin Apr 9, 2019
30a9626
Improve miri's error reporting in check_in_alloc
LooMaclin Apr 10, 2019
0d97ad3
Update src/librustc/mir/interpret/allocation.rs
RalfJung Apr 16, 2019
15d50de
Improve miri's error reporting in check_in_alloc
LooMaclin Apr 18, 2019
a54e3cc
Improve miri's error reporting in check_in_alloc
LooMaclin Apr 18, 2019
fc7ffa6
Improve miri's error reporting in check_in_alloc
LooMaclin Apr 23, 2019
b1c829b
Improve miri's error reporting in check_in_alloc
LooMaclin Apr 23, 2019
ffd0dc7
Improve miri's error reporting in check_in_alloc
LooMaclin May 26, 2019
9e643e6
Improve miri's error reporting in check_in_alloc
LooMaclin May 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve miri's error reporting in check_in_alloc
  • Loading branch information
LooMaclin committed Apr 2, 2019
commit 705d75ef1aa20c124975786cf1ad9764a82b12ef
3 changes: 2 additions & 1 deletion src/librustc/mir/interpret/allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
// FIXME: Working around https://github.com/rust-lang/rust/issues/56209
where Extra: AllocationExtra<Tag, MemoryExtra>
{
let bytes = self.get_bytes_mut(cx, ptr, Size::from_bytes(src.len() as u64), CheckInAllocMsg::WriteBytes)?;
let bytes = self.get_bytes_mut(cx, ptr, Size::from_bytes(src.len() as u64),
CheckInAllocMsg::WriteBytes)?;
bytes.clone_from_slice(src);
Ok(())
}
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_mir/hair/pattern/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,8 @@ fn slice_pat_covered_by_const<'tcx>(
return Ok(false);
}
let n = n.assert_usize(tcx).unwrap();
alloc.get_bytes(&tcx, ptr, Size::from_bytes(n), CheckInAllocMsg::SlicePatCoveredByConst).unwrap()
alloc.get_bytes(&tcx, ptr, Size::from_bytes(n),
CheckInAllocMsg::SlicePatCoveredByConst).unwrap()
},
// a slice fat pointer to a zero length slice
(ConstValue::Slice(Scalar::Bits { .. }, 0), ty::Slice(t)) => {
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_mir/interpret/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M>
ScalarMaybeUndef::Scalar(Scalar::Ptr(ptr)) => {
// The niche must be just 0 (which an inbounds pointer value never is)
let ptr_valid = niche_start == 0 && variants_start == variants_end &&
self.memory.check_bounds_ptr(ptr, CheckInAllocMsg::ReadDiscriminant).is_ok();
self.memory.check_bounds_ptr(ptr,
CheckInAllocMsg::ReadDiscriminant).is_ok();
if !ptr_valid {
return err!(InvalidDiscriminant(raw_discr.erase_tag()));
}
Expand Down