about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-05-28Rollup merge of #141670 - chenyukang:yukang-fix-ice-from-contracts, ↵Trevor Gross-7/+6
r=nnethercote Fix ICE in tokenstream with contracts from parser recovery Fixes rust-lang/rust#140683 After two times of parsing error, the `recover_stmt_` constructs an error ast, then when we expand macors, the invalid tokenstream triggered ICE because of mismatched delims. Expected `{` and get other tokens is an obvious error message, too much effort on recovery may introduce noise. r? ```@nnethercote```
2025-05-28Rollup merge of #141627 - nnethercote:drop-cleanups, r=matthewjasperTrevor Gross-53/+59
Drop-build cleanups Some cleanups I made while trying to speed up the program in rust-lang/rust#134404. r? ```@matthewjasper```
2025-05-28Rollup merge of #141548 - bvanjoi:issue-141256, r=petrochenkovTrevor Gross-5/+51
consider glob imports in cfg suggestion Fixes rust-lang/rust#141256 r? ```@petrochenkov```
2025-05-28Rollup merge of #141404 - bjorn3:refactor_cg_ssa_call_codegen, r=davidtwcoTrevor Gross-266/+237
Improve intrinsic handling in cg_ssa * Move all intrinsic handling code to the start of `codegen_call_terminator`. * Push some intrinsic handling code into `codegen_intrinsic_call`. * Don't depend on FnAbi for intrinsics.
2025-05-28Rollup merge of #140697 - Sa4dUs:split-autodiff, r=ZuseZ4Trevor Gross-33/+55
Split `autodiff` into `autodiff_forward` and `autodiff_reverse` This PR splits `#[autodiff]` macro so `#[autodiff(df, Reverse, args)]` would become `#[autodiff_reverse(df, args)]` and `#[autodiff(df, Forward, args)]` would become `#[autodiff_forwad(df, args)]`.
2025-05-28Stabilise `repr128`beetrees-25/+6
2025-05-28GCI: Check where-clauses for well-formedness at the def siteLeón Orell Valerian Liehr-8/+33
2025-05-28Add diagnostic items to sys::MutexPatrick-6-0/+3
2025-05-28Handle e2021 precise capturing of unsafe binderMichael Goulet-2/+6
2025-05-28interpret/allocation: make alloc fn be FnOnceNia Espera-1/+1
2025-05-28Use `builin_index` instead of hand-rolling itOli Scherer-13/+6
2025-05-28Reorder `ast::ItemKind::{Struct,Enum,Union}` fields.Nicholas Nethercote-47/+45
So they match the order of the parts in the source code, e.g.: ``` struct Foo<T, U> { t: T, u: U } <-><----> <------------> / | \ ident generics variant_data ```
2025-05-28Fix ICE in tokenstream with contracts from parser recoveryyukang-7/+6
2025-05-27Rollup merge of #141551 - compiler-errors:hir-lints, r=BoxyUwUTrevor Gross-312/+292
Make two transmute-related MIR lints into HIR lint Make `PTR_TO_INTEGER_TRANSMUTE_IN_CONSTS` (rust-lang/rust#130540) and `UNNECESSARY_TRANSMUTES` (rust-lang/rust#136083) into "normal" HIR-based lints. Funny enough this came up in the review of the latter (https://github.com/rust-lang/rust/pull/136083#issuecomment-2614301413), but I guess it just was overlooked. But anywyas, there's no reason for these to be MIR lints; in fact, it makes the suggestions for them a bit more complicated than necessary. Note that there's probably a few more simplifications and improvements to be done here. Follow-ups can be done in a separate PR, especially if they're about the messaging and suggestions themselves, which I didn't write.
2025-05-27Rollup merge of #141252 - dianqk:gvn-repeat-index, r=saethlinTrevor Gross-1/+7
gvn: bail out unavoidable non-ssa locals in repeat Fixes #141251. We cannot transform `*elem` to `array[idx1]` in the following code, as `idx1` has already been modified. ```rust mir! { let array; let elem; { array = [*val; 5]; elem = &array[idx1]; idx1 = idx2; RET = *elem; Return() } } ``` Perhaps I could transform it to `array[0]`, but I prefer the conservative approach. r? mir-opt
2025-05-27Rollup merge of #140894 - Urgau:check-cfg-rustdoc, r=GuillaumeGomezTrevor Gross-9/+25
Make check-cfg diagnostics work in `#[doc(cfg(..))]` This PR makes it so that the check-cfg `unexpected_cfgs` lint, is correctly emitted in `rustdoc`'s `#[doc(cfg(..))]`. This is achieved by adding a custom trait to `cfg_matches` (the method that emits the lint) which permits `rustc` and `rustdoc` to each have their way to emitting lints (via buffered lints/AST for `rustc` and via `TyCtxt`/HIR for `rustdoc`). The reason this is required is because buffered lints operates on the AST but `rustdoc` uses the HIR and by the time `rustdoc` calls `cfg_matches` we are way passed the point where buffered lints have been drain and emitted. Best reviewed commit by commit. r? `@jieyouxu` (for the compiler part) r? `@GuillaumeGomez` (for the rustdoc part)
2025-05-27Rollup merge of #140367 - folkertdev:asm-cfg, r=nnethercoteTrevor Gross-422/+534
add `asm_cfg`: `#[cfg(...)]` within `asm!` tracking issue: https://github.com/rust-lang/rust/issues/140364 blocked on: https://github.com/rust-lang/rust/pull/140490 This feature was discussed in https://github.com/rust-lang/rust/issues/140279. It allows configuring templates and operands in the assembly macros, for example: ```rust asm!( // or global_asm! or naked_asm! "nop", #[cfg(target_feature = "sse2")] "nop", // ... #[cfg(target_feature = "sse2")] a = const 123, // only used on sse2 ); ``` r? `@tgross35` cc `@traviscross` `@Amanieu` Now builds on https://github.com/rust-lang/rust/pull/140490, which should be merged first.
2025-05-27Rollup merge of #141650 - Zalathar:revert-unused-local-file, r=ZalatharMatthias Krüger-108/+42
coverage: Revert "unused local file IDs" due to empty function names The changes to coverage metadata generation in rust-lang/rust#140847 appear to be the most likely cause of the `function name is empty` errors reported in rust-lang/rust#141577. If that guess is correct, great. If not, no big deal. --- This reverts commit 3b22c21dd8c30f499051fe7a758ca0e5d81eb638, reversing changes made to 5f292eea6d63abbd26f1e6e00a0b8cf21d828d7d. r? ghost
2025-05-27Rollup merge of #141645 - klensy:fluent-b, r=jieyouxuMatthias Krüger-4/+4
bump fluent-* crates This bumps fluent-* crates, switching to more up-to-date deps, reducing number of old ones. changelogs is pure refactoring: https://github.com/projectfluent/fluent-rs/blob/fluent-bundle%400.16.0/fluent-bundle/CHANGELOG.md https://github.com/projectfluent/fluent-rs/blob/fluent-bundle%400.16.0/fluent-syntax/CHANGELOG.md
2025-05-27Rollup merge of #141632 - fee1-dead-contrib:push-txmttkxvwqxl, r=oli-obkMatthias Krüger-11/+3
remove `visit_mt` from `ast::mut_visit` doesn't look like anyone is using it.
2025-05-27Rollup merge of #141495 - compiler-errors:rename-unpack, r=fmeaseMatthias Krüger-149/+149
Rename `{GenericArg,Term}::unpack()` to `kind()` A well-deserved rename IMO. r? `@oli-obk` or `@lcnr` (or anyone) cc `@rust-lang/types,` but I'd be surprised if this is controversial.
2025-05-28consider glob imports in cfg suggestionbohan-5/+51
2025-05-27Drive-by: Delete dead TyCtxtEnsureOk::const_eval_polyLeón Orell Valerian Liehr-22/+0
2025-05-27Always evaluate free lifetime-generic constantsLeón Orell Valerian Liehr-2/+4
Co-authored-by: Michael Goulet <michael@errs.io>
2025-05-27Warn on non-crate level text direction lintsMatthew Jasper-1/+3
2025-05-27Avoid including text direction codepoints in lint messagesMatthew Jasper-4/+4
2025-05-27Report text_direction_codepoint_in_literal when parsingMatthew Jasper-142/+151
- The lint is now reported in code that gets removed/modified/duplicated by macro expansion. - Spans are more accurate - Fixes #140281
2025-05-27Do not get proc_macro from the sysroot in rustcbjorn3-18/+42
With the stage0 refactor the proc_macro version found in the sysroot will no longer always match the proc_macro version that proc-macros get compiled with by the rustc executable that uses this proc_macro. This will cause problems as soon as the ABI of the bridge gets changed to implement new features or change the way existing features work. To fix this, this commit changes rustc crates to depend directly on the local version of proc_macro which will also be used in the sysroot that rustc will build.
2025-05-27Refactor the two-phase check for impls and impl itemsMu001999-131/+121
2025-05-27Make some assertions in solver into debug assertionsMichael Goulet-11/+12
2025-05-27coverage: Revert "unused local file IDs" due to empty function namesZalathar-108/+42
This reverts commit 3b22c21dd8c30f499051fe7a758ca0e5d81eb638, reversing changes made to 5f292eea6d63abbd26f1e6e00a0b8cf21d828d7d.
2025-05-27Fix some var namesMichael Goulet-34/+34
2025-05-27Rename unpack to kindMichael Goulet-129/+129
2025-05-27bump fluent-* cratesklensy-4/+4
2025-05-27Rollup merge of #141635 - fee1-dead-contrib:push-lmyymwotrspk, r=oli-obkMichael Goulet-284/+145
further dedup `WalkItemKind` for `mut_visit` and `visit` also some drive-by fixes. r? oli-obk
2025-05-27Rollup merge of #141623 - folkertdev:va-arg-explicit-types, r=workingjubileeMichael Goulet-22/+61
use custom types to clarify arguments to `emit_ptr_va_arg` tracking issue: https://github.com/rust-lang/rust/issues/44930 split out of https://github.com/rust-lang/rust/pull/141622 r? ``@workingjubilee`` ``@rustbot`` label: +F-c_variadic
2025-05-27Rollup merge of #141599 - nnethercote:rm-Box-into_inner, r=fmease,chenyukangMichael Goulet-2/+1
Remove an unnecessary use of `Box::into_inner`. r? ```@chenyukang```
2025-05-27Rollup merge of #141584 - compiler-errors:typing-env-synthetic-body, r=lcnrMichael Goulet-3/+5
Support `opaque_types_defined_by` for `SyntheticCoroutineBody` We create a synthetic MIR body for the `AsyncFnOnce` impl for async closures. That body goes through all passes that a regular body does, including promotion. Promotion sometimes requires computing that the type of an rvalue is `Freeze`, which requires computing the typing env of a body. This requires calling `opaque_types_defined_by` on the body's def id, which leads to an ICE today since we don't expect that query to be called for synthetic bodies. While we could fix this by, for example, computing the typeck root of the body before calling a `TypingEnv` constructor, I think it's appropriate to do a more general fix here since I think it's reasonable that other passes might do analysis too. Fixes rust-lang/rust#141466 r? ```@lcnr``` or ```@oli-obk```
2025-05-27Rollup merge of #141582 - RalfJung:cleanup, r=bjorn3Michael Goulet-8/+51
intrinsics, ScalarInt: minor cleanup Taken out of https://github.com/rust-lang/rust/pull/141507 while we resolve technical disagreements in that PR. r? ``@bjorn3``
2025-05-27Rollup merge of #141580 - oli-obk:early-dyn-catches-the-incompat, ↵Michael Goulet-7/+18
r=compiler-errors Use more detailed spans in dyn compat errors within bodies Within bodies we can employ the full dyn compat check query instead of only doing the minimal hir ty lowerer one. This in turn gives us better spans and also silences many follow-up duplicate or bogus errors. alternative to https://github.com/rust-lang/rust/pull/141439, tho I think I could turn the delayed bug from that one into a bug now instead of having an error code path. r? `@compiler-errors` cc `@fmease`
2025-05-27Rollup merge of #141563 - nnethercote:rm-noop, r=petrochenkovMichael Goulet-23/+5
Remove out-of-date `noop_*` names. `mut_visit.rs` has a single function with a `noop_` prefix: `noop_filter_map_expr`. This commit renames as `walk_filter_map_expr` which is consistent with other functions in this file. The commit also removes out-of-date comments that refer to `noop_*` methods. r? `@petrochenkov`
2025-05-27Rollup merge of #141536 - Urgau:ambi_wide_ptr-cmp-diag, r=fee1-deadMichael Goulet-63/+101
Improve `ambiguous_wide_pointer_comparisons` lint compare diagnostics This PR improves the `ambiguous_wide_pointer_comparisons` lint compare diagnostics: `cmp`/`partial_cmp`, but also the operators `<`/`>`/`>=`/`<=`, by: 1. removing the reference to `std::ptr::addr_eq` which only works for equality 2. and adding an `#[expect]` suggestion for keeping the current behavior Fixes rust-lang/rust#141510
2025-05-27Rollup merge of #140591 - Kivooeo:new-fix-five, r=davidtwcoMichael Goulet-16/+11
Fix malformed suggestion for E0061 when method is a macro token in macro context fixes #140512 before ```rust 3 - <Self>::$method(8) 3 + <Self>::<Self>::$method(8, /* u8 */) ``` now ```rust 3 | <Self>::$method(8, /* u8 */) | ++++++++++ ```
2025-05-27Remove out-of-date `noop_*` names.Nicholas Nethercote-23/+5
`mut_visit.rs` has a single function with a `noop_` prefix: `noop_filter_map_expr`. This commit renames as `walk_filter_map_expr` which is consistent with other functions in this file. The commit also removes out-of-date comments that refer to `noop_*` methods.
2025-05-27Use more detailed spans in dyn compat errors within bodiesOli Scherer-7/+18
2025-05-27move asm parsing code into `rustc_parse`Folkert de Vries-478/+495
2025-05-27support `#[cfg(...)]` on arguments to the `asm!` macrosFolkert de Vries-4/+99
2025-05-27further dedup `WalkItemKind` for `mut_visit` and `visit`Deadbeef-284/+145
also some drive-by fixes.
2025-05-27remove `visit_mt` from `ast::mut_visit`Deadbeef-11/+3
doesn't look like anyone is using it.
2025-05-26Auto merge of #140790 - quininer:mac-xray, r=wesleywiser,jieyouxubors-0/+2
Enable xray support for Mac https://github.com/rust-lang/rust/issues/102921 Upstream has supported Mac for a while, let's enable it. I've tested it on M4 and it generates nop sled correctly. * https://maskray.me/blog/2023-06-18-port-llvm-xray-to-apple-systems * https://github.com/llvm/llvm-project/blob/llvmorg-20.1.4/clang/lib/Driver/XRayArgs.cpp#L31 try-job: x86_64-apple-1 try-job: aarch64-apple