Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8b83d4b
Adds recursion limit into FindParamInClause
spirali Feb 18, 2026
e5250ec
tools: remote-test-server: Add UEFI run support
Ayush1325 Mar 1, 2026
affe609
tests: codegen-llvm: iter-repeat-n-trivial-drop: Allow non-zero lower…
Gelbpunkt Mar 2, 2026
13ddff5
Adapt codegen test to accept operand bundles
TimNN Mar 2, 2026
6d6493a
tweak r-a default settings
WaffleLapkin Nov 3, 2025
390f683
std: move non-path functions into dedicated module in PAL
joboet Mar 2, 2026
866975f
std: move SOLID error converting out of `pal::os`
joboet Mar 2, 2026
d31aecf
std: reorganize some WASI helpers
joboet Mar 4, 2026
fcddf7f
Propagate certainty
spirali Mar 5, 2026
58652d5
Fix LegacyKeyValueFormat report from docker build: ohos
homersimpsons Mar 7, 2026
592246e
Added comments
spirali Mar 7, 2026
85c4af7
Rustfmt now support use closures on edition 2018
spastorino Jul 2, 2025
e636647
Move some ui tests
reddevilmidzy Mar 9, 2026
00980f4
Test for armv7 `get_unchecked(...)` inlining
Jamesbarford Feb 19, 2026
4019a92
Add new `rustc_errors::DiagDecorator` type
GuillaumeGomez Mar 7, 2026
c45bf4a
Remove `TyCtxt::node_span_lint` usage from `rustc_lint`
GuillaumeGomez Mar 6, 2026
01aff0d
Remove `TyCtxt::node_span_lint` usage from `rustc_middle`
GuillaumeGomez Mar 6, 2026
0d974a2
Remove `TyCtxt::node_span_lint` usage from `rustc_mir_build`
GuillaumeGomez Mar 6, 2026
3a64713
Remove `TyCtxt::node_span_lint` usage from `rustc_mir_transform`
GuillaumeGomez Mar 6, 2026
4e2a519
Remove `TyCtxt::node_span_lint` usage from `rustc_trait_selection`
GuillaumeGomez Mar 6, 2026
344344b
Remove `TyCtxt::node_span_lint` usage from `librustdoc`
GuillaumeGomez Mar 6, 2026
d31a17f
Use `DiagDecorator` instead of `derive(Diagnostic)` in `compiler/rust…
GuillaumeGomez Mar 8, 2026
a5bd6be
Rollup merge of #152847 - Jamesbarford:chore/get_unchecked-inline-tes…
JonathanBrouwer Mar 9, 2026
2f5d672
Rollup merge of #153290 - Gelbpunkt:iter-repeat-n-trivial-drop-lower-…
JonathanBrouwer Mar 9, 2026
b8e01ed
Rollup merge of #153413 - joboet:organize-pal-os, r=Mark-Simulacrum
JonathanBrouwer Mar 9, 2026
9c09ff3
Rollup merge of #139692 - spastorino:do-not-rustfmt-ignore, r=Mark-Si…
JonathanBrouwer Mar 9, 2026
fad370c
Rollup merge of #152800 - spirali:fix-FindParamInClause, r=lcnr
JonathanBrouwer Mar 9, 2026
8b12e0a
Rollup merge of #153244 - Ayush1325:uefi-run-test, r=Mark-Simulacrum
JonathanBrouwer Mar 9, 2026
662798e
Rollup merge of #153305 - TimNN:bundle-assert, r=Mark-Simulacrum
JonathanBrouwer Mar 9, 2026
3fdbbfb
Rollup merge of #153340 - WaffleLapkin:ra-settings-tweaks, r=Mark-Sim…
JonathanBrouwer Mar 9, 2026
d4630f1
Rollup merge of #153509 - GuillaumeGomez:migrate-diag2, r=JonathanBro…
JonathanBrouwer Mar 9, 2026
4ff5147
Rollup merge of #153527 - homersimpsons:chore/fix-LegacyKeyValueForma…
JonathanBrouwer Mar 9, 2026
2d9fde7
Rollup merge of #153594 - reddevilmidzy:ui-refactor, r=JohnTitor,Kivooeo
JonathanBrouwer Mar 9, 2026
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
11 changes: 8 additions & 3 deletions library/std/src/sys/env/wasi.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
use core::slice::memchr;

pub use super::common::Env;
use crate::ffi::{CStr, OsStr, OsString};
use crate::ffi::{CStr, OsStr, OsString, c_char};
use crate::io;
use crate::os::wasi::prelude::*;
use crate::sys::helpers::run_with_cstr;
use crate::sys::pal::os::{cvt, libc};
use crate::sys::pal::cvt;

// This is not available yet in libc.
unsafe extern "C" {
fn __wasilibc_get_environ() -> *mut *mut c_char;
}

cfg_select! {
target_feature = "atomics" => {
Expand Down Expand Up @@ -37,7 +42,7 @@ pub fn env() -> Env {
// Use `__wasilibc_get_environ` instead of `environ` here so that we
// don't require wasi-libc to eagerly initialize the environment
// variables.
let mut environ = libc::__wasilibc_get_environ();
let mut environ = __wasilibc_get_environ();

let mut result = Vec::new();
if !environ.is_null() {
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/net/connection/socket/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ fn on_resolver_failure() {
use crate::sys;

// If the version fails to parse, we treat it the same as "not glibc".
if let Some(version) = sys::os::glibc_version() {
if let Some(version) = sys::pal::conf::glibc_version() {
if version < (2, 26) {
unsafe { libc::res_init() };
}
Expand Down
8 changes: 8 additions & 0 deletions library/std/src/sys/pal/solid/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ use super::{abi, itron};
use crate::io;
use crate::sys::net;

// SOLID directly maps `errno`s to μITRON error codes.
impl SolidError {
#[inline]
pub(crate) fn as_io_error(self) -> crate::io::Error {
crate::io::Error::from_raw_os_error(self.as_raw())
}
}

/// Describe the specified SOLID error code. Returns `None` if it's an
/// undefined error code.
///
Expand Down
10 changes: 1 addition & 9 deletions library/std/src/sys/pal/solid/os.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
use super::{itron, unsupported};
use super::unsupported;
use crate::ffi::{OsStr, OsString};
use crate::path::{self, PathBuf};
use crate::{fmt, io};

// `solid` directly maps `errno`s to μITRON error codes.
impl itron::error::ItronError {
#[inline]
pub(crate) fn as_io_error(self) -> crate::io::Error {
crate::io::Error::from_raw_os_error(self.as_raw())
}
}

pub fn getcwd() -> io::Result<PathBuf> {
unsupported()
}
Expand Down
5 changes: 5 additions & 0 deletions library/std/src/sys/pal/teeos/conf.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Hardcoded to return 4096, since `sysconf` is only implemented as a stub.
pub fn page_size() -> usize {
// unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize };
4096
}
1 change: 1 addition & 0 deletions library/std/src/sys/pal/teeos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#![allow(unused_variables)]
#![allow(dead_code)]

pub mod conf;
pub mod os;
#[path = "../unix/time.rs"]
pub mod time;
Expand Down
6 changes: 0 additions & 6 deletions library/std/src/sys/pal/teeos/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ use crate::ffi::{OsStr, OsString};
use crate::path::PathBuf;
use crate::{fmt, io, path};

// Hardcoded to return 4096, since `sysconf` is only implemented as a stub.
pub fn page_size() -> usize {
// unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize };
4096
}

// Everything below are stubs and copied from unsupported.rs

pub fn getcwd() -> io::Result<PathBuf> {
Expand Down
97 changes: 97 additions & 0 deletions library/std/src/sys/pal/unix/conf.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#[cfg(test)]
mod tests;

#[cfg(not(target_os = "espidf"))]
pub fn page_size() -> usize {
unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize }
}

/// Returns the value for [`confstr(key, ...)`][posix_confstr]. Currently only
/// used on Darwin, but should work on any unix (in case we need to get
/// `_CS_PATH` or `_CS_V[67]_ENV` in the future).
///
/// [posix_confstr]:
/// https://pubs.opengroup.org/onlinepubs/9699919799/functions/confstr.html
//
// FIXME: Support `confstr` in Miri.
#[cfg(all(target_vendor = "apple", not(miri)))]
pub fn confstr(
key: crate::ffi::c_int,
size_hint: Option<usize>,
) -> crate::io::Result<crate::ffi::OsString> {
use crate::ffi::OsString;
use crate::io;
use crate::os::unix::ffi::OsStringExt;

let mut buf: Vec<u8> = Vec::with_capacity(0);
let mut bytes_needed_including_nul = size_hint
.unwrap_or_else(|| {
// Treat "None" as "do an extra call to get the length". In theory
// we could move this into the loop below, but it's hard to do given
// that it isn't 100% clear if it's legal to pass 0 for `len` when
// the buffer isn't null.
unsafe { libc::confstr(key, core::ptr::null_mut(), 0) }
})
.max(1);
// If the value returned by `confstr` is greater than the len passed into
// it, then the value was truncated, meaning we need to retry. Note that
// while `confstr` results don't seem to change for a process, it's unclear
// if this is guaranteed anywhere, so looping does seem required.
while bytes_needed_including_nul > buf.capacity() {
// We write into the spare capacity of `buf`. This lets us avoid
// changing buf's `len`, which both simplifies `reserve` computation,
// allows working with `Vec<u8>` instead of `Vec<MaybeUninit<u8>>`, and
// may avoid a copy, since the Vec knows that none of the bytes are needed
// when reallocating (well, in theory anyway).
buf.reserve(bytes_needed_including_nul);
// `confstr` returns
// - 0 in the case of errors: we break and return an error.
// - The number of bytes written, iff the provided buffer is enough to
// hold the entire value: we break and return the data in `buf`.
// - Otherwise, the number of bytes needed (including nul): we go
// through the loop again.
bytes_needed_including_nul =
unsafe { libc::confstr(key, buf.as_mut_ptr().cast(), buf.capacity()) };
}
// `confstr` returns 0 in the case of an error.
if bytes_needed_including_nul == 0 {
return Err(io::Error::last_os_error());
}
// Safety: `confstr(..., buf.as_mut_ptr(), buf.capacity())` returned a
// non-zero value, meaning `bytes_needed_including_nul` bytes were
// initialized.
unsafe {
buf.set_len(bytes_needed_including_nul);
// Remove the NUL-terminator.
let last_byte = buf.pop();
// ... and smoke-check that it *was* a NUL-terminator.
assert_eq!(last_byte, Some(0), "`confstr` provided a string which wasn't nul-terminated");
};
Ok(OsString::from_vec(buf))
}

#[cfg(all(target_os = "linux", target_env = "gnu"))]
pub fn glibc_version() -> Option<(usize, usize)> {
use crate::ffi::CStr;

unsafe extern "C" {
fn gnu_get_libc_version() -> *const libc::c_char;
}
let version_cstr = unsafe { CStr::from_ptr(gnu_get_libc_version()) };
if let Ok(version_str) = version_cstr.to_str() {
parse_glibc_version(version_str)
} else {
None
}
}

/// Returns Some((major, minor)) if the string is a valid "x.y" version,
/// ignoring any extra dot-separated parts. Otherwise return None.
#[cfg(all(target_os = "linux", target_env = "gnu"))]
fn parse_glibc_version(version: &str) -> Option<(usize, usize)> {
let mut parsed_ints = version.split('.').map(str::parse::<usize>).fuse();
match (parsed_ints.next(), parsed_ints.next()) {
(Some(Ok(major)), Some(Ok(minor))) => Some((major, minor)),
_ => None,
}
}
1 change: 1 addition & 0 deletions library/std/src/sys/pal/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use crate::io;

pub mod conf;
#[cfg(target_os = "fuchsia")]
pub mod fuchsia;
pub mod futex;
Expand Down
101 changes: 7 additions & 94 deletions library/std/src/sys/pal/unix/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

#![allow(unused_imports)] // lots of cfg code here

#[cfg(test)]
mod tests;

use libc::{c_char, c_int, c_void};

use crate::ffi::{CStr, OsStr, OsString};
Expand Down Expand Up @@ -396,75 +393,15 @@ pub fn current_exe() -> io::Result<PathBuf> {
if !path.is_absolute() { getcwd().map(|cwd| cwd.join(path)) } else { Ok(path) }
}

#[cfg(not(target_os = "espidf"))]
pub fn page_size() -> usize {
unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize }
}

// Returns the value for [`confstr(key, ...)`][posix_confstr]. Currently only
// used on Darwin, but should work on any unix (in case we need to get
// `_CS_PATH` or `_CS_V[67]_ENV` in the future).
//
// [posix_confstr]:
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/confstr.html
//
// FIXME: Support `confstr` in Miri.
#[cfg(all(target_vendor = "apple", not(miri)))]
fn confstr(key: c_int, size_hint: Option<usize>) -> io::Result<OsString> {
let mut buf: Vec<u8> = Vec::with_capacity(0);
let mut bytes_needed_including_nul = size_hint
.unwrap_or_else(|| {
// Treat "None" as "do an extra call to get the length". In theory
// we could move this into the loop below, but it's hard to do given
// that it isn't 100% clear if it's legal to pass 0 for `len` when
// the buffer isn't null.
unsafe { libc::confstr(key, core::ptr::null_mut(), 0) }
})
.max(1);
// If the value returned by `confstr` is greater than the len passed into
// it, then the value was truncated, meaning we need to retry. Note that
// while `confstr` results don't seem to change for a process, it's unclear
// if this is guaranteed anywhere, so looping does seem required.
while bytes_needed_including_nul > buf.capacity() {
// We write into the spare capacity of `buf`. This lets us avoid
// changing buf's `len`, which both simplifies `reserve` computation,
// allows working with `Vec<u8>` instead of `Vec<MaybeUninit<u8>>`, and
// may avoid a copy, since the Vec knows that none of the bytes are needed
// when reallocating (well, in theory anyway).
buf.reserve(bytes_needed_including_nul);
// `confstr` returns
// - 0 in the case of errors: we break and return an error.
// - The number of bytes written, iff the provided buffer is enough to
// hold the entire value: we break and return the data in `buf`.
// - Otherwise, the number of bytes needed (including nul): we go
// through the loop again.
bytes_needed_including_nul =
unsafe { libc::confstr(key, buf.as_mut_ptr().cast::<c_char>(), buf.capacity()) };
}
// `confstr` returns 0 in the case of an error.
if bytes_needed_including_nul == 0 {
return Err(io::Error::last_os_error());
}
// Safety: `confstr(..., buf.as_mut_ptr(), buf.capacity())` returned a
// non-zero value, meaning `bytes_needed_including_nul` bytes were
// initialized.
unsafe {
buf.set_len(bytes_needed_including_nul);
// Remove the NUL-terminator.
let last_byte = buf.pop();
// ... and smoke-check that it *was* a NUL-terminator.
assert_eq!(last_byte, Some(0), "`confstr` provided a string which wasn't nul-terminated");
};
Ok(OsString::from_vec(buf))
}

#[cfg(all(target_vendor = "apple", not(miri)))]
fn darwin_temp_dir() -> PathBuf {
confstr(libc::_CS_DARWIN_USER_TEMP_DIR, Some(64)).map(PathBuf::from).unwrap_or_else(|_| {
// It failed for whatever reason (there are several possible reasons),
// so return the global one.
PathBuf::from("/tmp")
})
crate::sys::pal::conf::confstr(libc::_CS_DARWIN_USER_TEMP_DIR, Some(64))
.map(PathBuf::from)
.unwrap_or_else(|_| {
// It failed for whatever reason (there are several possible reasons),
// so return the global one.
PathBuf::from("/tmp")
})
}

pub fn temp_dir() -> PathBuf {
Expand Down Expand Up @@ -532,27 +469,3 @@ pub fn home_dir() -> Option<PathBuf> {
}
}
}

#[cfg(all(target_os = "linux", target_env = "gnu"))]
pub fn glibc_version() -> Option<(usize, usize)> {
unsafe extern "C" {
fn gnu_get_libc_version() -> *const libc::c_char;
}
let version_cstr = unsafe { CStr::from_ptr(gnu_get_libc_version()) };
if let Ok(version_str) = version_cstr.to_str() {
parse_glibc_version(version_str)
} else {
None
}
}

// Returns Some((major, minor)) if the string is a valid "x.y" version,
// ignoring any extra dot-separated parts. Otherwise return None.
#[cfg(all(target_os = "linux", target_env = "gnu"))]
fn parse_glibc_version(version: &str) -> Option<(usize, usize)> {
let mut parsed_ints = version.split('.').map(str::parse::<usize>).fuse();
match (parsed_ints.next(), parsed_ints.next()) {
(Some(Ok(major)), Some(Ok(minor))) => Some((major, minor)),
_ => None,
}
}
4 changes: 2 additions & 2 deletions library/std/src/sys/pal/unix/stack_overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ mod imp {
use super::thread_info::{delete_current_info, set_current_info, with_current_info};
use crate::ops::Range;
use crate::sync::atomic::{Atomic, AtomicBool, AtomicPtr, AtomicUsize, Ordering};
use crate::sys::pal::unix::os;
use crate::sys::pal::unix::conf;
use crate::{io, mem, ptr};

// Signal handler for the SIGSEGV and SIGBUS handlers. We've got guard pages
Expand Down Expand Up @@ -150,7 +150,7 @@ mod imp {
/// Must be called only once
#[forbid(unsafe_op_in_unsafe_fn)]
pub unsafe fn init() {
PAGE_SIZE.store(os::page_size(), Ordering::Relaxed);
PAGE_SIZE.store(conf::page_size(), Ordering::Relaxed);

let mut guard_page_range = unsafe { install_main_guard() };

Expand Down
4 changes: 4 additions & 0 deletions library/std/src/sys/pal/wasi/conf.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#[allow(dead_code)]
pub fn page_size() -> usize {
unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize }
}
11 changes: 0 additions & 11 deletions library/std/src/sys/pal/wasi/helpers.rs

This file was deleted.

Loading