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

Enable cfg miri in analysis #15284

Merged
merged 1 commit into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions crates/hir-ty/src/mir/eval/shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,17 @@ impl Evaluator<'_> {
let id = from_bytes!(i64, id.get(self)?);
self.exec_syscall(id, rest, destination, locals, span)
}
"sched_getaffinity" => {
let [_pid, _set_size, set] = args else {
return Err(MirEvalError::TypeError("libc::write args are not provided"));
};
let set = Address::from_bytes(set.get(self)?)?;
// Only enable core 0 (we are single threaded anyway), which is bitset 0x0000001
self.write_memory(set, &[1])?;
// return 0 as success
self.write_memory_using_ref(destination.addr, destination.size)?.fill(0);
Ok(())
}
_ => not_supported!("unknown external function {as_str}"),
}
}
Expand Down
3 changes: 3 additions & 0 deletions crates/project-model/src/rustc_cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ pub(crate) fn get(
}
}

// Add miri cfg, which is useful for mir eval in stdlib
res.push(CfgFlag::Atom("miri".into()));

match get_rust_cfgs(cargo_toml, target, extra_env) {
Ok(rustc_cfgs) => {
tracing::debug!(
Expand Down