about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-08-26Make `lto` and `linker-plugin-lto` work the same for `compiler_builtins`Matthew Maurer-12/+1
Fix #142284 by ensuring that `#![no_builtins]` crates can still emit bitcode when proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto) is used.
2025-08-26Auto merge of #145906 - samueltardieu:rollup-p8ibzhz, r=samueltardieubors-55/+178
Rollup of 9 pull requests Successful merges: - rust-lang/rust#144499 (ci: Begin running ui tests with `rust.debuginfo-level-tests=1`) - rust-lang/rust#145790 (Improve dist for gnullvm hosts) - rust-lang/rust#145792 (Use attribute name in message for "outer attr used as inner attr" errors) - rust-lang/rust#145840 (rustc_codegen_ssa: More comprehensive RISC-V ELF flags) - rust-lang/rust#145876 (Enable building/disting standard library in stage 0) - rust-lang/rust#145887 (bootstrap: Don't panic if codegen-backends is set to empty) - rust-lang/rust#145888 (platform-support: Fix LoongArch32 host column) - rust-lang/rust#145892 (add a flag to codegen fn attrs for foreign items) - rust-lang/rust#145901 (Fix typo in comment of library/alloc/src/raw_vec/mod.rs) r? `@ghost` `@rustbot` modify labels: rollup
2025-08-26Rollup merge of #145892 - jdonszelmann:codegen-fn-attrs-foreign-item, r=bjorn3Samuel Tardieu-10/+13
add a flag to codegen fn attrs for foreign items r? `@ghost` refiled to rerun CI
2025-08-26Rollup merge of #145840 - a4lg:riscv-elf-flags-for-internal-objs, r=WaffleLapkinSamuel Tardieu-3/+11
rustc_codegen_ssa: More comprehensive RISC-V ELF flags This change implements more conformant, more comprehensive RISC-V ELF flags handling when generating certain object files directly from rustc. * Use `"zca"` instead of `"c"` The "Zca" extension (a subset of "C") is the minimal configuration for compressed instructions to set `EF_RISCV_RVC` flag. * Set TSO flag from `"ztso"` The "Ztso" extension denotes that the program depends on the RVTSO (Total Store Ordering) memory consistency model, which is stronger than the standard RVWMO (Weak Memory Ordering) consistency model and on ELF targets, we need to set `EF_RISCV_TSO` flag.
2025-08-26Rollup merge of #145792 - scrabsha:push-umpytyxunpxq, r=jdonszelmannSamuel Tardieu-42/+154
Use attribute name in message for "outer attr used as inner attr" errors
2025-08-26fix: Render continuation between no source labelsScott Schafer-19/+20
2025-08-26fix: Add col separator before secondary messages with no sourceScott Schafer-0/+25
2025-08-26fix: Don't add an end column separator after a file with no sourceScott Schafer-5/+20
2025-08-27stop returning errors when format foreign has trailing dollarTakayuki Maeda-1/+1
2025-08-26Auto merge of #145890 - GuillaumeGomez:subtree-update_cg_gcc_2025-08-26, ↵bors-60/+76
r=GuillaumeGomez GCC backend subtree update cc `@antoyo` r? ghost
2025-08-26Comment on intentional field orderDaria Sukhonina-0/+3
2025-08-26Ensure the coordinator thread terminates firstDaria Sukhonina-2/+2
2025-08-26Fix sync conflictGuillaume Gomez-1/+1
2025-08-26Merge commit 'feb42827f11a7ae241ceecc81e9ae556fb6ba214' into ↵Guillaume Gomez-61/+77
subtree-update_cg_gcc_2025-08-26
2025-08-26Rollup merge of #145867 - Zalathar:range-attr, r=nikicGuillaume Gomez-11/+30
cg_llvm: Assert that LLVM range-attribute values don't exceed 128 bits The underlying implementation of `LLVMCreateConstantRangeAttribute` assumes that each of `LowerWords` and `UpperWords` points to enough u64 values to define an integer of the specified bit-length, and will encounter UB if that is not the case. Our safe wrapper function always passes pointers to `[u64; 2]` arrays, regardless of the bit-length specified. That's fine in practice, because scalar primitives never exceed 128 bits, but it is technically a soundness hole in a safe function. We can close the soundness hole by explicitly asserting `size_bits <= 128`. This is effectively just a stricter version of the existing check that the value must be small enough to fit in `c_uint`. --- This is a narrower version of the fix in rust-lang/rust#145846.
2025-08-26Rollup merge of #145481 - mu001999-contrib:fix/closure-sugg, r=SparrowLiiGuillaume Gomez-6/+10
Add parentheses for closure when suggesting calling closure Fixes rust-lang/rust#145404
2025-08-26Rollup merge of #145076 - ZhongyaoChen:feature/add-tier3-riscv64a23-target, ↵Guillaume Gomez-1/+72
r=davidtwco Add new Tier-3 target: riscv64a23-unknown-linux-gnu MCP: [Tier 3 target proposal: riscv64a23-unknown-linux-gnu](https://github.com/rust-lang/compiler-team/issues/894) Changes: - add new target: riscv64a23-unknown-linux-gnu - add target page
2025-08-26Rollup merge of #144551 - neuschaefer:a64be-musl, r=davidtwcoGuillaume Gomez-0/+41
Add aarch64_be-unknown-linux-musl target This PR adds a target definition for big-endian Aarch64 with musl-libc. cc `@Gelbpunkt`
2025-08-26Rollup merge of #144373 - hkBst:remove-deprecated-1, r=jhprattGuillaume Gomez-12/+3
remove deprecated Error::description in impls [libs-api permission](https://github.com/rust-lang/libs-team/issues/615#issuecomment-3074045829) r? `@cuviper` or `@jhpratt`
2025-08-26Use captures(address) instead of captures(none) for indirect argsNikita Popov-18/+15
While provenance cannot be captured through these arguments, the address / object identity can.
2025-08-26Remove 1-argument special case from format_args!().Mara Bos-20/+0
The argument needs to be lifetime-extended, so this special case isn't actually perfectly equivalent to the general case.
2025-08-26add a flag to codegen fn attrs for foreign itemsJana Dönszelmann-10/+13
2025-08-26Auto merge of #145871 - Zalathar:rollup-lag9tlg, r=Zalatharbors-167/+237
Rollup of 12 pull requests Successful merges: - rust-lang/rust#143689 (Allow linking a prebuilt optimized compiler-rt builtins library) - rust-lang/rust#144885 (Implement some more checks in `ptr_guaranteed_cmp`. ) - rust-lang/rust#145535 (make rustdoc::invalid_html_tags more robust) - rust-lang/rust#145766 (test(rustfmt): Verify frontmatter is preserved) - rust-lang/rust#145811 (Fix some minor issues in comments) - rust-lang/rust#145814 (Handle unwinding fatal errors in codegen workers) - rust-lang/rust#145815 (Wait for DPkg frontend lock when trying to remove packages) - rust-lang/rust#145821 (compiletest: if a compiler fails, show its output) - rust-lang/rust#145845 (Make `x test distcheck` self-contained) - rust-lang/rust#145847 (Don't show warnings from xcrun with -Zverbose-internals) - rust-lang/rust#145856 (Update books) - rust-lang/rust#145858 (Update wasm-component-ld dependency) r? `@ghost` `@rustbot` modify labels: rollup
2025-08-26remove deprecated Error::description in implsMarijn Schouten-12/+3
2025-08-26Rollup merge of #145847 - madsmtm:no-xcrun-warnings, r=jieyouxuStuart Cook-1/+1
Don't show warnings from xcrun with -Zverbose-internals These kinds of warnings can make our test suite fail spuriously, so if we want them, we'll need a different flag. This was introduced in https://github.com/rust-lang/rust/pull/131477. Fixes https://github.com/rust-lang/rust/issues/145543. r? apiraino ```@bors``` rollup
2025-08-26Auto merge of #145848 - Kobzol:optimize-file-read, r=the8472bors-2/+8
Slightly optimize reading of source files Discussed on Zulip (https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/rustc.20uses.20silly.20amount.20of.20syscalls.20for.20file.20IO/with/536015625. Do not open/close each source file twice when reading it. We still stat it twice though.
2025-08-26Rollup merge of #145814 - bjorn3:codegen_worker_fatal_error, r=petrochenkovStuart Cook-151/+133
Handle unwinding fatal errors in codegen workers Also directly unwind on fatal errors at the point they are emitted inside the codegen backends. Fixes the coordinator ICE of https://github.com/rust-lang/rust/issues/132240, https://github.com/rust-lang/rust/issues/135075 and https://github.com/rust-lang/rust/issues/145800.
2025-08-26Rollup merge of #144885 - zachs18:ptr_guaranteed_cmp_more, r=RalfJungStuart Cook-15/+103
Implement some more checks in `ptr_guaranteed_cmp`. * Pointers with different residues modulo their allocations' least common alignment are never equal. * Pointers to the same static allocation are equal if and only if they have the same offset. * Pointers to different non-zero-sized static allocations are unequal if both point within their allocation, and not on opposite ends. Tracking issue for `const_raw_ptr_comparison`: <https://github.com/rust-lang/rust/issues/53020> This should not affect `is_null`, the only usage of this intrinsic on stable. Closes https://github.com/rust-lang/rust/issues/144584
2025-08-26rustc_codegen_ssa: More comprehensive RISC-V ELF flagsTsukasa OI-2/+10
This commit implements more conformant, more comprehensive RISC-V ELF flags handling when generating certain object files directly from rustc. * Use "zca" instead of "c" The "Zca" extension (a subset of "C") is the minimal configuration for compressed instructions to set `EF_RISCV_RVC` flag. * Set TSO flag from "ztso" The "Ztso" extension denotes that the program depends on the RVTSO (Total Store Ordering) memory consistency model, which is stronger than the standard RVWMO (Weak Memory Ordering) consistency model and on ELF targets, we need to set `EF_RISCV_TSO` flag.
2025-08-26rustc_codegen_ssa: Fix commentTsukasa OI-1/+1
2025-08-26Assert that LLVM range-attribute values don't exceed 128 bitsZalathar-11/+30
The underlying implementation of `LLVMCreateConstantRangeAttribute` assumes that each of `LowerWords` and `UpperWords` points to enough u64 values to define an integer of the specified bit-length, and will encounter UB if that is not the case. Our safe wrapper function always passes pointers to `[u64; 2]` arrays, regardless of the bit-length specified. That's fine in practice, because scalar primitives never exceed 128 bits, but it is technically a soundness hole in a safe function. We can close the soundness hole by explicitly asserting `size_bits <= 128`. This is effectively just a stricter version of the existing check that the value must be small enough to fit in `c_uint`.
2025-08-25Auto merge of #145711 - lcnr:non-defining-uses-hir-typeck, r=BoxyUwUbors-214/+359
Support non-defining uses in HIR typeck This changes the impl of `NormalizesTo` for opaque types to be structural during HIR typeck. The previous impl equated region variables of the opaque type key with existing entries which can result in spurious leak check errors and also results in mismatches with MIR borrowck, theoretically causing ICE. The approach is very similar to rust-lang/rust#145244 in MIR typeck: - we collect all uses of opaque types during HIR typeck - before writeback, we search for *defining uses* - the opaque type key has fully universal generic args modulo regions - the hidden type has no infer vars - we use these defining uses to compute the concrete type for the opaque and map it to the definition site - we use this concrete type to check the type of all uses of opaques during HIR typeck. This also constrains infer vars in non-defining uses Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/135, fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/49. r? `@BoxyUwU`
2025-08-25Only consider auto traits empty for the purposes of omitting vptrs from ↵Zachary S-1/+6
subtrait vtables
2025-08-25Use attribute name in message for "outer attr used as inner attr" errorsSasha Pourcelot-42/+154
2025-08-25Add aarch64_be-unknown-linux-musl targetJ. Neuschäfer-0/+41
2025-08-25Do not open every source file twice when reading itJakub Beránek-2/+8
2025-08-25use size_hint in attrs_to_doc_fragmentsbinarycat-2/+7
2025-08-25On binding not present in all patterns, suggest potential typoEsteban Küber-35/+88
``` error[E0408]: variable `Ban` is not bound in all patterns --> f12.rs:9:9 | 9 | (Foo,Bar)|(Ban,Foo) => {} | ^^^^^^^^^ --- variable not in all patterns | | | pattern doesn't bind `Ban` | help: you might have meant to use the similarly named previously used binding `Bar` | 9 - (Foo,Bar)|(Ban,Foo) => {} 9 + (Foo,Bar)|(Bar,Foo) => {} | ```
2025-08-25Switch next solver to use a specific associated type for trait def idChayim Refael Friedman-177/+233
The compiler just puts `DefId` in there, but rust-analyzer uses different types for each kind of item.
2025-08-25Don't show warnings from xcrun with -Zverbose-internalsMads Marquart-1/+1
These kinds of warnings can make our test suites fail, so if we want them, we'll need a different flag.
2025-08-25change non-defining use error messagelcnr-41/+40
2025-08-25support non-defining uses in HIR typecklcnr-186/+331
2025-08-25Rollup merge of #145836 - minux-lee:issue-145835, r=RalfJungStuart Cook-5/+0
Remove outdated bug comments The related issue https://github.com/rust-lang/rust/issues/74836 was closed. This PR may close rust-lang/rust#145835. Details are in the issue rust-lang/rust#145835.
2025-08-25Rollup merge of #145830 - nnethercote:TokenKind-unref, r=chenyukangStuart Cook-49/+49
Remove the lifetime from `ExpTokenPair`/`SeqSep`. `TokenKind` now impls `Copy`, so we can store it directly rather than a reference. r? `@chenyukang`
2025-08-25Rollup merge of #145820 - mati865:raw-elf-verdefnum, r=bjorn3Stuart Cook-3/+10
raw-dylib-elf: set correct `DT_VERDEFNUM` Previously it indicated a single version, regardless of their count. Observed in: https://github.com/davidlattimore/wild/pull/1041
2025-08-25Rollup merge of #145817 - Zalathar:llvm-bool, r=workingjubileeStuart Cook-63/+103
cg_llvm: Replace the `llvm::Bool` typedef with a proper newtype This should be nicer and more type-safe than the old typedef for `c_int`/`i32`. Using `#[repr(transparent)]` should ensure that it's still ABI-compatible.
2025-08-25Rollup merge of #145788 - JonathanBrouwer:proper-fix-for-macro-call-target, ↵Stuart Cook-17/+35
r=jdonszelmann Fix attribute target checking for macro calls Fixes https://github.com/rust-lang/rust/issues/145779 r? `@jdonszelmann`
2025-08-25Rollup merge of #145620 - compiler-errors:fake-dyn-to-dyn, r=lcnrStuart Cook-62/+74
Account for impossible bounds making seemingly unsatisfyable dyn-to-dyn casts Fixes https://github.com/rust-lang/rust/issues/141806 When we have an impossible where clause like `dyn Trait<u8>: Sized`, this may make a dyn-to-dyn cast like `dyn Trait<()> -> dyn trait<u8>` to successfully type check as if it were a wide-to-thin ptr cast (discarding metadata): https://github.com/rust-lang/rust/blob/16ad385579cebb6f7d53367c552661b6b51a4a02/compiler/rustc_hir_typeck/src/cast.rs#L862-L865 In borrowck, we are expecting that the only meaningful dyn-to-dyn cast to be a metadata-preserving wide-to-wide ptr cast, which requires that the principals of the dyn pointers are equal. Borrowck additionally assumes that these principals have already been proven equal *modulo regions*, and we thus ICE since `Trait<u8>` and `Trait<()>` do not unify: https://github.com/rust-lang/rust/blob/16ad385579cebb6f7d53367c552661b6b51a4a02/compiler/rustc_borrowck/src/type_check/mod.rs#L1481-L1524 This PR fixes this ICE by checking whether the RHS of the cast is considered to be Sized in the environment of the MIR typeck, and if so then skipping over this dyn->dyn principal compatibility check. r? `@lcnr` perhaps?
2025-08-25fold regions, don't eraselcnr-3/+4
erase regions also anonymizes bound vars, which is undesirable
2025-08-25add span to struct pattern rest (..)Valdemar Erk-23/+32