Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
ad2618d
rustc_target: hide TargetOptions::vendor
tamird Nov 9, 2025
02a138c
Auto merge of #148679 - dianqk:update-llvm, r=cuviper
bors Nov 10, 2025
4e2864a
Merge ref '8401398e1f14' from rust-lang/rust
invalid-email-address Nov 10, 2025
27bcfc3
Auto merge of #148685 - Zalathar:lldb-python, r=jieyouxu
bors Nov 10, 2025
0945573
Allow `function_casts_as_integer` in non-related miri tests
GuillaumeGomez May 27, 2025
a112cb2
Allow `function_casts_as_integer` in miri source code
GuillaumeGomez Oct 14, 2025
3062cbb
Auto merge of #135634 - joboet:trivial-clone, r=Mark-Simulacrum
bors Nov 10, 2025
3a99938
Merge pull request #2635 from rust-lang/rustc-pull
tshepang Nov 10, 2025
92ed621
Auto merge of #148737 - zachs18:unit-is-zero, r=joboet
bors Nov 11, 2025
ef8da49
Rollup merge of #141470 - GuillaumeGomez:function_casts_as_integer, r…
Zalathar Nov 11, 2025
65250c8
Rollup merge of #143619 - beetrees:varargs-named, r=jdonszelmann
Zalathar Nov 11, 2025
5dbaba1
Rollup merge of #146495 - fmease:rustdoc-erase-doc-priv-items-attr, r…
Zalathar Nov 11, 2025
aadc5e6
Rollup merge of #147771 - nxsaken:div_shlr_exact, r=dtolnay
Zalathar Nov 11, 2025
2db5047
Rollup merge of #147833 - aDotInTheVoid:rdj-shuffle, r=camelid
Zalathar Nov 11, 2025
a389bf9
Rollup merge of #147955 - Zalathar:handlers, r=jieyouxu
Zalathar Nov 11, 2025
a9fb3a5
Rollup merge of #148480 - Lysxia:steal-mut, r=davidtwco
Zalathar Nov 11, 2025
7d83312
Rollup merge of #148506 - estebank:issue-41966, r=davidtwco
Zalathar Nov 11, 2025
28adb14
Rollup merge of #148508 - estebank:issue-74617, r=nnethercote
Zalathar Nov 11, 2025
4cc7039
Rollup merge of #148530 - Shourya742:2025-11-05-update-bootstrap-docu…
Zalathar Nov 11, 2025
6bd3a25
Rollup merge of #148608 - osamakader:doc-test-builder, r=GuillaumeGomez
Zalathar Nov 11, 2025
910dadd
Rollup merge of #148636 - xSetech:boostrap/set-python-on-macos, r=jie…
Zalathar Nov 11, 2025
3a81c4f
Rollup merge of #148639 - midsterx:test/rustdoc, r=GuillaumeGomez
Zalathar Nov 11, 2025
ee3be12
Rollup merge of #148647 - JonathanBrouwer:unsafe_attr_refactor, r=jdo…
Zalathar Nov 11, 2025
af85678
Rollup merge of #148667 - hkBst:clippy-fix-14, r=Kivooeo
Zalathar Nov 11, 2025
27dc48c
Rollup merge of #148694 - joboet:teeos-sync, r=ChrisDenton
Zalathar Nov 11, 2025
c5f79bf
Rollup merge of #148712 - JonathanBrouwer:cfg_select, r=jdonszelmann
Zalathar Nov 11, 2025
d99e11b
Rollup merge of #148760 - tamird:avoid-vendor-logic, r=madsmtm
Zalathar Nov 11, 2025
3f4f55a
Auto merge of #148817 - Zalathar:rollup-tf5ti2m, r=Zalathar
bors Nov 11, 2025
ccb2919
Rollup merge of #148771 - fmease:iat-reinstate-early-elim, r=BoxyUwU
Zalathar Nov 11, 2025
eaf77dc
Rollup merge of #148775 - reddevilmidzy:fix-typo, r=joboet
Zalathar Nov 11, 2025
559a50b
Rollup merge of #148779 - zachs18:panic-location-dynsendsync, r=nneth…
Zalathar Nov 11, 2025
4a8c64f
Rollup merge of #148781 - GuillaumeGomez:rm-unneeded-attr, r=yotamofek
Zalathar Nov 11, 2025
0288cec
Rollup merge of #148783 - lcnr:add-soundness-test, r=BoxyUwU
Zalathar Nov 11, 2025
9f0df66
Rollup merge of #148785 - reddevilmidzy:rename-to-main, r=Kobzol
Zalathar Nov 11, 2025
04a2a93
Rollup merge of #148791 - luca3s:fix-doc-comment, r=lqd
Zalathar Nov 11, 2025
be505a4
Rollup merge of #148792 - chenyukang:yukang-fix-file-name, r=Muscraft
Zalathar Nov 11, 2025
b35bba1
Rollup merge of #148805 - tshepang:rdg-sync, r=tshepang
Zalathar Nov 11, 2025
a7d08da
Rollup merge of #148807 - nnethercote:doc-Copy-Clone-problem, r=saethlin
Zalathar Nov 11, 2025
4ce5ac8
Auto merge of #148818 - Zalathar:rollup-4vujcg0, r=Zalathar
bors Nov 11, 2025
ae9ea19
Auto merge of #148658 - dianne:cleanup-rvalue-scopes, r=cjgillot
bors Nov 11, 2025
0532364
Simplify jemalloc setup
madsmtm Nov 11, 2025
5a0893c
rustc_target: rename Arch::{Uknown,Other}
tamird Nov 7, 2025
3264b55
Auto merge of #144674 - rperier:add_note_if_a_type_impl_a_trait_with_…
bors Nov 11, 2025
64bc206
rustc_target: introduce Env
tamird Nov 5, 2025
6e74aa0
rustc_target: introduce Os
tamird Nov 5, 2025
a275e8e
Rollup merge of #146627 - madsmtm:jemalloc-simplify, r=jdonszelmann
Zalathar Nov 12, 2025
d2cb20b
Rollup merge of #147753 - chenyukang:yukang-147749, r=fmease
Zalathar Nov 12, 2025
1f2194a
Rollup merge of #147832 - aDotInTheVoid:rustdoc-format-options, r=Gui…
Zalathar Nov 12, 2025
37dfbcd
Rollup merge of #147974 - JohnTitor:diag-detect-buf-reuse-pattern, r=…
Zalathar Nov 12, 2025
cbfd44c
Rollup merge of #148080 - GuillaumeGomez:fix-jump-def-links, r=lolbin…
Zalathar Nov 12, 2025
9df0b7d
Rollup merge of #148465 - Jarcho:for_span, r=davidtwco,Zalathar
Zalathar Nov 12, 2025
6f382a8
Rollup merge of #148500 - Kobzol:git-update-inex, r=jieyouxu
Zalathar Nov 12, 2025
9df6bf9
Rollup merge of #148531 - tamird:vendor-enum, r=nnethercote
Zalathar Nov 12, 2025
67bb3b1
Rollup merge of #148536 - folkertdev:cmse-async-const-fn, r=davidtwco
Zalathar Nov 12, 2025
e71744d
Rollup merge of #148770 - folkertdev:naked-c-variadic, r=workingjubilee
Zalathar Nov 12, 2025
408aba7
Rollup merge of #148780 - klensy:filecheck-typo, r=jieyouxu
Zalathar Nov 12, 2025
248a2b5
Rollup merge of #148819 - bjorn3:fix_fixme, r=jieyouxu
Zalathar Nov 12, 2025
31874cf
Rollup merge of #148830 - RalfJung:miri, r=RalfJung
Zalathar Nov 12, 2025
1f6b1db
Rollup merge of #148833 - clubby789:cargo-update-rustbook-11-11-25, r…
Zalathar Nov 12, 2025
893c4b4
Rollup merge of #148834 - Muscraft:fix-doctest-colors, r=fmease
Zalathar Nov 12, 2025
e823b03
Rollup merge of #148841 - dtolnay:simdmustuse, r=calebzulawski
Zalathar Nov 12, 2025
f63ba2a
Auto merge of #148851 - Zalathar:rollup-4y7ywyd, r=Zalathar
bors Nov 12, 2025
87cec62
Prepare for merging from rust-lang/rust
Nov 12, 2025
52cd5d2
Merge ref '0b329f801a09' from rust-lang/rust
Nov 12, 2025
05843bc
fmt
Nov 12, 2025
29bfe95
update lockfile
RalfJung Nov 12, 2025
205a287
fix function_casts_as_integer lint
RalfJung Nov 12, 2025
76ed887
try to be more robust against short hickups in the Ubuntu Ports mirrors
RalfJung Nov 12, 2025
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
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ jobs:
sudo bash -c "echo 'https://ports.ubuntu.com/ priority:4' >> /etc/apt/apt-mirrors.txt"
# Add architecture
sudo dpkg --add-architecture ${{ matrix.multiarch }}
sudo apt update
# Ubuntu Ports often has outdated mirrors so try a few times to get the apt repo
for TRY in $(seq 3); do
{ sudo apt update && break; } || sleep 30
done
# Install needed packages
sudo apt install $(echo "libatomic1: zlib1g-dev:" | sed 's/:/:${{ matrix.multiarch }}/g')
- uses: ./.github/workflows/setup
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ serde_json = { version = "1.0", optional = true }
# But only for some targets, it fails for others. Rustc configures this in its CI, but we can't
# easily use that since we support of-tree builds.
[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies.tikv-jemalloc-sys]
version = "0.6.0"
features = ['unprefixed_malloc_on_supported_platforms']
version = "0.6.1"
features = ['override_allocator_on_supported_platforms']

[target.'cfg(unix)'.dependencies]
libc = "0.2"
Expand Down
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8401398e1f14a24670ee1a3203713dc2f0f8b3a8
0b329f801a09004dacb19aaf09d5cb8b4c51d3f8
46 changes: 5 additions & 41 deletions src/bin/miri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ extern crate rustc_middle;
extern crate rustc_session;
extern crate rustc_span;

/// See docs in https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc/src/main.rs
/// and https://github.com/rust-lang/rust/pull/146627 for why we need this `use` statement.
#[cfg(any(target_os = "linux", target_os = "macos"))]
use tikv_jemalloc_sys as _;

mod log;

use std::env;
Expand Down Expand Up @@ -392,48 +397,7 @@ fn parse_range(val: &str) -> Result<Range<u32>, &'static str> {
Ok(from..to)
}

#[cfg(any(target_os = "linux", target_os = "macos"))]
fn jemalloc_magic() {
// These magic runes are copied from
// <https://github.com/rust-lang/rust/blob/e89bd9428f621545c979c0ec686addc6563a394e/compiler/rustc/src/main.rs#L39>.
// See there for further comments.
use std::os::raw::{c_int, c_void};

use tikv_jemalloc_sys as jemalloc_sys;

#[used]
static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::calloc;
#[used]
static _F2: unsafe extern "C" fn(*mut *mut c_void, usize, usize) -> c_int =
jemalloc_sys::posix_memalign;
#[used]
static _F3: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::aligned_alloc;
#[used]
static _F4: unsafe extern "C" fn(usize) -> *mut c_void = jemalloc_sys::malloc;
#[used]
static _F5: unsafe extern "C" fn(*mut c_void, usize) -> *mut c_void = jemalloc_sys::realloc;
#[used]
static _F6: unsafe extern "C" fn(*mut c_void) = jemalloc_sys::free;

// On OSX, jemalloc doesn't directly override malloc/free, but instead
// registers itself with the allocator's zone APIs in a ctor. However,
// the linker doesn't seem to consider ctors as "used" when statically
// linking, so we need to explicitly depend on the function.
#[cfg(target_os = "macos")]
{
unsafe extern "C" {
fn _rjem_je_zone_register();
}

#[used]
static _F7: unsafe extern "C" fn() = _rjem_je_zone_register;
}
}

fn main() {
#[cfg(any(target_os = "linux", target_os = "macos"))]
jemalloc_magic();

let early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default());

// Snapshot a copy of the environment before `rustc` starts messing with it.
Expand Down
3 changes: 2 additions & 1 deletion src/concurrency/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use rustc_index::{Idx, IndexVec};
use rustc_middle::mir::Mutability;
use rustc_middle::ty::layout::TyAndLayout;
use rustc_span::Span;
use rustc_target::spec::Os;

use crate::concurrency::GlobalDataRaceHandler;
use crate::shims::tls;
Expand Down Expand Up @@ -471,7 +472,7 @@ impl<'tcx> ThreadManager<'tcx> {
) {
ecx.machine.threads.threads[ThreadId::MAIN_THREAD].on_stack_empty =
Some(on_main_stack_empty);
if ecx.tcx.sess.target.os.as_ref() != "windows" {
if ecx.tcx.sess.target.os != Os::Windows {
// The main thread can *not* be joined on except on windows.
ecx.machine.threads.threads[ThreadId::MAIN_THREAD].join_status =
ThreadJoinStatus::Detached;
Expand Down
3 changes: 2 additions & 1 deletion src/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use rustc_hir::def_id::DefId;
use rustc_middle::ty::layout::{HasTyCtxt, HasTypingEnv, LayoutCx};
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_session::config::EntryFnType;
use rustc_target::spec::Os;

use crate::concurrency::GenmcCtx;
use crate::concurrency::thread::TlsAllocAction;
Expand Down Expand Up @@ -341,7 +342,7 @@ pub fn create_ecx<'tcx>(
ecx.machine.argv = Some(argv_place.ptr());
}
// Store command line as UTF-16 for Windows `GetCommandLineW`.
if tcx.sess.target.os == "windows" {
if tcx.sess.target.os == Os::Windows {
// Construct a command string with all the arguments.
let cmd_utf16: Vec<u16> = args_to_utf16_command_string(config.args.iter());

Expand Down
15 changes: 8 additions & 7 deletions src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use rustc_middle::ty::{self, IntTy, Ty, TyCtxt, UintTy};
use rustc_session::config::CrateType;
use rustc_span::{Span, Symbol};
use rustc_symbol_mangling::mangle_internal_symbol;
use rustc_target::spec::Os;

use crate::*;

Expand Down Expand Up @@ -234,7 +235,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {

/// Helper function to get a `libc` constant as a `Scalar`.
fn eval_libc(&self, name: &str) -> Scalar {
if self.eval_context_ref().tcx.sess.target.os == "windows" {
if self.eval_context_ref().tcx.sess.target.os == Os::Windows {
panic!(
"`libc` crate is not reliably available on Windows targets; Miri should not use it there"
);
Expand Down Expand Up @@ -290,7 +291,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
/// Helper function to get the `TyAndLayout` of a `libc` type
fn libc_ty_layout(&self, name: &str) -> TyAndLayout<'tcx> {
let this = self.eval_context_ref();
if this.tcx.sess.target.os == "windows" {
if this.tcx.sess.target.os == Os::Windows {
panic!(
"`libc` crate is not reliably available on Windows targets; Miri should not use it there"
);
Expand Down Expand Up @@ -669,7 +670,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
/// Helper function used inside the shims of foreign functions to assert that the target OS
/// is `target_os`. It panics showing a message with the `name` of the foreign function
/// if this is not the case.
fn assert_target_os(&self, target_os: &str, name: &str) {
fn assert_target_os(&self, target_os: Os, name: &str) {
assert_eq!(
self.eval_context_ref().tcx.sess.target.os,
target_os,
Expand All @@ -680,9 +681,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
/// Helper function used inside shims of foreign functions to check that the target OS
/// is one of `target_oses`. It returns an error containing the `name` of the foreign function
/// in a message if this is not the case.
fn check_target_os(&self, target_oses: &[&str], name: Symbol) -> InterpResult<'tcx> {
let target_os = self.eval_context_ref().tcx.sess.target.os.as_ref();
if !target_oses.contains(&target_os) {
fn check_target_os(&self, target_oses: &[Os], name: Symbol) -> InterpResult<'tcx> {
let target_os = &self.eval_context_ref().tcx.sess.target.os;
if !target_oses.contains(target_os) {
throw_unsup_format!("`{name}` is not supported on {target_os}");
}
interp_ok(())
Expand Down Expand Up @@ -918,7 +919,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
/// Always returns a `Vec<u32>` no matter the size of `wchar_t`.
fn read_wchar_t_str(&self, ptr: Pointer) -> InterpResult<'tcx, Vec<u32>> {
let this = self.eval_context_ref();
let wchar_t = if this.tcx.sess.target.os == "windows" {
let wchar_t = if this.tcx.sess.target.os == Os::Windows {
// We don't have libc on Windows so we have to hard-code the type ourselves.
this.machine.layouts.u16
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use rustc_span::def_id::{CrateNum, DefId};
use rustc_span::{Span, SpanData, Symbol};
use rustc_symbol_mangling::mangle_internal_symbol;
use rustc_target::callconv::FnAbi;
use rustc_target::spec::Arch;
use rustc_target::spec::{Arch, Os};

use crate::alloc_addresses::EvalContextExt;
use crate::concurrency::cpu_affinity::{self, CpuAffinityMask};
Expand Down Expand Up @@ -715,7 +715,7 @@ impl<'tcx> MiriMachine<'tcx> {
match target.arch {
Arch::Wasm32 | Arch::Wasm64 => 64 * 1024, // https://webassembly.github.io/spec/core/exec/runtime.html#memory-instances
Arch::AArch64 => {
if target.options.vendor.as_ref() == "apple" {
if target.is_like_darwin {
// No "definitive" source, but see:
// https://www.wwdcnotes.com/notes/wwdc20/10214/
// https://github.com/ziglang/zig/issues/11308 etc.
Expand All @@ -739,7 +739,7 @@ impl<'tcx> MiriMachine<'tcx> {
);
let threads = ThreadManager::new(config);
let mut thread_cpu_affinity = FxHashMap::default();
if matches!(&*tcx.sess.target.os, "linux" | "freebsd" | "android") {
if matches!(&tcx.sess.target.os, Os::Linux | Os::FreeBsd | Os::Android) {
thread_cpu_affinity
.insert(threads.active_thread(), CpuAffinityMask::new(&layout_cx, config.num_cpus));
}
Expand Down
10 changes: 5 additions & 5 deletions src/shims/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc_ast::expand::allocator::SpecialAllocatorMethod;
use rustc_middle::ty::Ty;
use rustc_span::Symbol;
use rustc_target::callconv::FnAbi;
use rustc_target::spec::Arch;
use rustc_target::spec::{Arch, Os};

use crate::*;

Expand All @@ -19,10 +19,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
// This is given by `alignof(max_align_t)`. The following list is taken from
// `library/std/src/sys/alloc/mod.rs` (where this is called `MIN_ALIGN`) and should
// be kept in sync.
let os = this.tcx.sess.target.os.as_ref();
let os = &this.tcx.sess.target.os;
let max_fundamental_align = match &this.tcx.sess.target.arch {
Arch::RiscV32 if matches!(os, "espidf" | "zkvm") => 4,
Arch::Xtensa if matches!(os, "espidf") => 4,
Arch::RiscV32 if matches!(os, Os::EspIdf | Os::Zkvm) => 4,
Arch::Xtensa if matches!(os, Os::EspIdf) => 4,
Arch::X86
| Arch::Arm
| Arch::M68k
Expand Down Expand Up @@ -54,7 +54,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
| Arch::Nvptx64
| Arch::PowerPC64LE
| Arch::SpirV
| Arch::Unknown(_)) => bug!("unsupported target architecture for malloc: `{arch}`"),
| Arch::Other(_)) => bug!("unsupported target architecture for malloc: `{arch}`"),
};
// The C standard only requires sufficient alignment for any *type* with size less than or
// equal to the size requested. Types one can define in standard C seem to never have an alignment
Expand Down
5 changes: 3 additions & 2 deletions src/shims/env.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::ffi::{OsStr, OsString};

use rustc_data_structures::fx::FxHashMap;
use rustc_target::spec::Os;

use self::shims::unix::UnixEnvVars;
use self::shims::windows::WindowsEnvVars;
Expand Down Expand Up @@ -48,7 +49,7 @@ impl<'tcx> EnvVars<'tcx> {

let env_vars = if ecx.target_os_is_unix() {
EnvVars::Unix(UnixEnvVars::new(ecx, env_vars)?)
} else if ecx.tcx.sess.target.os == "windows" {
} else if ecx.tcx.sess.target.os == Os::Windows {
EnvVars::Windows(WindowsEnvVars::new(ecx, env_vars)?)
} else {
// For "none" targets (i.e., without an OS).
Expand Down Expand Up @@ -118,7 +119,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
let this = self.eval_context_ref();
let index = thread.to_u32();
let target_os = &this.tcx.sess.target.os;
if target_os == "linux" || target_os == "netbsd" {
if matches!(target_os, Os::Linux | Os::NetBsd) {
// On Linux, the main thread has PID == TID so we uphold this. NetBSD also appears
// to exhibit the same behavior, though I can't find a citation.
this.get_pid().strict_add(index)
Expand Down
14 changes: 8 additions & 6 deletions src/shims/extern_static.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Provides the `extern static` that this platform expects.

use rustc_target::spec::Os;

use crate::*;

impl<'tcx> MiriMachine<'tcx> {
Expand Down Expand Up @@ -49,28 +51,28 @@ impl<'tcx> MiriMachine<'tcx> {
Self::add_extern_static(ecx, "environ", environ);
}

match ecx.tcx.sess.target.os.as_ref() {
"linux" => {
match &ecx.tcx.sess.target.os {
Os::Linux => {
Self::null_ptr_extern_statics(
ecx,
&["__cxa_thread_atexit_impl", "__clock_gettime64"],
)?;
Self::weak_symbol_extern_statics(ecx, &["getrandom", "gettid", "statx"])?;
}
"freebsd" => {
Os::FreeBsd => {
Self::null_ptr_extern_statics(ecx, &["__cxa_thread_atexit_impl"])?;
}
"android" => {
Os::Android => {
Self::null_ptr_extern_statics(ecx, &["bsd_signal"])?;
Self::weak_symbol_extern_statics(ecx, &["signal", "getrandom", "gettid"])?;
}
"windows" => {
Os::Windows => {
// "_tls_used"
// This is some obscure hack that is part of the Windows TLS story. It's a `u8`.
let val = ImmTy::from_int(0, ecx.machine.layouts.u8);
Self::alloc_extern_static(ecx, "_tls_used", val)?;
}
"illumos" | "solaris" => {
Os::Illumos | Os::Solaris => {
Self::weak_symbol_extern_statics(ecx, &["pthread_setname_np"])?;
}
_ => {} // No "extern statics" supported on this target
Expand Down
10 changes: 5 additions & 5 deletions src/shims/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use rustc_middle::{mir, ty};
use rustc_session::config::OomStrategy;
use rustc_span::Symbol;
use rustc_target::callconv::FnAbi;
use rustc_target::spec::Arch;
use rustc_target::spec::{Arch, Os};

use super::alloc::EvalContextExt as _;
use super::backtrace::EvalContextExt as _;
Expand Down Expand Up @@ -101,9 +101,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {

fn is_dyn_sym(&self, name: &str) -> bool {
let this = self.eval_context_ref();
match this.tcx.sess.target.os.as_ref() {
match &this.tcx.sess.target.os {
os if this.target_os_is_unix() => shims::unix::foreign_items::is_dyn_sym(name, os),
"windows" => shims::windows::foreign_items::is_dyn_sym(name),
Os::Windows => shims::windows::foreign_items::is_dyn_sym(name),
_ => false,
}
}
Expand Down Expand Up @@ -842,12 +842,12 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
}

// Platform-specific shims
return match this.tcx.sess.target.os.as_ref() {
return match &this.tcx.sess.target.os {
_ if this.target_os_is_unix() =>
shims::unix::foreign_items::EvalContextExt::emulate_foreign_item_inner(
this, link_name, abi, args, dest,
),
"windows" =>
Os::Windows =>
shims::windows::foreign_items::EvalContextExt::emulate_foreign_item_inner(
this, link_name, abi, args, dest,
),
Expand Down
4 changes: 2 additions & 2 deletions src/shims/native_lib/trace/parent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ fn handle_segfault(

// Move the instr ptr into the deprotection code.
#[expect(clippy::as_conversions)]
new_regs.set_ip(mempr_off as usize);
new_regs.set_ip(mempr_off as *const () as usize);
// Don't mess up the stack by accident!
new_regs.set_sp(stack_ptr);

Expand Down Expand Up @@ -553,7 +553,7 @@ fn handle_segfault(

// Reprotect everything and continue.
#[expect(clippy::as_conversions)]
new_regs.set_ip(mempr_on as usize);
new_regs.set_ip(mempr_on as *const () as usize);
new_regs.set_sp(stack_ptr);
ptrace::setregs(pid, new_regs).unwrap();
wait_for_signal(Some(pid), signal::SIGSTOP, InitialCont::Yes)?;
Expand Down
5 changes: 3 additions & 2 deletions src/shims/os_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::os::windows::ffi::{OsStrExt, OsStringExt};
use std::path::{Path, PathBuf};

use rustc_middle::ty::Ty;
use rustc_target::spec::Os;

use crate::*;

Expand Down Expand Up @@ -329,7 +330,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
// Below we assume that everything non-Windows works like Unix, at least
// when it comes to file system path conventions.
#[cfg(windows)]
return if target_os == "windows" {
return if *target_os == Os::Windows {
// Windows-on-Windows, all fine.
os_str
} else {
Expand All @@ -346,7 +347,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
Cow::Owned(OsString::from_wide(&path))
};
#[cfg(unix)]
return if target_os == "windows" {
return if *target_os == Os::Windows {
// Windows target, Unix host.
let mut path: Vec<u8> = os_str.into_owned().into_encoded_bytes();
match direction {
Expand Down
Loading