about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-03-24Remove `QueryWaiter::notify`John Kåre Alsaker-8/+2
2025-03-24Batch mark waiters as unblocked when resuming in the deadlock handlerJohn Kåre Alsaker-2/+8
2025-03-24Revert "resume one waiter at a call"John Kåre Alsaker-15/+2
This reverts commit cc1e4ede9388d87750c3751f41e8c6c4f6cae995.
2025-03-23Rollup merge of #138846 - compiler-errors:stall-prereqs, r=lcnrJacob Pratt-36/+49
Tweaks to writeback and `Obligation -> Goal` conversion Each of these commits are self-contained, but are prerequisites that I'd like to land before #138845, which still needs some cleaning. The ""most controversial"" one is probably [Explicitly don't fold coroutine obligations in writeback](https://github.com/rust-lang/rust/commit/e7d27bae27b3b213a44e12b780e5df74a9929e58), which I prefer because I think using `fold_predicate` to control against not normalizing predicates seems... easy to mess up 🤔, and we could have *other things* that we don't want to normalize. Explicitly noting whether we want `resolve` to normalize is a lot clearer (and currently in writeback is limited to resolving stalled coroutine obligations), since we can attach it to a comment that explains *why*.
2025-03-23Rollup merge of #138783 - bjorn3:cache_current_dll_path, r=lqdJacob Pratt-56/+66
Cache current_dll_path output Computing the current dll path is somewhat expensive relative to other work when compiling `fn main() {}` as `dladdr` needs to iterate over the symbol table of librustc_driver.so until it finds a match.
2025-03-23Rollup merge of #138728 - tgross35:update-builtins, r=tgross35Jacob Pratt-2/+2
Update `compiler-builtins` to 0.1.152 Includes the following changes related to unordered atomics: * Remove element_unordered_atomic intrinsics [1] * Remove use of `atomic_load_unordered` and undefined behaviour [2] There are a handful of other small changes, but nothing else user-visible. [1]: https://github.com/rust-lang/compiler-builtins/pull/789 [2]: https://github.com/rust-lang/compiler-builtins/pull/790
2025-03-23Rollup merge of #137736 - bjorn3:compiler_builtins_export_fix, r=petrochenkovJacob Pratt-2/+7
Don't attempt to export compiler-builtins symbols from rust dylibs They are marked with hidden visibility to prevent them from getting exported, so we shouldn't ask the linker to export them anyway. The only thing that does it cause a warning on macOS. Part of https://github.com/rust-lang/rust/issues/136096 cc `@jyn514`
2025-03-24Update `compiler-builtins` to 0.1.152Trevor Gross-2/+2
Includes the following changes related to unordered atomics: * Remove element_unordered_atomic intrinsics [1] * Remove use of `atomic_load_unordered` and undefined behaviour [2] There are a handful of other small changes, but nothing else user-visible. [1]: https://github.com/rust-lang/compiler-builtins/pull/789 [2]: https://github.com/rust-lang/compiler-builtins/pull/790
2025-03-24Add do_not_recommend typo helpmejrs-7/+7
2025-03-23Rollup merge of #138861 - compiler-errors:flags-tweaks, r=lcnrMichael Goulet-85/+24
Tweak type flags, fix missing flags from coroutine kind ty Firstly, make sure we visit the coroutine kind ty. Since this kind ty is either infer (before upvar computation), or `()` or `i8`/`i16`/`i32`, this isn't really that big of a deal, since other types in the coroutine will also be infer, so we're not misreporting `ty.has_infer()` or anything, but it's still wrong not to do this. Furthermore, remove `HAS_TY_COROUTINE`, since nobody used it, and also remove special casing for `STILL_FURTHER_SPECIALIZABLE` since it's likely not important anymore? I have a vague recollection that it was important for polymorphization(?), but no tests seem to rely on this behavior. r? lcnr or reassign
2025-03-23Rollup merge of #138854 - TaKO8Ki:invalid-extern-fn-body, r=compiler-errorsMichael Goulet-2/+2
Fix ICE #138415 for invalid extern function body Fixes #138415
2025-03-23Rollup merge of #138641 - jieyouxu:print-supported-crate-types, r=UrgauMichael Goulet-3/+18
Add unstable `--print=supported-crate-types` option MCP: https://github.com/rust-lang/compiler-team/issues/836 Tracking issue: https://github.com/rust-lang/rust/issues/138640 ### Test coverage Two tests: 1. `tests/ui/print-request/stability.rs` to check that `--print=supported-crate-types` is `-Zunstable-options`-gated 2. `tests/ui/print-request/supported-crate-types.rs` is added as a basic smoke test. Observe that the compiler stdout corresponds to the below *Example output* section (e.g. `proc-macro` is unsupported on `wasm32-unknown-unknown` currently). ### Example output <details> <summary>For `x86_64-unknown-linux-gnu`</summary> Notice the presence of `{c,}dylib` and `proc-macro`: ``` bin cdylib dylib lib proc-macro rlib staticlib ``` </details> <details> <summary>For `wasm32-unknown-unknown`</summary> Notice the absence of `dylib` and `proc-macro`: ``` bin cdylib lib rlib staticlib ``` </details> <details> <summary>For `x86_64-unknown-linux-musl`</summary> Notice the absence of `{c,}dylib` but presence of `proc-macro`: ``` bin lib proc-macro rlib staticlib ``` </details> ### Documentation I added an entry in the unstable book's print request section to document this `supported-crate-types` print request. ### Unresolved questions - [ ] (Name bikeshedding) is `supported-crate-types` a good name for the print request? I'm inclined to say it's good enough for an unstable print request, but may be worth revisiting at stabilization time. ### Stability This print request being added is *unstable* in this PR. A separate stabilization PR following the usual compiler flag stabilization procedure should be filed for stabilization after some baking time. ### Review remarks Best reviewed commit-by-commit. r? compiler
2025-03-23fix: Check empty SIMD vector in inline asmHadrien Eyraud-0/+8
2025-03-23Explicitly don't fold coroutine obligations in writebackMichael Goulet-14/+31
2025-03-23Don't super fold const in ResolverMichael Goulet-4/+1
2025-03-23Obligation::as_goalMichael Goulet-18/+17
2025-03-23Remove STILL_FURTHER_SPECIALIZABLE special casingMichael Goulet-78/+24
2025-03-23Remove HAS_TY_COROUTINEMichael Goulet-9/+1
2025-03-23Visit coroutine kind ty in FlagComputationMichael Goulet-0/+1
2025-03-23Stabilize precise_capturing_in_traitsMichael Goulet-35/+2
2025-03-23Implement `supported-crate-types` print requestJieyou Xu-3/+18
As an unstable print request.
2025-03-23fix ICE #138415Takayuki Maeda-2/+2
2025-03-23Slim `rustc_parse_format` dependencies downLukas Wirth-2/+4
`rustc_index` is only used for its size assertion macro, so demote it to a dev-dependency gated under testing instead
2025-03-22Auto merge of #138841 - matthiaskrgr:rollup-bfkls57, r=matthiaskrgrbors-43/+40
Rollup of 8 pull requests Successful merges: - #138018 (rustdoc: Use own logic to print `#[repr(..)]` attributes in JSON output.) - #138294 (Mark some std tests as requiring `panic = "unwind"`) - #138468 (rustdoc js: add nonnull helper and typecheck src-script.js) - #138675 (Add release notes for 1.85.1) - #138765 (Fix Thread::set_name on cygwin) - #138786 (Move some driver code around) - #138793 (target spec check: better error when llvm-floatabi is missing) - #138822 (De-Stabilize `file_lock`) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-22Auto merge of #138831 - matthiaskrgr:rollup-3t0dqiz, r=matthiaskrgrbors-1/+1
Rollup of 7 pull requests Successful merges: - #138609 (Add stack overflow handler for cygwin) - #138639 (Clean UI tests 2 of n) - #138773 (catch_unwind intrinsic: document return value) - #138782 (test(ui): add tuple-struct-where-clause-suggestion ui test for #91520) - #138794 (expand: Do not report `cfg_attr` traces on macros as unused attributes) - #138801 (triagebot: add autolabel rules for D-* and L-*) - #138804 (Allow inlining for `Atomic*::from_ptr`) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-22Rollup merge of #138793 - RalfJung:arm-floatabi, r=NoratriebMatthias Krüger-1/+4
target spec check: better error when llvm-floatabi is missing
2025-03-22Rollup merge of #138786 - bjorn3:driver_code_move, r=compiler-errorsMatthias Krüger-42/+36
Move some driver code around `--emit mir`, `#[rustc_symbol_name]` and `#[rustc_def_path]` now run before codegen and thus work even if codegen fails. This can help with debugging.
2025-03-22resolve: Avoid some unstable iteration 3Vadim Petrochenkov-12/+6
2025-03-22Auto merge of #138830 - matthiaskrgr:rollup-gaxgfwl, r=matthiaskrgrbors-374/+461
Rollup of 7 pull requests Successful merges: - #138410 (Couple mir building cleanups) - #138490 (Forward `stream_position` in `Arc<File>` as well) - #138535 (Cleanup `LangString::parse`) - #138536 (stable_mir: Add `MutMirVisitor`) - #138673 (Fix build failure on Trusty) - #138750 (Make `crate_hash` not iterate over `hir_crate` owners anymore) - #138763 (jsondocck: Replace `jsonpath_lib` with `jsonpath-rust`) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-22Rollup merge of #138794 - petrochenkov:cfgtracefix, r=jieyouxuMatthias Krüger-1/+1
expand: Do not report `cfg_attr` traces on macros as unused attributes Fixes https://github.com/rust-lang/rust/issues/138779
2025-03-22Rollup merge of #138750 - oli-obk:decouple-hir-queries, r=fee1-deadMatthias Krüger-6/+5
Make `crate_hash` not iterate over `hir_crate` owners anymore cc https://github.com/rust-lang/rust/issues/95004 One more direct usage of hir::Crate removed
2025-03-22Rollup merge of #138536 - makai410:mut-mir-visitor, r=celinvalMatthias Krüger-332/+428
stable_mir: Add `MutMirVisitor` Resolves: [rust-lang/project-stable-mir#81](https://github.com/rust-lang/project-stable-mir/issues/81). I am unsure if we should add a `MutableBody` like Kani did. Currently, I use `&mut Body` in `MutMirVisitor::visit_body()`. r? ``````@celinval``````
2025-03-22Rollup merge of #138410 - bjorn3:misc_cleanups, r=compiler-errorsMatthias Krüger-36/+28
Couple mir building cleanups
2025-03-22Auto merge of #136974 - m-ou-se:fmt-options-64-bit, r=scottmcmbors-26/+21
Reduce FormattingOptions to 64 bits This is part of https://github.com/rust-lang/rust/issues/99012 This reduces FormattingOptions from 6-7 machine words (384 bits on 64-bit platforms, 224 bits on 32-bit platforms) to just 64 bits (a single register on 64-bit platforms). Before: ```rust pub struct FormattingOptions { flags: u32, // only 6 bits used fill: char, align: Option<Alignment>, width: Option<usize>, precision: Option<usize>, } ``` After: ```rust pub struct FormattingOptions { /// Bits: /// - 0-20: fill character (21 bits, a full `char`) /// - 21: `+` flag /// - 22: `-` flag /// - 23: `#` flag /// - 24: `0` flag /// - 25: `x?` flag /// - 26: `X?` flag /// - 27: Width flag (if set, the width field below is used) /// - 28: Precision flag (if set, the precision field below is used) /// - 29-30: Alignment (0: Left, 1: Right, 2: Center, 3: Unknown) /// - 31: Always set to 1 flags: u32, /// Width if width flag above is set. Otherwise, always 0. width: u16, /// Precision if precision flag above is set. Otherwise, always 0. precision: u16, } ```
2025-03-22Auto merge of #138719 - lcnr:concrete_opaque_types-closures, r=oli-obkbors-55/+88
merge opaque types defined in nested bodies A small step towards https://github.com/rust-lang/types-team/issues/129 r? `@oli-obk`
2025-03-22Note potential but private items in show_candidatesxizheyin-12/+12
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-03-21match lowering cleanup: `non_scalar_compare` is only for `&str`dianne-94/+24
Since array and slice constants are now lowered to array and slice patterns, `non_scalar_compare` was only called for string comparisons. This specializes it to strings, renames it, and removes the unused array-unsizing logic. This also updates some outdated doc comments.
2025-03-21Don't produce debug information for compiler-introduced-vars when desugaring ↵Kyle Huey-16/+42
assignments. An assignment such as (a, b) = (b, c); desugars to the HIR { let (lhs, lhs) = (b, c); a = lhs; b = lhs; }; The repeated `lhs` leads to multiple Locals assigned to the same DILocalVariable. Rather than attempting to fix that, get rid of the debug info for these bindings that don't even exist in the program to begin with. Fixes #138198
2025-03-21Auto merge of #128320 - saethlin:link-me-maybe, r=compiler-errorsbors-26/+57
Avoid no-op unlink+link dances in incr comp Incremental compilation scales quite poorly with the number of CGUs. This PR improves one reason for that. The incr comp process hard-links all the files from an old session into a new one, then it runs the backend, which may just hard-link the new session files into the output directory. Then codegen hard-links all the output files back to the new session directory. This PR (perhaps unimaginatively) fixes the silliness that ensues in the last step. The old `link_or_copy` implementation would be passed pairs of paths which are already the same inode, then it would blindly delete the destination and re-create the hard-link that it just deleted. This PR lets us skip both those operations. We don't skip the other two hard-links. `cargo +stage1 b && touch crates/core/main.rs && strace -cfw -elink,linkat,unlink,unlinkat cargo +stage1 b` before and then after on `ripgrep-13.0.0`: ``` % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 52.56 0.024950 25 978 485 unlink 34.38 0.016318 22 727 linkat 13.06 0.006200 24 249 unlinkat ------ ----------- ----------- --------- --------- ---------------- 100.00 0.047467 24 1954 485 total ``` ``` % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 42.83 0.014521 57 252 unlink 38.41 0.013021 26 486 linkat 18.77 0.006362 25 249 unlinkat ------ ----------- ----------- --------- --------- ---------------- 100.00 0.033904 34 987 total ``` This reduces the number of hard-links that are causing perf troubles, noted in https://github.com/rust-lang/rust/issues/64291 and https://github.com/rust-lang/rust/issues/137560
2025-03-21expand: Do not report `cfg_attr` traces on macros as unused attributesVadim Petrochenkov-1/+1
2025-03-21target spec check: better error when llvm-floatabi is missingRalf Jung-1/+4
2025-03-21Rollup merge of #138717 - jdonszelmann:pin-macro, r=WaffleLapkinMatthias Krüger-8/+44
Add an attribute that makes the spans from a macro edition 2021, and fix pin on edition 2024 with it Fixes a regression, see issue below. This is a temporary fix, super let is the real solution. Closes #138596
2025-03-21Rollup merge of #138627 - EnzymeAD:autodiff-cleanups, r=oli-obkMatthias Krüger-168/+205
Autodiff cleanups Splitting out some cleanups to reduce the size of my batching PR and simplify ``@haenoe`` 's [PR](https://github.com/rust-lang/rust/pull/138314). r? ``@oli-obk`` Tracking: - https://github.com/rust-lang/rust/issues/124509
2025-03-21Rollup merge of #138570 - folkertdev:naked-function-target-feature-gate, ↵Matthias Krüger-1/+18
r=Amanieu add `naked_functions_target_feature` unstable feature tracking issue: https://github.com/rust-lang/rust/issues/138568 tagging https://github.com/rust-lang/rust/pull/134213 https://github.com/rust-lang/rust/issues/90957 This PR puts `#[target_feature(/* ... */)]` on `#[naked]` functions behind its own feature gate, so that naked functions can be stabilized. It turns out that supporting `target_feature` on naked functions is tricky on some targets, so we're splitting it out to not block stabilization of naked functions themselves. See the tracking issue for more information and workarounds. Note that at the time of writing, the `target_features` attribute is ignored when generating code for naked functions. r? ``@Amanieu``
2025-03-21Rollup merge of #138364 - BLANKatGITHUB:compiler, r=RalfJungMatthias Krüger-25/+17
ports the compiler test cases to new rust_intrinsic format pr is part of #132735
2025-03-21Also check for compiler-builtins in linked_symbolsbjorn3-1/+3
Otherwise the linker complains about EC symbols missing when compiling for arm64ec.
2025-03-21Don't attempt to export compiler-builtins symbols from rust dylibsbjorn3-1/+4
They are marked with hidden visibility to prevent them from getting exported, so we shouldn't ask the linker to export them anyway. The only thing that does it cause a warning on macOS.
2025-03-21Fix lint name in unused linker_messages warningbjorn3-5/+5
2025-03-21Move some calls to before calling codegen_cratebjorn3-25/+24
`--emit mir`, `#[rustc_symbol_name]` and `#[rustc_def_path]` now run before codegen and thus work even if codegen fails. This can help with debugging.
2025-03-21Move make_input callbjorn3-12/+7