Skip to content

Commit ec96dff

Browse files
author
Ellen Arteca
committed
remove --offline so new deps can be added to CI build; cast isize/usize to i64/u64
1 parent 681f143 commit ec96dff

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

miri

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,8 @@ find_sysroot() {
139139
case "$COMMAND" in
140140
install)
141141
# "--locked" to respect the Cargo.lock file if it exists,
142-
# "--offline" to avoid querying the registry (for yanked packages).
143-
$CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR" --force --locked --offline "$@"
144-
$CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR"/cargo-miri --force --locked --offline "$@"
142+
$CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR" --force --locked "$@"
143+
$CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR"/cargo-miri --force --locked "$@"
145144
;;
146145
check)
147146
# Check, and let caller control flags.

src/c_ffi_support.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
123123
}
124124
hir::PrimTy::Int(IntTy::Isize) => {
125125
let x = call::<isize>(ptr, libffi_args.as_slice());
126-
if isize::BITS == 64 {
127-
this.write_int(x as i64, dest)?;
128-
} else if usize::BITS == 32 {
129-
this.write_int(x as i32, dest)?;
130-
} else {
131-
panic!("machine isize should be 32 or 64 bits");
132-
}
126+
// `isize` doesn't `impl Into<i128>`, so convert manually.
127+
// Convert to `i64` since this covers both 32- and 64-bit machines.
128+
this.write_int(i64::try_from(x).unwrap(), dest)?;
133129
return Ok(());
134130
}
135131
// uints
@@ -155,13 +151,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
155151
}
156152
hir::PrimTy::Uint(UintTy::Usize) => {
157153
let x = call::<usize>(ptr, libffi_args.as_slice());
158-
if usize::BITS == 64 {
159-
this.write_int(x as u64, dest)?;
160-
} else if usize::BITS == 32 {
161-
this.write_int(x as u32, dest)?;
162-
} else {
163-
panic!("machine usize should be 32 or 64 bits");
164-
}
154+
// `usize` doesn't `impl Into<i128>`, so convert manually.
155+
// Convert to `u64` since this covers both 32- and 64-bit machines.
156+
this.write_int(u64::try_from(x).unwrap(), dest)?;
165157
return Ok(());
166158
}
167159
_ => {}

0 commit comments

Comments
 (0)