Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4189005
explicitly start `va_list` lifetime
folkertdev Sep 2, 2025
39d51d0
thread parking: fix docs and examples
RalfJung Aug 26, 2025
1cb749a
support integer literals in `${concat()}`
cyrgani Sep 7, 2025
c776fbf
check before test for hardware capabilites in bits 32~63 of usize
h3fang Sep 8, 2025
be284b6
add some comments to clarify the fix
h3fang Sep 8, 2025
de359c5
fix typos in comment
h3fang Sep 8, 2025
94fbb21
implement `va_arg` for arm in rustc itself
folkertdev Jul 27, 2025
469a80e
all tidy extra checks now print what they do in present tense
lolbinarycat Sep 8, 2025
a9d884d
tidy: py:lint extra check now works with --bless
lolbinarycat Sep 8, 2025
c19d81b
tidy extra checks that interact with --bless now all recommend using it
lolbinarycat Sep 8, 2025
8222f7d
tidy extra checks: use Error::FailedCheck correctly
lolbinarycat Sep 8, 2025
1a13522
Update `browser-ui-test` version to `0.22.2`
GuillaumeGomez Sep 9, 2025
5a36fe2
Improve suggestion in case a bare URL is surrounded by brackets
GuillaumeGomez Sep 10, 2025
3205e4d
Add new ui tests for `rustdoc::bare_urls`
GuillaumeGomez Sep 10, 2025
7966ae0
Simplify code for `find_raw_urls`
GuillaumeGomez Sep 10, 2025
458f387
Bump miow to 0.60.1
dpaoliello Sep 10, 2025
9fe101b
Remove unused import from sys/pal/hermit/os.rs
mkroening Sep 10, 2025
af5355c
Implement `Socket::take_error` for Hermit
mkroening Sep 10, 2025
0928026
rwlock tests: fix miri macos test regression
RalfJung Sep 11, 2025
8d1403c
Change the default value of `gcc.download-ci-gcc` to `true`
Kobzol Sep 11, 2025
bfd5a26
Correctly handle literal search on paths
GuillaumeGomez Sep 11, 2025
04a1dd1
Add regression test for literal search on paths
GuillaumeGomez Sep 11, 2025
18d0dcb
fix config for poison macro test
connortsui20 Sep 11, 2025
256aa0d
Fix `libgccjit` symlink when we build GCC locally
Kobzol Sep 11, 2025
6354c51
update doc comment
connortsui20 Sep 11, 2025
1793eec
test: remove an outdated normalization for rustc versions
cuviper Sep 11, 2025
4c849c7
fix typo in comment
h3fang Sep 12, 2025
48d6841
Rollup merge of #144549 - folkertdev:va-arg-arm, r=saethlin
Zalathar Sep 12, 2025
1037c08
Rollup merge of #145895 - RalfJung:unpark, r=joboet
Zalathar Sep 12, 2025
40520c6
Rollup merge of #146308 - cyrgani:concat-integer-literals, r=jackh726
Zalathar Sep 12, 2025
7429420
Rollup merge of #146323 - h3fang:issue-146230-fix, r=Amanieu
Zalathar Sep 12, 2025
27954ec
Rollup merge of #146332 - lolbinarycat:tidy-extra-checks-regularize, …
Zalathar Sep 12, 2025
119109e
Rollup merge of #146374 - GuillaumeGomez:update-browser-ui-test, r=Gu…
Zalathar Sep 12, 2025
322f5dc
Rollup merge of #146413 - GuillaumeGomez:rustdoc-bare-urls, r=lolbina…
Zalathar Sep 12, 2025
a7a6445
Rollup merge of #146426 - dpaoliello:miow, r=lqd
Zalathar Sep 12, 2025
f40d78f
Rollup merge of #146432 - hermit-os:hermit-take_error, r=joboet
Zalathar Sep 12, 2025
312e15f
Rollup merge of #146433 - RalfJung:rwlock-miri, r=tgross35
Zalathar Sep 12, 2025
7e3aa41
Rollup merge of #146435 - Kobzol:gcc-download-default-true, r=Guillau…
Zalathar Sep 12, 2025
2e51a38
Rollup merge of #146439 - connortsui20:fix-sync-macro-attr, r=RalfJung
Zalathar Sep 12, 2025
249730f
Rollup merge of #146448 - GuillaumeGomez:fix-literal-search-paths, r=…
Zalathar Sep 12, 2025
accb4a3
Rollup merge of #146449 - Kobzol:gcc-fix-symlink, r=GuillaumeGomez
Zalathar Sep 12, 2025
be33ef2
Rollup merge of #146455 - cuviper:no-rustc-version, r=jieyouxu
Zalathar Sep 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
72 changes: 3 additions & 69 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2347,11 +2347,11 @@ dependencies = [

[[package]]
name = "miow"
version = "0.6.0"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "359f76430b20a79f9e20e115b3428614e654f04fab314482fc0fda0ebd3c6044"
checksum = "536bfad37a309d62069485248eeaba1e8d9853aaf951caaeaed0585a95346f08"
dependencies = [
"windows-sys 0.48.0",
"windows-sys 0.60.2",
]

[[package]]
Expand Down Expand Up @@ -6314,15 +6314,6 @@ dependencies = [
"windows-link",
]

[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets 0.48.5",
]

[[package]]
name = "windows-sys"
version = "0.52.0"
Expand Down Expand Up @@ -6350,21 +6341,6 @@ dependencies = [
"windows-targets 0.53.3",
]

[[package]]
name = "windows-targets"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm 0.48.5",
"windows_aarch64_msvc 0.48.5",
"windows_i686_gnu 0.48.5",
"windows_i686_msvc 0.48.5",
"windows_x86_64_gnu 0.48.5",
"windows_x86_64_gnullvm 0.48.5",
"windows_x86_64_msvc 0.48.5",
]

[[package]]
name = "windows-targets"
version = "0.52.6"
Expand Down Expand Up @@ -6407,12 +6383,6 @@ dependencies = [
"windows-link",
]

[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"

[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
Expand All @@ -6425,12 +6395,6 @@ version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"

[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"

[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
Expand All @@ -6443,12 +6407,6 @@ version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"

[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"

[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
Expand All @@ -6473,12 +6431,6 @@ version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"

[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"

[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
Expand All @@ -6491,12 +6443,6 @@ version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"

[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"

[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
Expand All @@ -6509,12 +6455,6 @@ version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"

[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"

[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
Expand All @@ -6527,12 +6467,6 @@ version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"

[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"

[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
Expand Down
15 changes: 15 additions & 0 deletions compiler/rustc_codegen_llvm/src/va_arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,21 @@ pub(super) fn emit_va_arg<'ll, 'tcx>(
)
}
"aarch64" => emit_aapcs_va_arg(bx, addr, target_ty),
"arm" => {
// Types wider than 16 bytes are not currently supported. Clang has special logic for
// such types, but `VaArgSafe` is not implemented for any type that is this large.
assert!(bx.cx.size_of(target_ty).bytes() <= 16);

emit_ptr_va_arg(
bx,
addr,
target_ty,
PassMode::Direct,
SlotSize::Bytes4,
AllowHigherAlign::Yes,
ForceRightAdjust::No,
)
}
"s390x" => emit_s390x_va_arg(bx, addr, target_ty),
"powerpc" => emit_powerpc_va_arg(bx, addr, target_ty),
"powerpc64" | "powerpc64le" => emit_ptr_va_arg(
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
LocalRef::Place(va_list) => {
bx.va_end(va_list.val.llval);

// Explicitly end the lifetime of the `va_list`, this matters for LLVM.
// Explicitly end the lifetime of the `va_list`, improves LLVM codegen.
bx.lifetime_end(va_list.val.llval, va_list.layout.size);
}
_ => bug!("C-variadic function must have a `VaList` place"),
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_codegen_ssa/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,10 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(

if fx.fn_abi.c_variadic && arg_index == fx.fn_abi.args.len() {
let va_list = PlaceRef::alloca(bx, bx.layout_of(arg_ty));

// Explicitly start the lifetime of the `va_list`, improves LLVM codegen.
bx.lifetime_start(va_list.val.llval, va_list.layout.size);

bx.va_start(va_list.val.llval);

return LocalRef::Place(va_list);
Expand Down
18 changes: 17 additions & 1 deletion compiler/rustc_expand/src/mbe/transcribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -940,11 +940,27 @@ fn extract_symbol_from_pnr<'a>(
{
Ok(*symbol)
}
ParseNtResult::Literal(expr)
if let ExprKind::Lit(lit @ Lit { kind: LitKind::Integer, symbol, suffix }) =
&expr.kind =>
{
if lit.is_semantic_float() {
Err(dcx
.struct_err("floats are not supported as metavariables of `${concat(..)}`")
.with_span(span_err))
} else if suffix.is_none() {
Ok(*symbol)
} else {
Err(dcx
.struct_err("integer metavariables of `${concat(..)}` must not be suffixed")
.with_span(span_err))
}
}
_ => Err(dcx
.struct_err(
"metavariables of `${concat(..)}` must be of type `ident`, `literal` or `tt`",
)
.with_note("currently only string literals are supported")
.with_note("currently only string and integer literals are supported")
.with_span(span_err)),
}
}
3 changes: 2 additions & 1 deletion library/std/src/sys/net/connection/socket/hermit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ impl Socket {
}

pub fn take_error(&self) -> io::Result<Option<io::Error>> {
unimplemented!()
let raw: c_int = getsockopt(self, libc::SOL_SOCKET, libc::SO_ERROR)?;
if raw == 0 { Ok(None) } else { Ok(Some(io::Error::from_raw_os_error(raw as i32))) }
}

// This is used by sys_common code to abstract over Windows and Unix.
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/pal/hermit/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::ffi::{OsStr, OsString};
use crate::marker::PhantomData;
use crate::path::{self, PathBuf};
use crate::sys::unsupported;
use crate::{fmt, io, str};
use crate::{fmt, io};

pub fn errno() -> i32 {
unsafe { hermit_abi::get_errno() }
Expand Down
4 changes: 3 additions & 1 deletion library/std/src/sys/sync/once/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@ fn wait(
// If the managing thread happens to signal and unpark us before we
// can park ourselves, the result could be this thread never gets
// unparked. Luckily `park` comes with the guarantee that if it got
// an `unpark` just before on an unparked thread it does not park.
// an `unpark` just before on an unparked thread it does not park. Crucially, we know
// the `unpark` must have happened between the `compare_exchange_weak` above and here,
// and there's no other `park` in that code that could steal our token.
// SAFETY: we retrieved this handle on the current thread above.
unsafe { node.thread.park() }
}
Expand Down
67 changes: 52 additions & 15 deletions library/std/src/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1021,13 +1021,23 @@ impl Drop for PanicGuard {
/// specifying a maximum time to block the thread for.
///
/// * The [`unpark`] method on a [`Thread`] atomically makes the token available
/// if it wasn't already. Because the token is initially absent, [`unpark`]
/// followed by [`park`] will result in the second call returning immediately.
///
/// The API is typically used by acquiring a handle to the current thread,
/// placing that handle in a shared data structure so that other threads can
/// find it, and then `park`ing in a loop. When some desired condition is met, another
/// thread calls [`unpark`] on the handle.
/// if it wasn't already. Because the token can be held by a thread even if it is currently not
/// parked, [`unpark`] followed by [`park`] will result in the second call returning immediately.
/// However, note that to rely on this guarantee, you need to make sure that your `unpark` happens
/// after all `park` that may be done by other data structures!
///
/// The API is typically used by acquiring a handle to the current thread, placing that handle in a
/// shared data structure so that other threads can find it, and then `park`ing in a loop. When some
/// desired condition is met, another thread calls [`unpark`] on the handle. The last bullet point
/// above guarantees that even if the `unpark` occurs before the thread is finished `park`ing, it
/// will be woken up properly.
///
/// Note that the coordination via the shared data structure is crucial: If you `unpark` a thread
/// without first establishing that it is about to be `park`ing within your code, that `unpark` may
/// get consumed by a *different* `park` in the same thread, leading to a deadlock. This also means
/// you must not call unknown code between setting up for parking and calling `park`; for instance,
/// if you invoke `println!`, that may itself call `park` and thus consume your `unpark` and cause a
/// deadlock.
///
/// The motivation for this design is twofold:
///
Expand Down Expand Up @@ -1058,33 +1068,47 @@ impl Drop for PanicGuard {
///
/// ```
/// use std::thread;
/// use std::sync::{Arc, atomic::{Ordering, AtomicBool}};
/// use std::sync::atomic::{Ordering, AtomicBool};
/// use std::time::Duration;
///
/// let flag = Arc::new(AtomicBool::new(false));
/// let flag2 = Arc::clone(&flag);
/// static QUEUED: AtomicBool = AtomicBool::new(false);
/// static FLAG: AtomicBool = AtomicBool::new(false);
///
/// let parked_thread = thread::spawn(move || {
/// println!("Thread spawned");
/// // Signal that we are going to `park`. Between this store and our `park`, there may
/// // be no other `park`, or else that `park` could consume our `unpark` token!
/// QUEUED.store(true, Ordering::Release);
/// // We want to wait until the flag is set. We *could* just spin, but using
/// // park/unpark is more efficient.
/// while !flag2.load(Ordering::Relaxed) {
/// println!("Parking thread");
/// while !FLAG.load(Ordering::Acquire) {
/// // We can *not* use `println!` here since that could use thread parking internally.
/// thread::park();
/// // We *could* get here spuriously, i.e., way before the 10ms below are over!
/// // But that is no problem, we are in a loop until the flag is set anyway.
/// println!("Thread unparked");
/// }
/// println!("Flag received");
/// });
///
/// // Let some time pass for the thread to be spawned.
/// thread::sleep(Duration::from_millis(10));
///
/// // Ensure the thread is about to park.
/// // This is crucial! It guarantees that the `unpark` below is not consumed
/// // by some other code in the parked thread (e.g. inside `println!`).
/// while !QUEUED.load(Ordering::Acquire) {
/// // Spinning is of course inefficient; in practice, this would more likely be
/// // a dequeue where we have no work to do if there's nobody queued.
/// std::hint::spin_loop();
/// }
///
/// // Set the flag, and let the thread wake up.
/// // There is no race condition here, if `unpark`
/// // There is no race condition here: if `unpark`
/// // happens first, `park` will return immediately.
/// // There is also no other `park` that could consume this token,
/// // since we waited until the other thread got queued.
/// // Hence there is no risk of a deadlock.
/// flag.store(true, Ordering::Relaxed);
/// FLAG.store(true, Ordering::Release);
/// println!("Unpark the thread");
/// parked_thread.thread().unpark();
///
Expand Down Expand Up @@ -1494,10 +1518,14 @@ impl Thread {
/// ```
/// use std::thread;
/// use std::time::Duration;
/// use std::sync::atomic::{AtomicBool, Ordering};
///
/// static QUEUED: AtomicBool = AtomicBool::new(false);
///
/// let parked_thread = thread::Builder::new()
/// .spawn(|| {
/// println!("Parking thread");
/// QUEUED.store(true, Ordering::Release);
/// thread::park();
/// println!("Thread unparked");
/// })
Expand All @@ -1506,6 +1534,15 @@ impl Thread {
/// // Let some time pass for the thread to be spawned.
/// thread::sleep(Duration::from_millis(10));
///
/// // Wait until the other thread is queued.
/// // This is crucial! It guarantees that the `unpark` below is not consumed
/// // by some other code in the parked thread (e.g. inside `println!`).
/// while !QUEUED.load(Ordering::Acquire) {
/// // Spinning is of course inefficient; in practice, this would more likely be
/// // a dequeue where we have no work to do if there's nobody queued.
/// std::hint::spin_loop();
/// }
///
/// println!("Unpark the thread");
/// parked_thread.thread().unpark();
///
Expand Down
4 changes: 4 additions & 0 deletions library/std/src/thread/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ fn test_park_unpark_called_other_thread() {
for _ in 0..10 {
let th = thread::current();

// Here we rely on `thread::spawn` (specifically the part that runs after spawning
// the thread) to not consume the parking token.
let _guard = thread::spawn(move || {
super::sleep(Duration::from_millis(50));
th.unpark();
Expand Down Expand Up @@ -316,6 +318,8 @@ fn test_park_timeout_unpark_called_other_thread() {
for _ in 0..10 {
let th = thread::current();

// Here we rely on `thread::spawn` (specifically the part that runs after spawning
// the thread) to not consume the parking token.
let _guard = thread::spawn(move || {
super::sleep(Duration::from_millis(50));
th.unpark();
Expand Down
Loading
Loading