Skip to content
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

Rollup of 5 pull requests #61234

Closed
wants to merge 29 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
29 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
941ca6f
Clarify docs for unreachable! macro
blkerby May 23, 2019
27c7537
Remove phrase "instead of a panic!"
blkerby May 23, 2019
609ffa1
Reword malformed attribute input diagnostics
estebank May 22, 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
5c5f08a
Use .await syntax instead of await!
diwic May 27, 2019
d6ca34c
Use `Symbol` more in lint APIs
oli-obk May 14, 2019
cea81b0
Rollup merge of #59627 - LooMaclin:issue_57128_improve_miri_error_rep…
Centril May 27, 2019
32d9b74
Rollup merge of #60827 - oli-obk:late_symbol, r=nnethercote
Centril May 27, 2019
b2cca1b
Rollup merge of #61084 - blkerby:unreachable_doc, r=KodrAus
Centril May 27, 2019
e3b66d6
Rollup merge of #61140 - estebank:attr-diagnostics, r=michaelwoerister
Centril May 27, 2019
88115b9
Rollup merge of #61227 - diwic:patch-2, r=Centril
Centril May 27, 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
9 changes: 4 additions & 5 deletions src/librustc/mir/interpret/allocation.rs
Original file line number Diff line number Diff line change
@@ -224,12 +224,11 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
cx: &impl HasDataLayout,
ptr: Pointer<Tag>,
size: Size,
msg: CheckInAllocMsg,
) -> EvalResult<'tcx, &[u8]>
// FIXME: Working around https://github.com/rust-lang/rust/issues/56209
where Extra: AllocationExtra<Tag, MemoryExtra>
{
self.get_bytes_internal(cx, ptr, size, true, msg)
self.get_bytes_internal(cx, ptr, size, true, CheckInAllocMsg::MemoryAccess)
}

/// It is the caller's responsibility to handle undefined and pointer bytes.
@@ -295,7 +294,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
// Go through `get_bytes` for checks and AllocationExtra hooks.
// We read the null, so we include it in the request, but we want it removed
// from the result!
Ok(&self.get_bytes(cx, ptr, size_with_null, CheckInAllocMsg::NullPointer)?[..size])
Ok(&self.get_bytes(cx, ptr, size_with_null)?[..size])
}
None => err!(UnterminatedCString(ptr.erase_tag())),
}
@@ -379,7 +378,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
{
// get_bytes_unchecked tests relocation edges
let bytes = self.get_bytes_with_undef_and_ptr(cx, ptr, size,
CheckInAllocMsg::PointerArithmetic)?;
CheckInAllocMsg::MemoryAccess)?;
// Undef check happens *after* we established that the alignment is correct.
// We must not return Ok() for unaligned pointers!
if self.check_defined(ptr, size).is_err() {
@@ -456,7 +455,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
};

let endian = cx.data_layout().endian;
let dst = self.get_bytes_mut(cx, ptr, type_size, CheckInAllocMsg::PointerArithmetic)?;
let dst = self.get_bytes_mut(cx, ptr, type_size, CheckInAllocMsg::MemoryAccess)?;
write_target_uint(endian, dst, bytes).unwrap();

// See if we have to also write a relocation
7 changes: 3 additions & 4 deletions src/librustc_mir/hair/pattern/_match.rs
Original file line number Diff line number Diff line change
@@ -172,7 +172,7 @@ use rustc::ty::{self, Ty, TyCtxt, TypeFoldable, Const};
use rustc::ty::layout::{Integer, IntegerExt, VariantIdx, Size};

use rustc::mir::Field;
use rustc::mir::interpret::{ConstValue, Scalar, truncate, CheckInAllocMsg};
use rustc::mir::interpret::{ConstValue, Scalar, truncate};
use rustc::util::common::ErrorReported;

use syntax::attr::{SignedInt, UnsignedInt};
@@ -1418,8 +1418,7 @@ 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::OutOfBounds).unwrap()
alloc.get_bytes(&tcx, ptr, Size::from_bytes(n)).unwrap()
},
// a slice fat pointer to a zero length slice
(ConstValue::Slice(Scalar::Bits { .. }, 0), ty::Slice(t)) => {
@@ -1444,7 +1443,7 @@ fn slice_pat_covered_by_const<'tcx>(
tcx.alloc_map
.lock()
.unwrap_memory(ptr.alloc_id)
.get_bytes(&tcx, ptr, Size::from_bytes(n), CheckInAllocMsg::OutOfBounds)
.get_bytes(&tcx, ptr, Size::from_bytes(n))
.unwrap()
},
_ => bug!(
2 changes: 1 addition & 1 deletion src/librustc_mir/interpret/memory.rs
Original file line number Diff line number Diff line change
@@ -606,7 +606,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
Ok(&[])
} else {
let ptr = ptr.to_ptr()?;
self.get(ptr.alloc_id)?.get_bytes(self, ptr, size, CheckInAllocMsg::MemoryAccess)
self.get(ptr.alloc_id)?.get_bytes(self, ptr, size)
}
}
}