about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-09-05cg_clif: account for moved `tests/run-make-cargo/compiler-builtins`Jieyou Xu-1/+1
2025-09-05remove couple of clonesMatthias Krüger-4/+4
2025-09-05rustc_infer: change top-level doc comment to innerMarijn Schouten-1/+1
2025-09-05DynamicConfig: use canonical clone implMarijn Schouten-1/+1
2025-09-05Auto merge of #146044 - estebank:issue-88727, r=chenyukangbors-42/+123
Suggest parentheses when `match` or `if` expression in binop is parsed as statement ``` error[E0308]: mismatched types --> $DIR/expr-as-stmt.rs:81:5 | LL | match () { _ => true } && match () { _ => true }; | ^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `bool` | help: parentheses are required to parse this as an expression | LL | (match () { _ => true }) && match () { _ => true }; | + + ``` Address the common case from rust-lang/rust#88727. The original parse error is still outstanding, but the cases brought up in the thread are resolved.
2025-09-05gpu offload: change suspicious map into filterMarijn Schouten-1/+1
2025-09-05Auto merge of #146224 - tgross35:rollup-1bgjms3, r=tgross35bors-38/+110
Rollup of 5 pull requests Successful merges: - rust-lang/rust#144342 (add exact bitshifts) - rust-lang/rust#145709 (Fix LoongArch C function ABI when passing/returning structs containing floats) - rust-lang/rust#146152 (Unify and deduplicate algebraic float tests) - rust-lang/rust#146207 (std: Implement WASIp2-specific stdio routines) - rust-lang/rust#146217 (fix ICE when suggesting `::new`) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-05Rollup merge of #146217 - lukas-code:suggest-new-ice, r=compiler-errorsTrevor Gross-6/+5
fix ICE when suggesting `::new` fixes https://github.com/rust-lang/rust/issues/146174 This code suggests to write `Foo::new(...)` when the user writes `Foo(...)` or `Foo { ... }` and the constructor is private, where `new` is some associated function that returns `Self`. When checking that the return type of `new` is `Self`, we need to instantiate the parameters of `new` with infer vars, so we don't end up with a type like `Box<$param(0)>` in a context that doesn't have any parameters. But then we can't use `normalize_erasing_late_bound_regions` anymore because that goes though a query that can't deal with infer vars. Since this is diagnostic-only code that is supposed to check for exactly `-> Self`, I think it's fine to just skip normalizing here, especially since The Correct Way<sup>TM</sup> would involve a probe and make this code even more complicated. Also, the code here does almost the same thing, and these suggestions can probably be unified in the future: https://github.com/rust-lang/rust/blob/4ca8078d37c53ee4ff8fb32b4453b915116f25b8/compiler/rustc_hir_typeck/src/method/suggest.rs#L2123-L2129 r? ````@compiler-errors```` cc ````@Qelxiros```` -- this should unblock https://github.com/rust-lang/rust/pull/144420
2025-09-05Rollup merge of #145709 - heiher:issue-145692-1, r=jackh726Trevor Gross-32/+105
Fix LoongArch C function ABI when passing/returning structs containing floats Similar to RISC-V, LoongArch passes structs containing only one or two floats (or a float–integer pair) in registers, as long as each element fits into a single corresponding register. Before this PR, Rust did not check the actual offset of the second float or integer; instead, it assumed the standard offset based on the default alignment. However, since the offset can be affected by `#[repr(align(N))]` and `#[repr(packed)]`, this led to miscompilations (see rust-lang/rust#145692). This PR fixes the issue by explicitly specifying the offset for the remainder of the cast.
2025-09-05Auto merge of #144737 - petrochenkov:extprelcache, r=davidtwcobors-6/+8
resolve: Avoid finalizing extern prelude entries more than once
2025-09-04fix: Filter suggestion parts that match existing codeScott Schafer-10/+11
2025-09-04chore: Remove redundant disjoint spans assertScott Schafer-5/+0
2025-09-04refactor: Move assert for disjoint substitution spansScott Schafer-1/+6
2025-09-04Auto merge of #138736 - azhogin:azhogin/sanitizers-target-modificators, ↵bors-7/+82
r=rcvalle Sanitizers target modificators Depends on bool flag fix: https://github.com/rust-lang/rust/pull/138483. Some sanitizers need to be target modifiers, and some do not. For now, we should mark all sanitizers as target modifiers except for these: AddressSanitizer, LeakSanitizer For kCFI, the helper flag -Zsanitizer-cfi-normalize-integers should also be a target modifier. Many test errors was with sanizer flags inconsistent with std deps. Tests are fixed with `-C unsafe-allow-abi-mismatch`.
2025-09-04fix ICE when suggesting `::new`Lukas Markeffsky-6/+5
2025-09-04don't extend non-extended `super let` initializers' block tail tempsdianne-5/+19
2025-09-04compiler: Apply target features to the entry functionWANG Rui-10/+22
2025-09-04Auto merge of #145955 - bjorn3:lto_refactors4, r=nnethercotebors-155/+97
Rework how the codegen coordinator code handles the allocator shim Continuing from https://github.com/rust-lang/rust/pull/144503 this centralizes most handling of the allocator shim to a single 4 line block in the codegen coordinator. The allocator shim is small enough that making it go through the main codegen loop and spawning a worker thread for it is wasted effort.
2025-09-04rustc_log: remove direct dep on tracing_coreklensy-1/+1
required features reexported from tracing
2025-09-04unpin tracing_coreklensy-2/+2
2025-09-04Special case allocator module submission to avoid special casing it elsewherebjorn3-146/+79
A lot of places had special handling just in case they would get an allocator module even though most of these places could never get one or would have a trivial implementation for the allocator module. Moving all handling of the allocator module to a single place simplifies things a fair bit.
2025-09-04Ensure the allocator shim never participates in LTObjorn3-18/+13
Making it participate in LTO would be incorrect if you compile a crate as both a dylib (which needs it) and rlib (which must not include it) in the same rustc invocation. With linker plugin LTO, the allocator shim will still participate in LTO as it is safe to do so in that case.
2025-09-04Export __rdl_* symbols to the allocator shim when doing LTObjorn3-0/+14
2025-09-04Rollup merge of #146182 - ChayimFriedman2:ns-probe, r=jackh726Jacob Pratt-8/+9
Don't require next-solver `ProbeRef` to be `Copy` rust-analyzer would like to use a non-interned `Probe` there. Also rename it to `Probe` for this reason. We can make it `Copy` (although then `Probe` will need to be `Clone` for rust-analyzer) but it seems just non-needed. r? types
2025-09-04Rollup merge of #145690 - sayantn:integer-funnel-shift, r=tgross35Jacob Pratt-8/+23
Implement Integer funnel shifts Tracking issue: rust-lang/rust#145686 ACP: https://github.com/rust-lang/libs-team/issues/642 This implements funnel shifts on primitive integer types. Implements this for cg_llvm, with a fallback impl for everything else Thanks `@folkertdev` for the fixes and tests cc `@rust-lang/libs-api`
2025-09-04Rollup merge of #145682 - dpaoliello:arm64tier1, r=jieyouxuJacob Pratt-1/+1
Promote aarch64-pc-windows-msvc to Tier 1 Per <https://github.com/rust-lang/rfcs/pull/3817> Tracking issue: <https://github.com/rust-lang/rust/issues/145671>
2025-09-04Rollup merge of #146137 - Urgau:cfg-disallow-frontmatter, r=fmeaseStuart Cook-6/+20
Disallow frontmatter in `--cfg` and `--check-cfg` arguments This PR disallows the frontmatter syntax in `--cfg` and `--check-cfg` arguments. Fixes https://github.com/rust-lang/rust/issues/146130 r? fmease
2025-09-04Rollup merge of #146134 - maurer:nvptx-sync, r=durin42Stuart Cook-1/+5
llvm: nvptx: Layout update to match LLVM LLVM upstream switched layouts to support 256-bit vector load/store. ``````@rustbot`````` label llvm-main r? durin42
2025-09-04Rollup merge of #146120 - smoelius:patch-3, r=lqdStuart Cook-1/+1
Correct typo in `rustc_errors` comment
2025-09-04Rollup merge of #146112 - scrabsha:push-utkysktvulto, r=WaffleLapkinStuart Cook-14/+14
don't uppercase error messages
2025-09-04Rollup merge of #146090 - Kobzol:invisible-origin-eq, r=petrochenkovStuart Cook-19/+21
Derive `PartialEq` for `InvisibleOrigin` For https://github.com/rust-lang/rust/pull/145354, we need `PartialEq` for `TokenStream` to "just work". However, due to the special comparison implementation that was used for `InvisibleOrigin`, this wasn't the case. So I derived `PartialEq` for `InvisibleOrigin`, and used the previous special comparison logic only on the single place where it was actually required. r? `````````@petrochenkov`````````
2025-09-04Rollup merge of #145963 - heiher:src-analysis-lsx, r=lqdStuart Cook-3/+107
Add LSX accelerated implementation for source file analysis This patch introduces an LSX-optimized version of `analyze_source_file` for the `loongarch64` target. Similar to existing SSE2 implementation for x86, this version: - Processes 16-byte chunks at a time using LSX vector intrinsics. - Quickly identifies newlines in ASCII-only chunks. - Falls back to the generic implementation when multi-byte UTF-8 characters are detected or in the tail portion.
2025-09-04Rollup merge of #145962 - bjorn3:linkage_fixes, r=WaffleLapkinStuart Cook-39/+82
Ensure we emit an allocator shim when only some crate types need one Found this while trying to write a test for https://github.com/rust-lang/rust/pull/145955.
2025-09-04Rollup merge of #145932 - JamieCunliffe:target-feature-inlining, r=jackh726Stuart Cook-15/+246
Allow `inline(always)` with a target feature behind a unstable feature `target_feature_inline_always`. Rather than adding the inline always attribute to the function definition, we add it to the callsite. We can then check that the target features match and that the call would be safe to inline. If the function isn't inlined due to a mismatch, we emit a warning informing the user that the function can't be inlined due to the target feature mismatch. See tracking issue rust-lang/rust#145574
2025-09-04Rollup merge of #145827 - estebank:issue-51976, r=jackh726Stuart Cook-38/+273
On unused binding or binding not present in all patterns, suggest potential typo of unit struct/variant or const When encountering an or-pattern with a binding not available in all patterns, look for consts and unit struct/variants that have similar names as the binding to detect typos. ``` error[E0408]: variable `Ban` is not bound in all patterns --> $DIR/binding-typo.rs:22:9 | LL | (Foo, _) | (Ban, Foo) => {} | ^^^^^^^^ --- variable not in all patterns | | | pattern doesn't bind `Ban` | help: you might have meant to use the similarly named unit variant `Bar` | LL - (Foo, _) | (Ban, Foo) => {} LL + (Foo, _) | (Bar, Foo) => {} | ``` For items that are not in the immedate scope, suggest the full path for them: ``` error[E0408]: variable `Non` is not bound in all patterns --> $DIR/binding-typo-2.rs:51:16 | LL | (Non | Some(_))=> {} | --- ^^^^^^^ pattern doesn't bind `Non` | | | variable not in all patterns | help: you might have meant to use the similarly named unit variant `None` | LL - (Non | Some(_))=> {} LL + (core::option::Option::None | Some(_))=> {} | ``` When encountering a typo in a pattern that gets interpreted as an unused binding, look for unit struct/variant of the same type as the binding: ``` error: unused variable: `Non` --> $DIR/binding-typo-2.rs:36:9 | LL | Non => {} | ^^^ | help: if this is intentional, prefix it with an underscore | LL | _Non => {} | + help: you might have meant to pattern match on the similarly named variant `None` | LL - Non => {} LL + std::prelude::v1::None => {} | ``` Suggest constant on unused binding in a pattern ``` error: unused variable: `Batery` --> $DIR/binding-typo-2.rs:110:9 | LL | Batery => {} | ^^^^^^ | help: if this is intentional, prefix it with an underscore | LL | _Batery => {} | + help: you might have meant to pattern match on the similarly named constant `Battery` | LL | Battery => {} | + ``` Fix rust-lang/rust#51976.
2025-09-04Rollup merge of #145342 - dianne:if-let-super-let, r=nnethercoteStuart Cook-41/+43
fix drop scope for `super let` bindings within `if let` Fixes rust-lang/rust#145328 by making non-lifetime-extended `super let` reuse the logic used to compute drop scopes for non-lifetime-extended temporaries. Also fixes rust-lang/rust#145374, which regressed due to rust-lang/rust#143376 introducing `if let`-like scopes for match arms with guards. Tracking issue for `super let`: rust-lang/rust#139076 This is a regression fix / breaking change for macros stably exposing `super let`, including `pin!` and `format_args!`. Nominating to be discussed alongside rust-lang/rust#145328: ```@rustbot``` label +I-lang-nominated +I-libs-api-nominated
2025-09-03In the rustc_llvm build script, don't consider arm64* to be 32-bitDaniel Paoliello-1/+4
2025-09-04Don't require next-solver `ProbeRef` to be `Copy`Chayim Refael Friedman-8/+9
rust-analyzer would like to use a non-interned `Probe` there. Also rename it to `Probe` for this reason.
2025-09-03Auto merge of #146133 - rcvalle:rust-cfi-fix-145981, r=bjorn3bors-1/+12
Revert "Make `lto` and `linker-plugin-lto` work the same for `compiler_builtins` This reverts commit cf8753e4f9c3597f04cd5d3aa261e4561d5378a6 (PR https://github.com/rust-lang/rust/pull/145368) and fix the regressions reported at rust-lang/rust#145981, rust-lang/rust#146109, and rust-lang/rust#146145.
2025-09-03simplify `check_c_variadic_type`Folkert de Vries-25/+21
2025-09-03don't uppercase error messagesSasha Pourcelot-14/+14
a more general version of https://github.com/rust-lang/rust/pull/146080. after a bit of hacking in [`fluent.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_fluent_macro/src/fluent.rs), i discovered that i'm not the only one that is bad at following guidelines :sweat_smile:. this pr lowercases the first letter of all the error messages in the codebase. (i did not change things that are traditionally uppercased such as _MIR_, _ABI_ or _C_) i think it's reasonable to run a `@bors try` so all the test suite is checked, as i cannot run some of the tests on my machine. i double checked (and replaced manually) all the old error messages, but better be safe than sorry. in the future i will try to add a check in `x test tidy` that errors if an error message starts with an uppercase letter.
2025-09-03Rollup merge of #146106 - epage:whitespace, r=fee1-deadStuart Cook-18/+31
fix(lexer): Only allow horizontal whitespace in frontmatter In writing up the reference for frontmatter, I realized that we probably shouldn't be accepting Unicode Line Ending characters between the code fence and infostring or trailing after the infostring or a code fence. In digging into the unicode specification we use for Whitespace, it divides it up into categories, so I'm deferring to what it says for horizontal whitespace for what should be used within a line. Note, I am leaving out support for Unicode Default Ignorable characters. I figure that can be discussed outside of this change within the reference and tracking issue. Fixes rust-lang/rust#145971 Frontmatter tracking issue: rust-lang/rust#136889
2025-09-03Rollup merge of #146032 - heiher:loong64-none-no-lsx, r=lqdStuart Cook-1/+1
Explicity disable LSX feature for `loongarch64-unknown-none` target The `loongarch64-unknown-none` target is a bare-metal target with hardware floating-point support and should not enable SIMD extensions by default. However, LLVM's LoongArch64 backend enables LSX implicitly, inadvertently activating SIMD instructions for this target. This patch explicitly disable LSX feature to prevent unintended SIMD usage.
2025-09-03Rollup merge of #145961 - petrochenkov:extprelregr, r=nnethercoteStuart Cook-3/+20
resolve: Avoid a regression from splitting prelude into two scopes Fixes https://github.com/rust-lang/rust/issues/145575.
2025-09-03Add `funnel_sh{l,r}` functions and intrinsicssayantn-8/+23
- Add a fallback implementation for the intrinsics - Add LLVM backend support for funnel shifts Co-Authored-By: folkertdev <folkert@folkertdev.nl>
2025-09-03Disallow frontmatter in `--cfg` and `--check-cfg` argumentsUrgau-6/+20
2025-09-03explicitly start `va_list` lifetimeFolkert de Vries-1/+5
2025-09-02Revert "Make `lto` and `linker-plugin-lto` work the same for ↵Ramon de C Valle-1/+12
`compiler_builtins`" This reverts commit cf8753e4f9c3597f04cd5d3aa261e4561d5378a6 and fixes the regressions reported.
2025-09-02llvm: nvptx: Layout update to match LLVMMatthew Maurer-1/+5
LLVM upstream switched layouts to support 256-bit vector load/store.
2025-09-02Auto merge of #146125 - GuillaumeGomez:rollup-ld81n7e, r=GuillaumeGomezbors-97/+112
Rollup of 14 pull requests Successful merges: - rust-lang/rust#144066 (stabilize c-style varargs for sysv64, win64, efiapi, aapcs) - rust-lang/rust#145783 (add span to struct pattern rest (..)) - rust-lang/rust#146034 (Update target spec metadata of Arm64EC Windows and Trusty targets) - rust-lang/rust#146064 (Add compiler error when trying to use concat metavar expr in repetitions) - rust-lang/rust#146070 (rustdoc-search: skip loading unneeded fnData) - rust-lang/rust#146088 (constify impl Try for ControlFlow) - rust-lang/rust#146089 (fix a constness ordering bug in rustfmt) - rust-lang/rust#146091 (fix rustdoc `render_call_locations` panicking because of default span `DUMMY_SP` pointing at non local-source file) - rust-lang/rust#146094 (Make `Parser::parse_for_head` public for rustfmt usage) - rust-lang/rust#146102 (Remove dead code stemming from an old effects desugaring) - rust-lang/rust#146115 (Add maintainer for VxWorks) - rust-lang/rust#146116 (Adjust issue-118306.rs test after LLVM change) - rust-lang/rust#146117 (Fix search index generation) - rust-lang/rust#146118 (improve process::abort rendering in Miri backtraces) r? `@ghost` `@rustbot` modify labels: rollup