about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-10-01Auto merge of #147198 - matthiaskrgr:rollup-b0ryvvu, r=matthiaskrgrbors-45/+243
Rollup of 6 pull requests Successful merges: - rust-lang/rust#143069 (Add fast-path for accessing the current thread id) - rust-lang/rust#146518 (Improve the documentation around `ZERO_AR_DATE`) - rust-lang/rust#146596 (Add a dummy codegen backend) - rust-lang/rust#146617 (Don’t suggest foreign `doc(hidden)` types in "the following other types implement trait" diagnostics) - rust-lang/rust#146635 (cg_llvm: Stop using `as_c_char_ptr` for coverage-related bindings) - rust-lang/rust#147184 (Fix the bevy implied bounds hack for the next solver) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-30Rollup merge of #147184 - jdonszelmann:bevy-outlives-bound, r=lcnrMatthias Krüger-3/+15
Fix the bevy implied bounds hack for the next solver The diff is trivial, of course, and basically what you already suggested. Mostly dug around a bunch to learn. I hope this is roughly what you had in mind. Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/236. r? `@lcnr`
2025-09-30Rollup merge of #146635 - Zalathar:llvm-cov, r=SparrowLiiMatthias Krüger-17/+26
cg_llvm: Stop using `as_c_char_ptr` for coverage-related bindings [As explained by a note in `ffi.rs`](https://github.com/rust-lang/rust/blob/8a1b39995e5b630c5872f5de5079f1f569bd5ac2/compiler/rustc_codegen_llvm/src/llvm/ffi.rs#L4-L11), passing strings and byte slices through FFI is more convenient if we take advantage of the fact that `*const c_uchar` and `*const c_char` have the same ABI. Doing so avoids having to rely on a special helper function, since we can just call `as_ptr` instead. (The same logic applies to every other binding that currently uses the `as_c_char_ptr` helper; I just haven't adjusted all of them yet.) --- As a drive-by change, this PR also marks some coverage-related FFI bindings as `safe`.
2025-09-30Rollup merge of #146617 - Jules-Bertholet:E0277-NOFORN, r=SparrowLiiMatthias Krüger-15/+94
Don’t suggest foreign `doc(hidden)` types in "the following other types implement trait" diagnostics Fixes https://github.com/rust-lang/rust/issues/132024. ``@rustbot`` label A-diagnostics T-compiler
2025-09-30Rollup merge of #146596 - bjorn3:dummy_backend, r=SparrowLiiMatthias Krüger-4/+70
Add a dummy codegen backend This allows building a rustc capable of running the frontend without any backend present. While this may not seem all that useful, it allows running the frontend of rustc to report errors or running miri to interpret a program without any backend present. This is useful when you are trying to say run miri in the browser as upstream LLVM can't be compiled for wasm yet. Or to run rustc itself in miri like I did a while ago and caught some UB.
2025-09-30Rollup merge of #146518 - madsmtm:ld-reproducible-doc, r=SparrowLiiMatthias Krüger-3/+13
Improve the documentation around `ZERO_AR_DATE` In particular, document why we don't use the new `-reproducible` flag. I went through [the source for Apple's old linker](https://github.com/apple-oss-distributions/ld64), and compared the versions with [the mapping to Xcode versions on Wikipedia](https://en.wikipedia.org/wiki/Xcode) to find the relevant Xcode versions for these features. r? compiler
2025-09-30Rollup merge of #143069 - jsimmons:current-thread-id-accessor, ↵Matthias Krüger-3/+25
r=joshtriplett,tgross35 Add fast-path for accessing the current thread id Accessing the thread id is often used in profiling and debugging, as well as some approaches for sound single-threaded access to shared data. Currently the only way to access the thread id is by first obtaining a handle to the current thread. While this is not exactly slow, it does require an atomic inc-ref and dec-ref operation, as well as the injection of `Thread`'s drop code into the caller. This publicly exposes the existing fast-path for accessing the current thread id. edit: ACP: https://github.com/rust-lang/libs-team/issues/650
2025-09-30clone region obligations instead of taking in implied bounds hackJana Dönszelmann-1/+11
2025-09-30Auto merge of #147197 - matthiaskrgr:rollup-du5e4pv, r=matthiaskrgrbors-142/+409
Rollup of 6 pull requests Successful merges: - rust-lang/rust#142506 (Add `Path::has_trailing_sep` and related methods) - rust-lang/rust#146886 (Add repr(align(2)) to RcInner and ArcInner) - rust-lang/rust#147166 (several small `proc_macro` cleanups) - rust-lang/rust#147172 (bootstrap: build bootstrap docs with in-tree rustdoc) - rust-lang/rust#147181 (cg_llvm: Replace enum `MetadataType` with a list of `MetadataKindId` constants) - rust-lang/rust#147187 (remove unnecessary test directives) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-30Add fast-path for accessing the current thread idJosh Simmons-3/+25
Accessing the thread id is often used in profiling and debugging, as well as some approaches for sound single-threaded access to data. Currently the only way to access the thread id is by first obtaining a handle to the current thread. While this is not exactly slow, it does require an atomic inc-ref and dec-ref operation, as well as the injection of `Thread`'s drop code into the caller. This publicly exposes the existing fast-path for accessing the current thread id.
2025-09-30Rollup merge of #147187 - lcnr:rarw, r=lqdMatthias Krüger-7/+0
remove unnecessary test directives that's... odd
2025-09-30Rollup merge of #147181 - Zalathar:fixed-metadata, r=petrochenkovMatthias Krüger-51/+141
cg_llvm: Replace enum `MetadataType` with a list of `MetadataKindId` constants The metadata kind ID values declared in `MetadataType` are not part of the LLVM-C API, and are not machine-checked. If a value that we use ever goes out of sync with LLVM, the resulting bugs could be difficult to track down. And the existing values lack any clear indication of what LLVM declarations they correspond to. On top of that, we currently have another way of expressing metadata kind IDs in the form of `MetadataKindId`, which creates confusing inconsistency in LLVM bindings. This PR therefore consolidates all usage of “fixed” metadata kind IDs into one list of `MetadataKindId` constants, which is backed by static assertions in our C++ code that match them up with named anonymous-enum variants in `llvm::LLVMContext`.
2025-09-30Rollup merge of #147172 - notriddle:tooldoc, r=KobzolMatthias Krüger-18/+21
bootstrap: build bootstrap docs with in-tree rustdoc All of the docs need to be built with the same rustdoc. Otherwise, any change to the search index breaks everything, because the two rustdocs don't agree on the format. Fixes https://github.com/rust-lang/rust/issues/147142
2025-09-30Rollup merge of #147166 - cyrgani:proc-macro-cleanup-1, r=petrochenkovMatthias Krüger-54/+14
several small `proc_macro` cleanups
2025-09-30Rollup merge of #146886 - taiki-e:rc-inner-align, r=Mark-SimulacrumMatthias Krüger-8/+12
Add repr(align(2)) to RcInner and ArcInner `Rc` currently assumes that `RcInner` has at least 2-byte alignment, but on AVR, `usize` has 1-byte alignment (this is because the AVR has 1-byte register sizes, so having 2-byte alignment is generally useless), breaking this assumption. https://github.com/rust-lang/rust/blob/9f32ccf35fb877270bc44a86a126440f04d676d0/library/alloc/src/rc.rs#L3005-L3008 This PR adds `repr(align(2))` to force `RcInner` to always have at least 2-byte alignment. Note that `ArcInner` doesn't need `repr(align(2))` because atomic types have the alignment same as its size. This PR adds a comment about this.
2025-09-30Rollup merge of #142506 - clarfonthey:path-trailing-sep, r=joboetMatthias Krüger-4/+221
Add `Path::has_trailing_sep` and related methods Implements rust-lang/libs-team#335. Tracking issue: rust-lang/rust#142503 Notable differences from ACP: * `trim_trailing_sep` was added to `Path` since it felt reasonable to ensure that the inverse operation was available. * Per suggestion of `@kennytm,` added `push_trailing_sep` and `pop_trailing_sep` to `PathBuf` in addition to `set_trailing_sep`. This also updates some of the docs on various `Path` methods to use the term "trailing separator" instead of "trailing slash" for consistency.
2025-09-30Auto merge of #147186 - Zalathar:rollup-sza9wxl, r=Zalatharbors-161/+499
Rollup of 5 pull requests Successful merges: - rust-lang/rust#140916 (Fix unuseful span in type error in some format_args!() invocations) - rust-lang/rust#146011 (Point at fn bound that introduced lifetime obligation) - rust-lang/rust#146649 (cmse: fix 'region variables should not be hashed') - rust-lang/rust#147109 (Rename various "concrete opaque type" things to say "hidden type") - rust-lang/rust#147167 (Don't condition RUSTDOC_LIBDIR on `--no-doc`) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-30bootstrap: build bootstrap docs with in-tree rustdocMichael Howell-18/+21
All of the docs need to be built with the same rustdoc. Otherwise, any change to the search index breaks everything, because the two rustdocs don't agree on the format.
2025-09-30Add repr(align(2)) to RcInner and ArcInnerTaiki Endo-8/+12
2025-09-30remove unnecessary test directiveslcnr-7/+0
2025-09-30test bevy compute_implied_bounds hack with new trait solverJana Dönszelmann-2/+4
2025-09-30Rollup merge of #147167 - jyn514:rustdoc-tests, r=KobzolStuart Cook-9/+3
Don't condition RUSTDOC_LIBDIR on `--no-doc` In d94e7ff065cd393a645eb3e9c96ce0418856e95d, `rustdoc_path` was changed to ignore `want_rustdoc` (which is just whether `--no-doc` was passed). But RUSTDOC_LIBDIR wasn't kept in sync. Rather than trying to keep `rustdoc_path` in sync with `RUSTDOC_LIBDIR`, just pass LIBDIR to the rustc shim unconditionally. This fix allows calling `ensure(doc::Step)` from a non-doc top-level Step, even if `--no-doc` was present in the command line.
2025-09-30Rollup merge of #147109 - BoxyUwU:rename_concrete_opaques, r=lcnrStuart Cook-109/+83
Rename various "concrete opaque type" things to say "hidden type" r? lcnr I've found "concrete opaque type" terminology to be somewhat confusing as in conversation and when explaining opaque type stuff to people I always just talk about things in terms of hidden types. Also the hidden types of opaques are very much not *concrete* in the same sense that a type without any generic parameters is concrete which is an unfortunate overlap in terminology. I've tried to update comments to also stop referring to things as concrete opaque types but this is mostly best effort as it difficult to find all such cases amongst the massive amounts of uses of "concrete" or "hidden" across the whole compiler.
2025-09-30Rollup merge of #146649 - folkertdev:cmse-call-erase-regions, r=lcnrStuart Cook-0/+40
cmse: fix 'region variables should not be hashed' tracking issue: https://github.com/rust-lang/rust/issues/81391 fixes https://github.com/rust-lang/rust/issues/131639 Some background: the `cmse-nonsecure-call` calling convention is used for a call from "secure" to "non-secure" code. To make sure that "non-secure" cannot read any secrets, restrictions are put on the signatures of functions with this calling convention: they can only use 4 arguments for passing arguments, and one register for passing a result. No arguments are passed via the stack, and all other registers are cleared before the call. We check during `hir_ty_lowering` that the signature follows these rules. We do that by determining and then inspecting the layout of the type. That works well overall, but can run into asserts when the type itself is ill-formed. This PR fixes one such case. I believe that the fix here, just erasing the regions, is the right shape, but there may be some nuance that I'm missing. r? types
2025-09-30Rollup merge of #146011 - estebank:lifetime-obligation-span, r=lcnrStuart Cook-32/+258
Point at fn bound that introduced lifetime obligation The last note is new ``` error[E0597]: `c` does not live long enough --> $DIR/without-precise-captures-we-are-powerless.rs:19:20 | LL | fn simple<'a>(x: &'a i32) { | -- lifetime `'a` defined here ... LL | let c = async move || { println!("{}", *x); }; | - binding `c` declared here LL | outlives::<'a>(c()); | ---------------^--- | | | | | borrowed value does not live long enough | argument requires that `c` is borrowed for `'a` LL | outlives::<'a>(call_once(c)); LL | } | - `c` dropped here while still borrowed | note: requirement that `c` is borrowed for `'a` introduced here --> $DIR/without-precise-captures-we-are-powerless.rs:7:33 | LL | fn outlives<'a>(_: impl Sized + 'a) {} | ^^ ``` When encountering a `ConstraintCategory::Predicate` in a funtion call, point at the `Span` for that `Predicate` to explain where the lifetime obligation originates from. CC rust-lang/rust#55307.
2025-09-30Rollup merge of #140916 - moatom:140578, r=chenyukangStuart Cook-11/+115
Fix unuseful span in type error in some format_args!() invocations Fixed https://github.com/rust-lang/rust/issues/140578. r? ``@m-ou-se``
2025-09-30Replace `MetadataType` with the `MetadataKindId` constantsZalathar-49/+17
2025-09-30Declare all "fixed" metadata kinds as `MetadataKindId`Zalathar-0/+116
2025-09-30Move `MetadataKindId` into its own submoduleZalathar-10/+16
2025-09-30Fix unuseful span in type error in some format_args!() invocationsTomoaki Kobayashi-36/+60
2025-09-30Add test for unuseful span in type error in some format_args!() invocationsTomoaki Kobayashi-0/+80
2025-09-30Auto merge of #147143 - estebank:verbose-ret-type, r=fee1-deadbors-150/+258
Make replacement suggestion `_` in type verbose ``` error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/in-signature.rs:6:21 | LL | fn arr_fn() -> [u8; _] { | ^ not allowed in type signatures | help: replace with the correct return type | LL - fn arr_fn() -> [u8; _] { LL + fn arr_fn() -> [u8; 3] { | ```
2025-09-30Auto merge of #147169 - jhpratt:rollup-65ooei8, r=jhprattbors-167/+249
Rollup of 4 pull requests Successful merges: - rust-lang/rust#145883 (Make macOS dist build configuration match where reasonable) - rust-lang/rust#146457 (Skip cleanups on unsupported targets) - rust-lang/rust#147152 (builtin `Fn`-trait impls: instantiate binder before the return type `Sized` check) - rust-lang/rust#147153 ([rustdoc] Move doc cfg propagation pass before items stripping passes) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-29Rollup merge of #147153 - ↵Jacob Pratt-4/+20
GuillaumeGomez:doc-propagation-before-stripping-items, r=lolbinarycat [rustdoc] Move doc cfg propagation pass before items stripping passes Follow-up of https://github.com/rust-lang/rust/pull/138907. r? lolbinarycat
2025-09-29Rollup merge of #147152 - lcnr:instantiate-pre-sized-check, r=BoxyUwUJacob Pratt-131/+134
builtin `Fn`-trait impls: instantiate binder before the return type `Sized` check fixes - https://github.com/rust-lang/trait-system-refactor-initiative/issues/220 - https://github.com/rust-lang/trait-system-refactor-initiative/issues/204 r? `@BoxyUwU`
2025-09-29Rollup merge of #146457 - alexcrichton:wasm-no-exn-instructions, r=bjorn3Jacob Pratt-27/+86
Skip cleanups on unsupported targets This commit is an update to the `AbortUnwindingCalls` MIR pass in the compiler. Specifically a new boolean is added for "can this target possibly unwind" and if that's `false` then terminators are all adjusted to be unreachable/not present. The end result is that this fixes rust-lang/rust#140293 for wasm targets. The motivation for this PR is that currently on WebAssembly targets the usage of the `C-unwind` ABI can lead LLVM to either (a) emit exception-handling instructions or (b) hit a LLVM-ICE-style codegen error. WebAssembly as a base instruction set does not support unwinding at all, and a later proposal to WebAssembly, the exception-handling proposal, was what enabled this. This means that the current intent of WebAssembly targets is that they maintain the baseline of "don't emit exception-handling instructions unless enabled". The commit here is intended to restore this behavior by skipping these instructions even when `C-unwind` is present. Exception-handling is a relatively tricky and also murky topic in WebAssembly, however. There are two sets of instructions LLVM can emit for WebAssembly exceptions, Rust's Emscripten target supports exceptions, WASI targets do not, the LLVM flags to enable this are not always obvious, and additionally this all touches on "changing exception-handling behavior should be a target-level concern, not a feature". Effectively WebAssembly's exception-handling integration into Rust is not finalized at this time. The best idea at this time is that a parallel set of targets will eventually be added which support exceptions, but it's not clear if/when to do this. In the meantime the goal is to keep existing targets working while still enabling experimentation with exception-handling with `-Zbuild-std` and various permutations of LLVM flags. To that extent this commit does not blanket disable these landing pads and cleanup routines for WebAssembly but instead checks to see if panic=unwind is enabled or if `+exception-handling` is enabled. Tests are updated here as well to account for this where, by default, using a `C-unwind` ABI won't affect Rust codegen at all. If `+exception-handling` is enabled, however, then Rust codegen will look like native platforms where exceptions are caught and the program aborts. More-or-less I've done my best to keep exceptions working on wasm where it's possible to have them work, but turned them off where they're not supposed to be emitted. Closes rust-lang/rust#140293
2025-09-29Rollup merge of #145883 - shepmaster:unify-macos-ci, r=madsmtmJacob Pratt-5/+9
Make macOS dist build configuration match where reasonable r? `@madsmtm`
2025-09-29Don't condition RUSTDOC_LIBDIR on `--no-doc`Jynn Nelson-9/+3
In d94e7ff065cd393a645eb3e9c96ce0418856e95d, `rustdoc_path` was changed to ignore `want_rustdoc` (which is just whether `--no-doc` was passed). But RUSTDOC_LIBDIR wasn't kept in sync. Rather than trying to keep `rustdoc_path` in sync with `RUSTDOC_LIBDIR`, just pass LIBDIR to the rustc shim unconditionally. This fix allows calling `ensure(doc::Step)` from a non-doc top-level Step, even if `--no-doc` was present in the command line.
2025-09-29Auto merge of #147162 - matthiaskrgr:rollup-4bv1xzb, r=matthiaskrgrbors-112/+296
Rollup of 5 pull requests Successful merges: - rust-lang/rust#146937 (std: implement `hostname`) - rust-lang/rust#147040 (mbe: macro_check: Fix function comments referencing non-existent parameters) - rust-lang/rust#147131 (Use MirPatch in simplify_branches.) - rust-lang/rust#147133 (Remove one loop in `extract_cfg_from_attrs`) - rust-lang/rust#147150 (Emit allocator attributes for allocator shim) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-30explicitly implement `!Send` and `!Sync`cyrgani-31/+12
2025-09-30remove unused `#![feature(stmt_expr_attributes)]`cyrgani-1/+0
2025-09-29remove `reverse_{encode, decode}!`cyrgani-22/+2
2025-09-29Rollup merge of #147150 - nikic:alloc-shim-attributes, r=bjorn3Matthias Krüger-4/+26
Emit allocator attributes for allocator shim This emits the same attributes we place on allocator declarations on the definitions in the allocator shim as well. This complements https://github.com/rust-lang/rust/pull/146766, which added the attribute for `#[global_allocator]` definitions. Emitting the attributes on the definitions ensures that they cannot be lost of the allocator shim participates in LTO. See https://github.com/rust-lang/rust/issues/145995 for context, though that one was about `#[global_allocator]`. I'm not sure whether this can occur with the allocator shim as well or not, but better safe than sorry. I'm not sure whether there is any good way to test this, as the allocator shim is not part of `--emit=llvm-ir`. I've verified this locally by inspecting the bitcode produced by `-C save-temps`. r? ``@bjorn3``
2025-09-29Rollup merge of #147133 - GuillaumeGomez:rm-loop-extract_cfg_from_attrs, ↵Matthias Krüger-11/+5
r=lolbinarycat Remove one loop in `extract_cfg_from_attrs` Follow-up of https://github.com/rust-lang/rust/pull/138907. r? lolbinarycat
2025-09-29Rollup merge of #147131 - cjgillot:patch-branches, r=davidtwcoMatthias Krüger-12/+37
Use MirPatch in simplify_branches. This allows to avoid clearing the CFG cache if we don't perform any change. r? ``@ghost`` for perf
2025-09-29Rollup merge of #147040 - joshtriplett:mbe-fix-comments, r=petrochenkovMatthias Krüger-7/+4
mbe: macro_check: Fix function comments referencing non-existent parameters Several functions had comments referencing a non-existent `valid` parameter. Remove those. The `guar` parameter that handles errors is already documented. In the process, remove another duplicate reference to an already-documented parameter (`binders`).
2025-09-29Rollup merge of #146937 - joboet:gethostname, r=Mark-SimulacrumMatthias Krüger-78/+224
std: implement `hostname` Resolves https://github.com/rust-lang/libs-team/issues/330 Tracking issue: https://github.com/rust-lang/rust/issues/135142 This is based on rust-lang/rust#135141, but I've reimplemented the UNIX version, which now: * uses `sysconf(_SC_HOST_NAME_MAX)` as an initial buffer length * returns `OutOfMemory` if the `Vec` allocation fails * retries the operation if it detects that the name returned by `gethostname` was truncated Additionally, as part of the rebase, I had to move some WinSock abstractions (initialisation and error access) to `sys::pal` so that they can be accessed from `sys::net::hostname`. CC ``@orowith2os`` (and thank you for your work!)
2025-09-29Add regression test for doc cfg applied on public items inside private itemsGuillaume Gomez-0/+16
2025-09-29Move doc cfg propagation pass before items stripping passesGuillaume Gomez-4/+4
2025-09-29Auto merge of #146376 - durin42:dwo-specify-path, r=davidtwcobors-13/+167
debuginfo: add an unstable flag to write split DWARF to an explicit directory Bazel requires knowledge of outputs from actions at analysis time, including file or directory name. In order to work around the lack of predictable output name for dwo files, we group the dwo files in a subdirectory of --out-dir as a post-processing step before returning control to bazel. Unfortunately some debugging workflows rely on directly opening the dwo file rather than loading the merged dwp file, and our trick of moving the files breaks those users. We can't just hardlink the file or copy it, because with remote build execution we wouldn't end up with the un-moved file copied back to the developer's workstation. As a fix, we add this unstable flag that causes dwo files to be written to a build-system-controllable location, which then lets bazel hoover up the dwo files, but the objects also have the correct path for the dwo files. r? `@davidtwco`