8000 Rollup of 5 pull requests by Dylan-DPC-zz · Pull Request #70404 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 5 pull requests #70404

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 31 commits into from
Mar 25, 2020
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
513ea64
add missing visit_consts
lcnr Mar 23, 2020
bda976d
add missing const super folds
lcnr Mar 23, 2020
d7ecc8c
query normalize_generic_arg_after_erasing_regions
lcnr Mar 23, 2020
03bb3bd
Add long error explanation for E0710 #61137
bishtpawan Mar 24, 2020
cd9921e
Refactor changes
bishtpawan Mar 24, 2020
10226da
Update tools_lints
bishtpawan Mar 24, 2020
6c4d5d9
improve normalize cycle error
lcnr Mar 24, 2020
1509160
Add explanation for inner attribute
bishtpawan Mar 24, 2020
b31707e
Remove unknown lint from deny attribute
bishtpawan Mar 24, 2020
11763d4
update mir opt test
lcnr Mar 24, 2020
212e6ce
Implement Fuse with Option
cuviper Mar 22, 2020
bedc358
fix type name typo in doc comments
JOE1994 Mar 25, 2020
5c65568
update tool_lints
bishtpawan Mar 25, 2020
5be304b
miri: simplify shift operator overflow checking
RalfJung Mar 17, 2020
1ddbdc6
use checked casts and arithmetic in Miri engine
RalfJung Mar 21, 2020
9de6008
make bit_width return u64, consistently with other sizes in the compiler
RalfJung Mar 21, 2020
cd15b65
avoid double-cast in mplace_field
RalfJung Mar 21, 2020
d7e2650
miri: avoid a bunch of casts by offering usized-based field indexing
RalfJung Mar 21, 2020
f16b491
remove unnecessary cast
RalfJung Mar 21, 2020
0bc108a
make Size::from* methods generic in the integer type they accept
RalfJung Mar 22, 2020
afcb634
use Size addition instead of checked int addition
RalfJung Mar 24, 2020
1d67ca0
add helper method for ptr ops on Scalar; reduce unnecessary large ope…
RalfJung Mar 24, 2020
b7db732
go back to infix ops for Size
RalfJung Mar 24, 2020
7400955
add usize methods for Size getters
RalfJung Mar 24, 2020
f8e3da5
run test only on 64bit
lcnr Mar 25, 2020
4f429c0
impl TrustedRandomAccess for Fuse without FusedIterator
cuviper Mar 25, 2020
97f0a9e
Rollup merge of #70226 - RalfJung:checked, r=oli-obk
Dylan-DPC Mar 25, 2020
1154023
Rollup merge of #70319 - lcnr:issue63695, r=eddyb
Dylan-DPC Mar 25, 2020
3586ab6
Rollup merge of #70352 - bishtpawan:doc/61137-add-long-error-code-e07…
Dylan-DPC Mar 25, 2020
530c320
Rollup merge of #70366 - cuviper:option-fuse, r=dtolnay
Dylan-DPC Mar 25, 2020
9a9cb2d
Rollup merge of #70379 - JOE1994:patch-2, r=petrochenkov
Dylan-DPC Mar 25, 2020
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
avoid double-cast in mplace_field
  • Loading branch information
RalfJung committed Mar 25, 2020
commit cd15b659c7f20d9b740b3c7b53dde9dcd0132f9d
16 changes: 8 additions & 8 deletions src/librustc_mir/interpret/place.rs
810E
Original file line number Diff line number Diff line change
Expand Up @@ -396,33 +396,33 @@ where
field: u64,
) -> InterpResult<'tcx, MPlaceTy<'tcx, M::PointerTag>> {
// Not using the layout method because we want to compute on u64
let offset = match base.layout.fields {
let (offset, field_layout) = match base.layout.fields {
layout::FieldPlacement::Arbitrary { ref offsets, .. } => {
offsets[usize::try_from(field).unwrap()]
let field = usize::try_from(field).unwrap();
(offsets[field], base.layout.field(self, field)?)
}
layout::FieldPlacement::Array { stride, .. } => {
let len = base.len(self)?;
if field >= len {
// This can only be reached in ConstProp and non-rustc-MIR.
throw_ub!(BoundsCheckFailed { len, index: field });
}
Size::mul(stride, field) // `Size` multiplication is checked
// All fields have the same layout.
(Size::mul(stride, field), base.layout.field(self, 9)?)
}
layout::FieldPlacement::Union(count) => {
let field = usize::try_from(field).unwrap();
assert!(
field < u64::try_from(count).unwrap(),
field < count,
"Tried to access field {} of union {:#?} with {} fields",
field,
base.layout,
count
);
// Offset is always 0
Size::from_bytes(0)
(Size::from_bytes(0), base.layout.field(self, field)?)
}
};
// the only way conversion can fail if is this is an array (otherwise we already panicked
// above). In that case, all fields have the same layout.
let field_layout = base.layout.field(self, usize::try_from(field).unwrap_or(0))?;

// Offset may need adjustment for unsized fields.
let (meta, offset) = if field_layout.is_unsized() {
Expand Down
0