Auto merge of #1831 - hyd-dev:emulate-by-name-result, r=RalfJung
Fix the wrong `EmulateByNameResult::NotSupported` in `syscall` shim Without the change, the newly added test will fail with: ```diff -thread 'main' panicked at 'unsupported Miri functionality: can't execute syscall with ID 0', $DIR/unsupported_syscall.rs:10:9 +thread 'main' panicked at 'unsupported Miri functionality: can't call foreign function: syscall', $DIR/unsupported_syscall.rs:10:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` cc https://github.com/rust-lang/miri/pull/1818#discussion_r648868937
This commit is contained in:
commit
d39f0c64b8
@ -185,7 +185,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
||||
}
|
||||
id => {
|
||||
this.handle_unsupported(format!("can't execute syscall with ID {}", id))?;
|
||||
return Ok(EmulateByNameResult::NotSupported);
|
||||
return Ok(EmulateByNameResult::AlreadyJumped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
12
tests/run-pass/panic/unsupported_syscall.rs
Normal file
12
tests/run-pass/panic/unsupported_syscall.rs
Normal file
@ -0,0 +1,12 @@
|
||||
// ignore-windows: No libc on Windows
|
||||
// ignore-macos: `syscall` is not supported on macOS
|
||||
// compile-flags: -Zmiri-panic-on-unsupported
|
||||
#![feature(rustc_private)]
|
||||
|
||||
extern crate libc;
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
libc::syscall(0);
|
||||
}
|
||||
}
|
2
tests/run-pass/panic/unsupported_syscall.stderr
Normal file
2
tests/run-pass/panic/unsupported_syscall.stderr
Normal file
@ -0,0 +1,2 @@
|
||||
thread 'main' panicked at 'unsupported Miri functionality: can't execute syscall with ID 0', $DIR/unsupported_syscall.rs:10:9
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
Loading…
x
Reference in New Issue
Block a user