about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-06-13Remove unneeded lifetimes from signature of BTreeSet::extract_ifDavid Tolnay-4/+4
2025-06-13Auto merge of #142443 - matthiaskrgr:rollup-l1l6d0v, r=matthiaskrgrbors-528/+1443
Rollup of 9 pull requests Successful merges: - rust-lang/rust#128425 (Make `missing_fragment_specifier` an unconditional error) - rust-lang/rust#135927 (retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features) - rust-lang/rust#140770 (add `extern "custom"` functions) - rust-lang/rust#142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches) - rust-lang/rust#142248 (Add supported asm types for LoongArch32) - rust-lang/rust#142267 (assert more in release in `rustc_ast_lowering`) - rust-lang/rust#142274 (Update the stdarch submodule) - rust-lang/rust#142276 (Update dependencies in `library/Cargo.lock`) - rust-lang/rust#142308 (Upgrade `object`, `addr2line`, and `unwinding` in the standard library) Failed merges: - rust-lang/rust#140920 (Extract some shared code from codegen backend target feature handling) r? `@ghost` `@rustbot` modify labels: rollup try-job: aarch64-apple try-job: x86_64-msvc-1 try-job: x86_64-gnu try-job: dist-i586-gnu-i586-i686-musl try-job: test-various
2025-06-13Auto merge of #142451 - flip1995:clippy-subtree-update, r=Manishearthbors-668/+4109
Clippy subtree update r? `@Manishearth` 1 day late. Got distracted yesterday evening and forgot about it.
2025-06-13Auto merge of #142442 - matthiaskrgr:rollup-6yodjfx, r=matthiaskrgrbors-311/+1094
Rollup of 10 pull requests Successful merges: - rust-lang/rust#134847 (Implement asymmetrical precedence for closures and jumps) - rust-lang/rust#141491 (Delegate `<CStr as Debug>` to `ByteStr`) - rust-lang/rust#141770 (Merge `Cfg::render_long_html` and `Cfg::render_long_plain` methods common code) - rust-lang/rust#142069 (Introduce `-Zmacro-stats`) - rust-lang/rust#142158 (Tracking the old name of renamed unstable library features) - rust-lang/rust#142221 ([AIX] strip underlying xcoff object) - rust-lang/rust#142340 (miri: we can use apfloat's mul_add now) - rust-lang/rust#142379 (Add bootstrap option to compile a tool with features) - rust-lang/rust#142410 (intrinsics: rename min_align_of to align_of) - rust-lang/rust#142413 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-13Move COERCE_CONTAINER_TO_ANY to nursery, as it has FPsPhilipp Krones-1/+1
2025-06-13Merge commit '4ef75291b5dd6739212f1f61666d19d4e086690d' into ↵Philipp Krones-668/+4109
clippy-subtree-update
2025-06-13Rustup (#15044)Philipp Krones-116/+128
r? @ghost changelog: none
2025-06-13Bump nightly version -> 2025-06-13Philipp Krones-2/+2
2025-06-13Merge remote-tracking branch 'upstream/master' into rustupPhilipp Krones-462/+3363
2025-06-13[PERF] Optimize 3rd heaviest func, (81b -> 10m) (#15043)Samuel Tardieu-2/+1
So this is funny, the query `tcx.module_children` was top 3 in most time consuming functions in Clippy, it was being called 24384 times in tokio. "Unacceptable!" I thought. Digging a bit around, turns out that `clippy::strlen_on_c_strings` was calling for `get_def_path` via `match_libc_symbol`. This query pretty-prints things and performs some analysis. Yes, we were running early lint checks to see if symbols were from `libc`. I don't really trust callgrind when it says I've turn 81 billion instructions into like 10 million. So I benchmarked this the good ol' "compiling 20 times without incr" method and it went from 0.31s-0.45s to 0.25s constistently. (Profiled, and "benchmarked") on tokio. What I can get behind is via `strlen_on_c_strings` changing from 31 million instructions into 76k. :tada: :partying_face: changelog: [`strlen_on_c_strings`]: Optimize it by 99.75%
2025-06-13Auto merge of #142432 - matthiaskrgr:rollup-ziuls9y, r=matthiaskrgrbors-594/+907
Rollup of 6 pull requests Successful merges: - rust-lang/rust#138016 (Added `Clone` implementation for `ChunkBy`) - rust-lang/rust#141162 (refactor `AttributeGate` and `rustc_attr!` to emit notes during feature checking) - rust-lang/rust#141474 (Add `ParseMode::Diagnostic` and fix multiline spans in diagnostic attribute lints) - rust-lang/rust#141947 (Specify that "option-like" enums must be `#[repr(Rust)]` to be ABI-compatible with their non-1ZST field.) - rust-lang/rust#142252 (Improve clarity of `core::sync::atomic` docs about "Considerations" in regards to CAS operations) - rust-lang/rust#142337 (miri: add flag to suppress float non-determinism) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-13Rollup merge of #142308 - tgross35:upgrade-library-object, r=Mark-SimulacrumMatthias Krüger-15/+12
Upgrade `object`, `addr2line`, and `unwinding` in the standard library Object: 0.37.0 is a semver-breaking release but the only breakage is in `elf::R_RISCV_GNU_*` and `pe::IMAGE_WEAK_EXTERN_*` constants, as well as Mach-O dyld. This API is not used by `std`, so we should be fine to upgrade. This new version also includes functionality for parsing Wasm object files that we may eventually like to make use of. Changelog: https://github.com/gimli-rs/object/blob/master/CHANGELOG.md#0370 Addr2line: 0.25.0 is a breaking change only because it upgrades the `gimli` version. It also includes a change to the `compiler-builtins` dependency that helps with [1]. Changelog: https://github.com/gimli-rs/addr2line/blob/master/CHANGELOG.md#0250-20250611 [1]: https://github.com/rust-lang/rust/issues/142265
2025-06-13Rollup merge of #142276 - tgross35:update-library-lockfile, r=Mark-SimulacrumMatthias Krüger-29/+20
Update dependencies in `library/Cargo.lock` This removes the `compiler_builtins` dependency from a handful of library dependencies, which is progress toward [1]. [1]: https://github.com/rust-lang/rust/issues/142265
2025-06-13Rollup merge of #142274 - tgross35:update-stdarch, r=AmanieuMatthias Krüger-1/+0
Update the stdarch submodule Includes the following changes: * Add s390x z17 target features [1] * Remove `compiler-builtins` from `rustc-dep-of-std` dependencies [2] * Darwin AArch64 detection update [3] * Fixes for the latest nightly [4] * Add a lockfile [5] [1]: https://github.com/rust-lang/stdarch/pull/1826 [2]: https://github.com/rust-lang/stdarch/pull/1825 [3]: https://github.com/rust-lang/stdarch/pull/1827 [4]: https://github.com/rust-lang/stdarch/pull/1830 [5]: https://github.com/rust-lang/stdarch/pull/1829
2025-06-13Rollup merge of #142267 - workingjubilee:debug-assert-less-in-ast-lowering, ↵Matthias Krüger-18/+18
r=oli-obk assert more in release in `rustc_ast_lowering` My understanding of the compiler's architecture is that in the `ast_lowering` crate, we are constructing the HIR as a one-time thing per crate. This is after tokenizing, parsing, resolution, expansion, possible reparsing, reresolution, reexpansion, and so on. In other words, there are many reasons that perf-focused PRs spend a lot of time touching `rustc_parse`, `rustc_expand`, `rustc_ast`, and then `rustc_hir` and "onwards", but `ast_lowering` is a little bit of an odd duck. In this crate, we have a number of debug assertions. Some are clearly expensive checks that seem like they are prohibitive to run in actual optimized compiler builds, but then there are a number that are simple asserts on integer equalities, `is_empty`, or the like. I believe we should do some of them even in release builds, because the correctness gain is worth the performance cost: almost zero.
2025-06-13Rollup merge of #142248 - heiher:loong32-asm-types, r=AmanieuMatthias Krüger-4/+11
Add supported asm types for LoongArch32 r? ``````@Amanieu``````
2025-06-13Rollup merge of #142176 - workingjubilee:dont-shuffle-bswaps-per-arch, r=nikicMatthias Krüger-16/+45
tests: Split dont-shuffle-bswaps along opt-levels and arches This duplicates dont-shuffle-bswaps in order to make each opt level its own test. Then -opt3.rs gets split into a revision per arch we want to test, with certain architectures gaining new target-cpu minimums.
2025-06-13Rollup merge of #140770 - folkertdev:custom-abi, r=tgross35Matthias Krüger-10/+988
add `extern "custom"` functions tracking issue: rust-lang/rust#140829 previous discussion: https://github.com/rust-lang/rust/issues/140566 In short, an `extern "custom"` function is a function with a custom ABI, that rust does not know about. Therefore, such functions can only be defined with `#[unsafe(naked)]` and `naked_asm!`, or via an `extern "C" { /* ... */ }` block. These functions cannot be called using normal rust syntax: calling them can only be done from inline assembly. The motivation is low-level scenarios where a custom calling convention is used. Currently, we often pick `extern "C"`, but that is a lie because the function does not actually respect the C calling convention. At the moment `"custom"` seems to be the name with the most support. That name is not final, but we need to pick something to actually implement this. r? `@traviscross` cc `@tgross35` try-job: x86_64-apple-2
2025-06-13Rollup merge of #135927 - azhogin:azhogin/retpoline, r=davidtwcoMatthias Krüger-93/+244
retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features `-Zretpoline` and `-Zretpoline-external-thunk` flags are target modifiers (tracked to be equal in linked crates). * Enables target features for `-Zretpoline-external-thunk`: `+retpoline-external-thunk`, `+retpoline-indirect-branches`, `+retpoline-indirect-calls`. * Enables target features for `-Zretpoline`: `+retpoline-indirect-branches`, `+retpoline-indirect-calls`. It corresponds to clang -mretpoline & -mretpoline-external-thunk flags. Also this PR forbids to specify those target features manually (warning). Issue: rust-lang/rust#116852
2025-06-13Rollup merge of #128425 - tgross35:missing-fragment-specifier-unconditional, ↵Matthias Krüger-342/+105
r=petrochenkov,traviscross Make `missing_fragment_specifier` an unconditional error This was attempted in [1] then reverted in [2] because of fallout. Recently, this was made an edition-dependent error in [3]. Make missing fragment specifiers an unconditional error again, across all editions. More context: https://github.com/rust-lang/rust/pull/128006 Most recent crater: https://github.com/rust-lang/rust/pull/128425#issuecomment-2686949847 Fixes: https://github.com/rust-lang/rust/issues/40107 [1]: https://github.com/rust-lang/rust/pull/75516 [2]: https://github.com/rust-lang/rust/pull/80210 [3]: https://github.com/rust-lang/rust/pull/128006
2025-06-13Rollup merge of #142413 - tshepang:rdg-push, r=jieyouxuMatthias Krüger-3/+4
rustc-dev-guide subtree update r? `@ghost`
2025-06-13Rollup merge of #142410 - RalfJung:align_of, r=WaffleLapkin,workingjubileeMatthias Krüger-87/+73
intrinsics: rename min_align_of to align_of Now that `pref_align_of` is gone (https://github.com/rust-lang/rust/pull/141803), we can give the intrinsic backing `align_of` its proper name. r? `@workingjubilee` or `@bjorn3`
2025-06-13Rollup merge of #142379 - Stypox:bootstrap-tool-config, r=KobzolMatthias Krüger-2/+45
Add bootstrap option to compile a tool with features Add an option to specify which features to build a tool with, e.g. it will be useful to build Miri with tracing enabled: ```toml tool-config.miri.features = ["tracing"] ``` See [this Zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Passing.20--features.20to.20Miri.20build.20using.20.2E.2Fx.2Epy/with/523564773) for the options considered. If the final decision will be different than what I wrote now, I will update the code as needed. The reason why the option is `tool-config.miri.features` instead of something like `tool-features.miri` is to possibly allow adding more tool-specific configurations in the future. I didn't do any validation of the keys of the `tool-config` hashmap, since I saw that no validation is done on the `tools` hashset either. I don't like much the fact that features can be chosen by various places of the codebase: `Step`s can have some fixed `extra_features`, `prepare_tool_cargo` will add features depending on some bootstrapping options, and the newly added option can also contribute features to tools. However I think it is out of scope of this PR to try to refactor all of that (if it even is refactorable), so I left a comment in the codebase explaining all of the sources of features I could find.
2025-06-13Rollup merge of #142340 - RalfJung:miri-apfloat-mul-add, r=oli-obkMatthias Krüger-12/+8
miri: we can use apfloat's mul_add now With https://github.com/rust-lang/rustc_apfloat/issues/11 fixed, there is no reason to still use host floats here. Fixes https://github.com/rust-lang/miri/issues/2995 We already have a test for this: https://github.com/rust-lang/rust/blob/a7153db254acc387e271e75153bdbd3caa2bed89/src/tools/miri/tests/pass/float.rs#L998-L1003 r? ``@oli-obk``
2025-06-13Rollup merge of #142221 - mustartt:aix-fix-strip-order, r=davidtwcoMatthias Krüger-2/+2
[AIX] strip underlying xcoff object When stripping, we need to strip the archive member first before archiving. Otherwise, the shared library remain untouched, only the archive symbol table will be modified.
2025-06-13Rollup merge of #142158 - xizheyin:141617, r=jdonszelmannMatthias Krüger-31/+68
Tracking the old name of renamed unstable library features This PR resolves the first problem of rust-lang/rust#141617 : tracking renamed unstable features. The first commit is to add a ui test, and the second one tracks the changes. I will comment on the code for clarification. r? `@jdonszelmann` There have been a lot of PR's reviewed by you lately, thanks for your time! cc `@jyn514`
2025-06-13Rollup merge of #142069 - nnethercote:Zmacro-stats, r=petrochenkovMatthias Krüger-81/+715
Introduce `-Zmacro-stats` Introduce `-Zmacro-stats`. It collects data about macro expansions and prints them in a table after expansion finishes. It's very useful for detecting macro bloat, especially for proc macros. r? `@petrochenkov`
2025-06-13Rollup merge of #141770 - GuillaumeGomez:cfg-false-mod-rendering, r=camelidMatthias Krüger-16/+23
Merge `Cfg::render_long_html` and `Cfg::render_long_plain` methods common code Follow-up of https://github.com/rust-lang/rust/pull/141747. Thanks `@camelid` for spotting it! r? `@camelid`
2025-06-13Rollup merge of #141491 - tamird:cstr-debug-bstr, r=joshtriplettMatthias Krüger-2/+6
Delegate `<CStr as Debug>` to `ByteStr` This allows UTF-8 characters to be printed without escapes, rather than just ASCII. r? `@joshtriplett`
2025-06-13Rollup merge of #134847 - dtolnay:asymmetrical, r=fmeaseMatthias Krüger-75/+150
Implement asymmetrical precedence for closures and jumps I have been through a series of asymmetrical precedence designs in Syn, and finally have one that I like and is worth backporting into rustc. It is based on just 2 bits of state: `next_operator_can_begin_expr` and `next_operator_can_continue_expr`. Asymmetrical precedence is the thing that enables `(return 1) + 1` to require parentheses while `1 + return 1` does not, despite `+` always having stronger precedence than `return` [according to the Rust Reference](https://doc.rust-lang.org/1.83.0/reference/expressions.html#expression-precedence). This is facilitated by `next_operator_can_continue_expr`. Relatedly, it is the thing that enables `(return) - 1` to require parentheses while `return + 1` does not, despite `+` and `-` having exactly the same precedence. This is facilitated by `next_operator_can_begin_expr`. **Example:** ```rust macro_rules! repro { ($e:expr) => { $e - $e; $e + $e; }; } fn main() { repro!{return} repro!{return 1} } ``` `-Zunpretty=expanded` **Before:** ```console fn main() { (return) - (return); (return) + (return); (return 1) - (return 1); (return 1) + (return 1); } ``` **After:** ```console fn main() { (return) - return; return + return; (return 1) - return 1; (return 1) + return 1; } ```
2025-06-13Auto merge of #142353 - workingjubilee:warn-less-about-cdecl-and-other-abis, ↵bors-370/+13
r=ChrisDenton,RalfJung compiler: Ease off the accelerator on `unsupported_calling_conventions` This is to give us more time to discuss rust-lang/rust#142330 without the ecosystem having an anxiety attack. I have withdrawn `unsupported_calling_conventions` from report-in-deps I believe we should consider this a simple suspension of the decision in rust-lang/rust#141435 to start this process, rather than a reversal. That is, we may continue with linting again. But I believe we are about to get a... reasonable amount of feedback just from currently available information and should allow ourselves time to process it.
2025-06-13Optimize by 99.75% strlen_on_c_strings, 8.5% globallyblyxyas-2/+1
So this is funny, the query `tcx.module_children` was top 3 in most time consuming functions in Clippy, it was being called 24384 times in tokio. "Unacceptable!" I thought. Digging a bit around, turns out that `clippy::strlen_on_c_strings` was calling for `get_def_path` via `match_libc_symbol`. This query pretty-prints things and performs some analysis. Yes, we were running early lint checks to see if symbols were from `libc`. I don't really trust callgrind when it says I've turn 81 billion instructions into like 10 million. So I benchmarked this the good ol' "compiling 20 times without incr" method and it went from 0.31s-0.45s to 0.25s constistently. (Profiled, and "benchmarked") on tokio.
2025-06-12tests: Convert linkage-attr test to cross-compiling and blessJubilee Young-21/+12
2025-06-12Fix suggestion-causes-error of `manual_swap` (#14978)Samuel Tardieu-5/+48
Fixes: rust-lang/rust-clippy#14931 changelog: Fix [`manual_swap`]'s suggestion-causes-error when the variable is mutable or as loop variable.
2025-06-12Fix `unit_arg` suggests wrongly for `Default::default` (#14881)Samuel Tardieu-161/+410
Closes rust-lang/rust-clippy#14857 changelog: [`unit_arg`] fix wrong suggestion for `Default::default`
2025-06-12Fixes `manual_flatten` removes the useless if let (#14861)Samuel Tardieu-57/+307
Closes rust-lang/rust-clippy#14692 The suggestion of `manual_flatten` does not includes the replacement of `if let` so far despite of `.flatten()` suggestion. This PR eliminates a redundant `if let`. changelog: [`manual_flatten`] the suggestion removes `if let`
2025-06-12Auto merge of #142438 - matthiaskrgr:rollup-u1jdnhz, r=matthiaskrgrbors-75/+544
Rollup of 9 pull requests Successful merges: - rust-lang/rust#134536 (Lint on fn pointers comparisons in external macros) - rust-lang/rust#141069 (Suggest mut when possbile for temporary value dropped while borrowed) - rust-lang/rust#141934 (resolve: Tweak `private_macro_use` lint to be compatible with upcoming macro prelude changes) - rust-lang/rust#142034 (Detect method not being present that is present in other tuple types) - rust-lang/rust#142402 (chore(doctest): Remove redundant blank lines) - rust-lang/rust#142406 (Note when enum variants shadow an associated function) - rust-lang/rust#142407 (Remove bootstrap adhoc group) - rust-lang/rust#142408 (Add myself (WaffleLapkin) to review rotation) - rust-lang/rust#142418 (Remove lower_arg_ty as all callers were passing `None`) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-12Rollup merge of #142418 - oli-obk:lower_arg_ty, r=BoxyUwU,fmeaseMatthias Krüger-12/+2
Remove lower_arg_ty as all callers were passing `None` r? ``@fmease`` or ``@BoxyUwU`` I think this is just leftover from other refactorings
2025-06-12Rollup merge of #142408 - WaffleLapkin:rotates-itself, r=WaffleLapkinMatthias Krüger-0/+2
Add myself (WaffleLapkin) to review rotation `@bors` r+
2025-06-12Rollup merge of #142407 - Kobzol:remove-bootstrap-adhoc-group, r=davidtwcoMatthias Krüger-7/+0
Remove bootstrap adhoc group It corresponds 1:1 to the current bootstrap team, and with the new review preferences we shouldn't need it. Discussed on Zulip. r? ``@davidtwco``
2025-06-12Rollup merge of #142406 - jdonszelmann:dead-code-enum-variant, r=WaffleLapkinMatthias Krüger-1/+94
Note when enum variants shadow an associated function r? ``@WaffleLapkin`` Closes rust-lang/rust#142263
2025-06-12Rollup merge of #142402 - sorairolake:remove-blank-line, r=workingjubileeMatthias Krüger-3/+0
chore(doctest): Remove redundant blank lines Remove redundant leading blank lines from doctests of [`iN::cast_unsigned`](https://doc.rust-lang.org/std/primitive.i32.html#method.cast_unsigned), [`slice::escape_ascii`](https://doc.rust-lang.org/std/primitive.slice.html#method.escape_ascii) and [`u8::escape_ascii`](https://doc.rust-lang.org/std/primitive.u8.html#method.escape_ascii).
2025-06-12Rollup merge of #142034 - estebank:issue-141258, r=davidtwcoMatthias Krüger-2/+218
Detect method not being present that is present in other tuple types When a method is not present because of a trait bound not being met, and that trait bound is on a tuple, we check if making the tuple have no borrowed types makes the method to be found and highlight it if it does. This is a common problem for Bevy in particular and ORMs in general. <img width="1166" alt="Screenshot 2025-06-04 at 10 38 24 AM" src="https://github.com/user-attachments/assets/d257c9ea-c2d7-42e7-8473-8b93aa54b8e0" /> Address rust-lang/rust#141258. I believe that more combination of cases in the tuple types should be handled (like adding borrows and checking when a specific type needs to not be a borrow while the rest stay the same), but for now this handles the most common case.
2025-06-12Rollup merge of #141934 - petrochenkov:privmacuse, r=compiler-errorsMatthias Krüger-22/+36
resolve: Tweak `private_macro_use` lint to be compatible with upcoming macro prelude changes Unblocks https://github.com/rust-lang/rust/pull/139493. Zulip thread requesting help - [#t-compiler/help > Help requested for effects of #139493](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Help.20requested.20for.20effects.20of.20.23139493/with/514653911). This PR by itself shouldn't cause any observable changes, its only observable effect is that the prelude changes from https://github.com/rust-lang/rust/pull/139493 will no longer cause regressions in tests like `tests/ui/imports/issue-119369.rs` or `tests/ui/extern/issue-80074.rs`. This is achieved by moving the "is this thing in stdlib prelude" check from an early point (`fn process_macro_use_imports`) to a later point (`fn record_use_inner`), at which the stdlib prelude is already populated and can be inspected. (The `is_builtin_macro` check is subsumed by the stdlib prelude check, all built-in macros go through the stdlib prelude anyway.)
2025-06-12Rollup merge of #141069 - chenyukang:yukang-fix-137486-suggest-mut, r=davidtwcoMatthias Krüger-3/+96
Suggest mut when possbile for temporary value dropped while borrowed Fixes #137486
2025-06-12Rollup merge of #134536 - Urgau:fn-ptr-option, r=compiler-errors,traviscrossMatthias Krüger-25/+96
Lint on fn pointers comparisons in external macros This PR extends the recently stabilized `unpredictable_function_pointer_comparisons` lint ~~to also lint on `Option<{function pointer}>` and~~ as well as linting in external macros (as to catch `assert_eq!` and others). ```rust assert_eq!(Some::<FnPtr>(func), Some(func as unsafe extern "C" fn())); //~^ WARN function pointer comparisons #[derive(PartialEq, Eq)] struct A { f: fn(), //~^ WARN function pointer comparisons } ``` Fixes https://github.com/rust-lang/rust/issues/134527
2025-06-12Auto merge of #138164 - jdonszelmann:attr-parsing-lint-infra, r=oli-obkbors-226/+726
Infrastructure for lints during attribute parsing, specifically duplicate usages of attributes r? `@oli-obk` This PR adds a new field to OwnerInfo to buffer lints which are generated during attribute parsing and ast lowering in general. They can't be emitted at this stage because at that point there's no HIR yet, and early lints are already emitted. This also adds the generic `S: Stage` to attribute parsers. Currently we don't emit any lints during early attribute parsing, but if we ever want to that logic will be different. That's because there we don't have hir ids yet, while at the same time still having access to node ids and early lints. Even though that logic isn't completely there in this PR (no worries, we don't use it), that's why the parameter is there. With this PR, we also add 2 associated consts to `SingleAttributeParser`. Those determine what logic should be applied when finding a duplicate attribute. This PR was getting pretty large, so the first code using this logic is in rust-lang/rust#138165. This code is all new things that weren't possible before so it also doesn't break any behaviour. However, some of it will be dead code right now. I recommend reviewing both before merging, though in some sense that doubles the size of the review again, and the other PR might be more controversial. Let me know how you want to do this `@oli-obk`
2025-06-12add `extern "custom"` functionsFolkert de Vries-10/+988
2025-06-12Rollup merge of #142337 - RalfJung:miri-float-nondet, r=oli-obkMatthias Krüger-4/+31
miri: add flag to suppress float non-determinism We have flags controlling most non-determinism, so this seems generally useful for debugging. It is also needed to work around https://github.com/rust-lang/portable-simd/issues/463 in miri-test-libstd. I made this a rustc PR so that it propagates faster to unbreak miri-test-libstd. r? `@oli-obk`
2025-06-12Rollup merge of #142252 - fu5ha:doc-cas-ops, r=ibraheemdevMatthias Krüger-33/+146
Improve clarity of `core::sync::atomic` docs about "Considerations" in regards to CAS operations ## Motivation The existing documentation for atomic `fetch_update` (and other similar methods) has a section that reads like so: > ### Considerations > This method is not magic; it is not provided by the hardware. It is implemented in > terms of `AtomicBlah::compare_exchange_weak`, and suffers from the same drawbacks. > In particular, this method will not circumvent the [ABA Problem]. > > [ABA Problem]: https://en.wikipedia.org/wiki/ABA_problem The wording here seems to imply that the drawbacks being discusses are caused by the *`weak` version* of `compare_exchange`, and that one may avoid those drawbacks by using `compare_exchange` instead. Indeed, a conversation in the `#dark-arts` channel on the Rust community discord based on this interpretation led to this PR. In reality, the drawbacks are inherent to implementing such an operation based on *any* compare-and-swap style operation, as opposed to an [LL,SC](https://en.wikipedia.org/wiki/Load-link/store-conditional) operation, and they apply equally to `compare_exchange` and `compare_exchange_weak` as well. ## Changes - Rewords existing Considerations section on `fetch_update` and friends to make clear that the limitations are inherent to an implementation based on any CAS operation, rather than the weak version of `compare_exchange` in particular. New version: > ### Considerations > > This method is not magic; it is not provided by the hardware, and does not act like a > critical section or mutex. > > It is implemented on top of an atomic [compare-and-swap operation], and thus is subject to > the usual drawbacks of CAS operations. In particular, be careful of the [ABA problem] > if this atomic integer is an index or more generally if knowledge of only the *bitwise value* > of the atomic is not in and of itself sufficient to ensure any required preconditions. > > [ABA Problem]: https://en.wikipedia.org/wiki/ABA_problem > [compare-and-swap operation]: https://en.wikipedia.org/wiki/Compare-and-swap - Add Considerations to `compare_exchange` and `compare_exchange_weak` which details similar considerations and when they may be relevant. New version: > ### Considerations > > `compare_exchange` is a [compare-and-swap operation] and thus exhibits the usual downsides > of CAS operations. In particular, a load of the value followed by a successful > `compare_exchange` with the previous load *does not ensure* that other threads have not > changed the value in the interim. This is usually important when the *equality* check in > the `compare_exchange` is being used to check the *identity* of a value, but equality > does not necessarily imply identity. In this case, `compare_exchange` can lead to the > [ABA problem]. > > [ABA Problem]: https://en.wikipedia.org/wiki/ABA_problem > [compare-and-swap operation]: https://en.wikipedia.org/wiki/Compare-and-swap