about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-08-15Rollup merge of #145430 - Urgau:drop_forget_useless-145427, r=lqdJakub Beránek-1/+1
Fix wrong spans with external macros in the `dropping_copy_types` lint This PR fixes some wrong spans manipulations when external macros are involved. Specifically we didn't make sure the spans had the same context, which kind-of make our spans manipulations go wrong and produce weird spans. We fix that by making sure they have the same context. Fixes https://github.com/rust-lang/rust/issues/145427
2025-08-15Rollup merge of #145408 - Kobzol:deduplicate-search-paths, r=petrochenkovJakub Beránek-10/+21
Deduplicate -L search paths For each -L passed to the compiler, we eagerly scan the whole directory. If it has a lot of files, that results in a lot of allocations. So it's needless to do this if some -L paths are actually duplicated (which can happen e.g. in the situation in the linked issue). This PR both deduplicates the args, and also teaches rustdoc not to pass duplicated args to merged doctests. Fixes: https://github.com/rust-lang/rust/issues/145375
2025-08-15Fix wrong spans with external macros in the `dropping_copy_types` lintUrgau-1/+1
2025-08-15Auto merge of #145423 - Zalathar:rollup-9jtefpl, r=Zalatharbors-1295/+980
Rollup of 21 pull requests Successful merges: - rust-lang/rust#118087 (Add Ref/RefMut try_map method) - rust-lang/rust#122661 (Change the desugaring of `assert!` for better error output) - rust-lang/rust#142640 (Implement autodiff using intrinsics) - rust-lang/rust#143075 (compiler: Allow `extern "interrupt" fn() -> !`) - rust-lang/rust#144865 (Fix tail calls to `#[track_caller]` functions) - rust-lang/rust#144944 (E0793: Clarify that it applies to unions as well) - rust-lang/rust#144947 (Fix description of unsigned `checked_exact_div`) - rust-lang/rust#145004 (Couple of minor cleanups) - rust-lang/rust#145005 (strip prefix of temporary file names when it exceeds filesystem name length limit) - rust-lang/rust#145012 (Tail call diagnostics to include lifetime info) - rust-lang/rust#145065 (resolve: Introduce `RibKind::Block`) - rust-lang/rust#145120 (llvm: Accept new LLVM lifetime format) - rust-lang/rust#145189 (Weekly `cargo update`) - rust-lang/rust#145235 (Minor `[const]` tweaks) - rust-lang/rust#145275 (fix(compiler/rustc_codegen_llvm): apply `target-cpu` attribute) - rust-lang/rust#145322 (Resolve the prelude import in `build_reduced_graph`) - rust-lang/rust#145331 (Make std use the edition 2024 prelude) - rust-lang/rust#145369 (Do not ICE on private type in field of unresolved struct) - rust-lang/rust#145378 (Add `FnContext` in parser for diagnostic) - rust-lang/rust#145389 ([rustdoc] Revert "rustdoc search: prefer stable items in search results") - rust-lang/rust#145392 (coverage: Remove intermediate data structures from mapping creation) r? `@ghost` `@rustbot` modify labels: rollup
2025-08-15Rollup merge of #145392 - Zalathar:create-mappings, r=petrochenkovStuart Cook-77/+31
coverage: Remove intermediate data structures from mapping creation The data structures in `coverage::mappings` were historically very useful for isolating the details of mapping-extraction from the details of how coverage mappings are stored in MIR. But because of various changes that have taken place over time, they now provide little value, and cause difficulty for the coordinated changes that will be needed for introducing expansion mapping support. In the future, the pendulum might eventually swing back towards these being useful again, but we can always reintroduce suitable intermediate data structures if and when that happens. For now, the simplicity of not having this intermediate layer is a higher priority. There should be no changes to compiler output.
2025-08-15Rollup merge of #145378 - xizheyin:144968, r=davidtwcoStuart Cook-34/+94
Add `FnContext` in parser for diagnostic Fixes rust-lang/rust#144968 Inspired by https://github.com/rust-lang/rust/issues/144968#issuecomment-3156094581, I implemented `FnContext` to indicate whether a function should have a self parameter, for example, whether the function is a trait method, whether it is in an impl block. And I removed the outdated note. I made two commits to show the difference. cc ``@estebank`` ``@djc`` r? compiler
2025-08-15Rollup merge of #145369 - estebank:issue-145367, r=compiler-errorsStuart Cook-3/+3
Do not ICE on private type in field of unresolved struct Fix rust-lang/rust#145367.
2025-08-15Rollup merge of #145322 - LorrensP-2158466:early-prelude-processing, ↵Stuart Cook-24/+19
r=petrochenkov Resolve the prelude import in `build_reduced_graph` This pr tries to resolve the prelude import at the `build_reduced_graph` stage. Part of batched import resolution in rust-lang/rust#145108 (cherry picked commit) and maybe needed for rust-lang/rust#139493. r? petrochenkov
2025-08-15Rollup merge of #145275 - StackOverflowExcept1on:fix-wasm32v1-none, ↵Stuart Cook-1/+16
r=alexcrichton fix(compiler/rustc_codegen_llvm): apply `target-cpu` attribute Resolves rust-lang/rust#140174 r? ```@alexcrichton``` try-job: `test-various*`
2025-08-15Rollup merge of #145235 - compiler-errors:comment, r=BoxyUwUStuart Cook-61/+2
Minor `[const]` tweaks Self explanatory
2025-08-15Rollup merge of #145120 - maurer:llvm-time, r=nikicStuart Cook-1/+5
llvm: Accept new LLVM lifetime format In llvm/llvm-project#150248 LLVM removed the size parameter from the lifetime format. Tolerate not having that size parameter.
2025-08-15Rollup merge of #145065 - petrochenkov:riblock, r=davidtwcoStuart Cook-91/+78
resolve: Introduce `RibKind::Block` to avoid confusing module items, blocks with items, and blocks without items. Addresses https://github.com/rust-lang/rust/pull/143141#discussion_r2254893953 and https://github.com/rust-lang/rust/pull/143141#discussion_r2258004452. A couple of related cleanups are also added on top.
2025-08-15Rollup merge of #145012 - Kivooeo:fun-problem-fun-fix, r=compiler-errorsStuart Cook-1/+10
Tail call diagnostics to include lifetime info Fixes https://github.com/rust-lang/rust/issues/144957 r? ```@WaffleLapkin``` ```@compiler-errors```
2025-08-15Rollup merge of #145005 - tardyp:lto_big_filesize, r=bjorn3Stuart Cook-2/+21
strip prefix of temporary file names when it exceeds filesystem name length limit When doing lto, rustc generates filenames that are concatenating many information. In the case of this testcase, it is concatenating crate name and rust file name, plus some hash, and the extension. In some other cases it will concatenate even more information reducing the maximum effective crate name to about 110 chars on linux filesystems where filename max length is 255 This commit is ensuring that the temporary file names are limited in size, while still reasonably ensuring the unicity (with hashing of the stripped part) Fix: rust-lang/rust#49914
2025-08-15Rollup merge of #145004 - bjorn3:remove_unused_fields, r=WaffleLapkinStuart Cook-51/+37
Couple of minor cleanups
2025-08-15Rollup merge of #144944 - He1pa:E0793, r=compiler-errorsStuart Cook-1/+33
E0793: Clarify that it applies to unions as well pick up inactive PR: https://github.com/rust-lang/rust/pull/131472 Also: Adjust the language slightly to be more consistent with other similar messages (was created instead of got created). Add a short section on union. Add an example line showing referencing a field in a packed struct is safe if the field's type isn't more strictly aligned than the pack. r? compiler-errors
2025-08-15Rollup merge of #144865 - WaffleLapkin:track-tail, r=lqdStuart Cook-7/+91
Fix tail calls to `#[track_caller]` functions We want `#[track_caller]` to be semver independent, i.e. it should not be a breaking change to add or remove it. Since it changes ABI of a function (adding an additional argument) we have to be careful to preserve this property when adding tail calls. The only way to achieve this that I can see is: - we forbid tail calls in functions which are marked with `#[track_caller]` (already implemented) - tail-calling a `#[track_caller]` marked function downgrades the tail-call to a normal call (or equivalently tail-calls the shim made by fn def to fn ptr cast) (this pr) Ideally the downgrade would be performed by a MIR pass, but that requires post mono MIR opts (cc ```@saethlin,``` rust-lang/rust#131650). For now I've changed code in cg_ssa to accomodate this behaviour (+ added a hack to mono collector so that the shim is actually generated) Additionally I added a lint, although I don't think it's strictly necessary. Alternative to rust-lang/rust#144762 (and thus closes rust-lang/rust#144762) Fixes https://github.com/rust-lang/rust/issues/144755
2025-08-15Rollup merge of #143075 - workingjubilee:interrupts-may-return-nevermore, ↵Stuart Cook-3/+15
r=davidtwco compiler: Allow `extern "interrupt" fn() -> !` While reviewing rust-lang/rust#142633 I overlooked a few details because I was kind of excited. - Fixes rust-lang/rust#143072
2025-08-15Rollup merge of #142640 - Sa4dUs:ad-intrinsic, r=ZuseZ4Stuart Cook-920/+468
Implement autodiff using intrinsics This PR aims to move autodiff logic to `autodiff` intrinsic. Allowing us to delete a great part of our frontend code and overall, simplify the compilation pipeline of autodiff functions.
2025-08-15Rollup merge of #122661 - estebank:assert-macro-span, r=petrochenkovStuart Cook-18/+57
Change the desugaring of `assert!` for better error output In the desugaring of `assert!`, we now expand to a `match` expression instead of `if !cond {..}`. The span of incorrect conditions will point only at the expression, and not the whole `assert!` invocation. ``` error[E0308]: mismatched types --> $DIR/issue-14091.rs:2:13 | LL | assert!(1,1); | ^ expected `bool`, found integer ``` We no longer mention the expression needing to implement the `Not` trait. ``` error[E0308]: mismatched types --> $DIR/issue-14091-2.rs:15:13 | LL | assert!(x, x); | ^ expected `bool`, found `BytePos` ``` Now `assert!(val)` desugars to: ```rust match val { true => {}, _ => $crate::panic::panic_2021!(), } ``` Fix #122159.
2025-08-15Auto merge of #144591 - RalfJung:pattern-valtrees, r=BoxyUwUbors-173/+144
Patterns: represent constants as valtrees Const patterns are always valtrees now. Let's represent that in the types. We use `ty::Value` for this since it nicely packages value and type, and has some convenient methods. Cc `@Nadrieril` `@BoxyUwU`
2025-08-14Auto merge of #145407 - Kobzol:rollup-g6yhx82, r=Kobzolbors-57/+67
Rollup of 11 pull requests Successful merges: - rust-lang/rust#137872 (Include whitespace in "remove |" suggestion and make it hidden) - rust-lang/rust#144631 (Fix test intrinsic-raw_eq-const-bad for big-endian) - rust-lang/rust#145233 (cfg_select: Support unbraced expressions) - rust-lang/rust#145261 (Improve tracing in bootstrap) - rust-lang/rust#145324 (Rename and document `ONLY_HOSTS` in bootstrap) - rust-lang/rust#145353 (bootstrap: Fix jemalloc 64K page support for aarch64 tools) - rust-lang/rust#145379 (bootstrap: Support passing `--timings` to cargo) - rust-lang/rust#145397 (Rust documentation, use `rustc-dev-guide` :3) - rust-lang/rust#145398 (Use `default_field_values` in `Resolver`) - rust-lang/rust#145401 (cleanup: Remove useless `[T].iter().last()`) - rust-lang/rust#145403 (Adjust error message grammar to be less awkward) r? `@ghost` `@rustbot` modify labels: rollup
2025-08-14Deduplicate `-L` paths passed to rustcJakub Beránek-10/+21
2025-08-14Rollup merge of #145403 - shepmaster:grammar, r=estebankJakub Beránek-1/+1
Adjust error message grammar to be less awkward r? ``@estebank``
2025-08-14Rollup merge of #145401 - estebank:remove-useless-iter, r=compiler-errorsJakub Beránek-2/+2
cleanup: Remove useless `[T].iter().last()`
2025-08-14Rollup merge of #145398 - estebank:use-default-fields-resolver, r=petrochenkovJakub Beránek-30/+17
Use `default_field_values` in `Resolver` Change `Resolver` to use `feature(default_field_values)`. This change is non-exhaustive, as fields may have been added since I made this commit, and `Fx(Index/Hash)(Map/Set)` types would need to have a `const` constructable to change the majority of the fields left over. Using default field values should make it easier to review when we add or remove fields to `Resolver` in the future, and highlight which fields are run-time dependent in `Resolver::new`. r? ``@petrochenkov``
2025-08-14Rollup merge of #145233 - joshtriplett:cfg-select-expr, r=jieyouxuJakub Beránek-11/+19
cfg_select: Support unbraced expressions Tracking issue for `cfg_select`: rust-lang/rust#115585 When operating on expressions, `cfg_select!` can now handle expressions without braces. (It still requires braces for other things, such as items.) Expand the test coverage and documentation accordingly. --- I'm not sure whether deciding to extend `cfg_select!` in this way is T-lang or T-libs-api. I've labeled for both, with the request that both teams don't block on each other. :)
2025-08-14Rollup merge of #137872 - estebank:extra-vert, r=compiler-errorsJakub Beránek-13/+28
Include whitespace in "remove |" suggestion and make it hidden Tweak error rendering of patterns with an extra `|` on either end. Built on #137409. Only last commit is relevant. ? ``@compiler-errors``
2025-08-14Auto merge of #145085 - JonathanBrouwer:target_checking, r=jdonszelmannbors-1403/+993
Rework target checking for built-in attributes This is a refactoring of target checking for built-in attributes. This PR has the following goals: - Only refactor the 80% of the attributes that are simple to target check. More complicated ones like `#[repr]` will be in a future PR. Tho I have written the code in such a way that this will be possible to add in the future. - No breaking changes. - This part of the codebase is not very well tested though, we can do a crater run if we want to be sure. - I've spotted quite a few weird situations (like I don't think an impl block should be deprecated?). We can propose fixing these to in a future PR Fixes https://github.com/rust-lang/rust/issues/143780 Fixes https://github.com/rust-lang/rust/issues/138510 I've split it in commits and left a description on some of the commits to help review. r? `@jdonszelmann`
2025-08-14drive-by: fix typoWaffle Lapkin-1/+1
2025-08-14fixed diagnosticKivooeo-1/+10
2025-08-14Adjust error message grammar to be less awkwardJake Goulding-1/+1
2025-08-14Remove lto inline logicMarcelo Domínguez-79/+1
2025-08-14Remove inlining for autodiff handlingMarcelo Domínguez-19/+21
2025-08-14Complete functionality and general cleanupMarcelo Domínguez-794/+383
2025-08-14Basic implementation of `autodiff` intrinsicMarcelo Domínguez-245/+280
2025-08-14cleanup: Remove useless `[T].iter().last()`Esteban Küber-2/+2
2025-08-14Remove the old target checking logicJonathan Brouwer-1310/+138
2025-08-14Specify the list of allowed targets per attributeJonathan Brouwer-44/+361
2025-08-14Allow attribute parsers to specify a list of allowed targetsJonathan Brouwer-13/+303
Every acceptor gets an `ALLOWED_TARGETS` specification which can specify per target whether it is allowed, warned, or errored.
2025-08-14Pass the target type down to `parse_attribute_list`Jonathan Brouwer-25/+48
2025-08-14Improved `Target` typeJonathan Brouwer-11/+143
- Added a few more variants which are needed for various attributes - Previously a trait method with default block had the same target representation as a method in a `impl trait for` block, this has been changed (See `MethodKind`) - Added `plural_name` for more precision on the form of the name
2025-08-14Do not ICE on private type in field of unresolved structEsteban Küber-3/+3
2025-08-14resolve: Restructure `resolve_ident_in_lexical_scope` for better clarityVadim Petrochenkov-42/+37
2025-08-14resolve: Inline `with_mod_rib`Vadim Petrochenkov-26/+18
2025-08-14resolve: Introduce `RibKind::Block`Vadim Petrochenkov-24/+24
to avoid confusing module items, blocks with items, and blocks without items.
2025-08-14Use `default_field_values` in `Resolver`Esteban Küber-30/+17
2025-08-14Auto merge of #144542 - sayantn:stabilize-sse4a-tbm, r=Amanieu,traviscrossbors-4/+6
Stabilize `sse4a` and `tbm` target features This PR stabilizes the feature flag `sse4a_target_feature` and `tbm_target_feature` (tracking issue rust-lang/rust#44839). # Public API The 2 `x86` target features `sse4a` and `tbm` Also, these were added in LLVM2.6 and LLVM3.4-rc1, respectively, and as the minimum LLVM required for rustc is LLVM19, we are safe in that front too! As all of the required tasks have been done (adding the target features to rustc, implementing their runtime detection in std_detect and implementing the associated intrinsics in core_arch), these target features can be stabilized now. The intrinsics were stabilized *long* ago, in 1.27.0 Reference PR: - https://github.com/rust-lang/reference/pull/1949 cc `@rust-lang/lang` `@rustbot` label I-lang-nominated r? lang
2025-08-14Add FnContext in parser for diagnosticxizheyin-34/+94
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-08-14resolve prelude import at `build_reduced_graph` phaseLorrensP-2158466-24/+19