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:
bors 2021-06-11 07:32:23 +00:00
commit d39f0c64b8
3 changed files with 15 additions and 1 deletions

View File

@ -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);
}
}
}

View 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);
}
}

View 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