about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-05-02Rename parameter to `override_def_path_data`John Kåre Alsaker-4/+5
2025-05-02Use less rustc_type_ir in the compiler codebaseRomain Perier-33/+30
This commit does the following: - Replaces use of rustc_type_ir by rustc_middle in rustc_infer. - The DelayedMap type is exposed by rustc_middle so everything can be accessed through rustc_middle in a coherent manner. - API-layer traits, like InferCtxtLike, Interner or inherent::* must be accessed via rustc_type_ir, not rustc_middle::ty. For this reason these are not reexported by rustc_middle::ty. - Replaces use of ty::Interner by rustc_type_ir::Interner in rustc_trait_selection
2025-05-02Add useful comments on `ExprKind::If` variants.Nicholas Nethercote-0/+9
Things that aren't obvious and took me a while to work out.
2025-05-02Handle `Path<>` better in error messages.Nicholas Nethercote-27/+42
`Path<>` needs to be distinguished from `Path<T>`. This commit does that, improving some error messages.
2025-05-01Rollup merge of #140552 - ↵Guillaume Gomez-0/+1
folkertdev:naked-function-rustc_std_internal_symbol, r=bjorn3 allow `#[rustc_std_internal_symbol]` in combination with `#[naked]` The need for this came up in https://github.com/rust-lang/compiler-builtins/pull/897, but in general this seems useful and valid to allow. Based on a quick scan, I don't think changes to the generated assembly are needed. cc ``@bjorn3``
2025-05-01Rollup merge of #140544 - m-ou-se:format-args-const-cleanup, r=fee1-deadGuillaume Gomez-2/+2
Clean up "const" situation in format_args!(). This cleans up the "const" situation in the format_args!() expansion/lowering. Rather than marking the Argument::new_display etc. functions as non-const, this marks the Arguments::new_v1 functions as non-const. Example expansion/lowering of format_args!() in const: ```rust // Error: cannot call non-const formatting macro in constant functions const { fmt::Arguments::new_v1( // Now the error is produced here. &["Hello, ", "!\n"], &[ fmt::Argument::new_display(&world) // The error used to be produced here. ], ) } ```
2025-05-01Rollup merge of #140460 - heiher:issue-140455, r=UrgauGuillaume Gomez-0/+9
Fix handling of LoongArch target features not supported by LLVM 19 Fixes #140455
2025-05-01Rollup merge of #138703 - pudongair:master, r=workingjubileeGuillaume Gomez-1/+1
chore: remove redundant words in comment remove redundant words in comment
2025-05-01Set groundwork for proper const normalizationBoxy-218/+364
2025-05-01PassWrapper: adapt for ↵Erick Tryzelaar-0/+5
llvm/llvm-project@f137c3d592e96330e450a8fd63ef7e8877fc1908 In LLVM 21 PR https://github.com/llvm/llvm-project/pull/130940 `TargetRegistry::createTargetMachine` was changed to take a `const Triple&` and has deprecated the old `StringRef` method. @rustbot label llvm-main
2025-05-01Auto merge of #139965 - amandasystems:marginally-improved-scc-annotations, ↵bors-171/+239
r=lcnr Decouple SCC annotations from SCCs This rewires SCC annotations to have them be a separate, visitor-type data structure. It was broken out of #130227, which needed them to be able to remove unused annotations after computation without recomputing the SCCs themselves. As a drive-by it also removes some redundant code from the hot loop in SCC construction for a performance improvement. r? lcnr
2025-05-01allow `#[rustc_std_internal_symbol]` in combination with `#[naked]`Folkert de Vries-0/+1
2025-05-01No-op split into sub functionsBoxy-164/+162
2025-05-01User type annotations for free consts in pattern positionBoxy-2/+1
2025-05-01Auto merge of #138522 - osiewicz:shared-generics-respect-visibility, r=bjorn3bors-12/+59
shared-generics: Do not share instantiations that contain local-only types In Zed shared-generics loading takes up a significant chunk of time in incremental build, as rustc deserializes rmeta of all dependencies of a crate. I've recently realized that shared-generics includes all instantiations of some_generic_function in the following snippet: ```rs pub fn some_generic_function(_: impl Fn()) {} pub fn non_generic_function() { some_generic_function(|| {}); some_generic_function(|| {}); some_generic_function(|| {}); some_generic_function(|| {}); some_generic_function(|| {}); some_generic_function(|| {}); some_generic_function(|| {}); } ``` even though none of these instantiations can actually be created from outside of `non_generic_function`. This is a dummy example, but we do rely on invoking callbacks with FnOnce a lot in our codebase. This PR makes shared-generics account for visibilities of generic arguments; an item is only considered for exporting if it is reachable from the outside or if all of it's arguments are visible outside of the local crate. This PR reduces incremental build time for Zed (touch editor.rs scenario) from 12.4s to 10.4s. I'd love to see a perf run if possible; per my checks this PR does not incur new instantiations in downstream crates, so if there'd be perf regressions, I'd expect them to come from newly-introduced visibility checks.
2025-05-01Clean up "const" situation in format_args!().Mara Bos-2/+2
Rather than marking the Argument::new_display etc. functions as non-const, this marks the Arguments::new_v1 functions as non-const.
2025-05-01Add some commentsJohn Kåre Alsaker-1/+3
2025-05-01Use thread local dep graph encodingJohn Kåre Alsaker-183/+288
2025-05-01rustc_target: RISC-V "Zfinx" is incompatible with {ILP32,LP64}[FD] ABIsTsukasa OI-4/+4
Because RISC-V Calling Conventions note that: > This means code targeting the Zfinx extension always uses the ILP32, > ILP32E or LP64 integer calling-convention only ABIs as there is no > dedicated hardware floating-point register file. {ILP32,LP64}[FD] ABIs with hardware floating-point calling conventions are incompatible with the "Zfinx" extension. This commit adds "zfinx" to the incompatible feature list to those ABIs and tests whether trying to add "zdinx" (that is analogous to "zfinx" but in double-precision) on a LP64D ABI configuration results in an error (it also tests extension implication; "Zdinx" requires "Zfinx" extension). Link: RISC-V psABI specification version 1.0 <https://github.com/riscv-non-isa/riscv-elf-psabi-doc/releases/tag/v1.0>
2025-05-01Auto merge of #140145 - Zoxc:job-server-proxy, r=SparrowLiibors-29/+156
Add a jobserver proxy to ensure at least one token is always held This adds a jobserver proxy to ensure at least one token is always held by `rustc`. Currently with `-Z threads` `rustc` can temporarily give up all its tokens, causing `cargo` to spawn additional `rustc` instances beyond the job limit. The current behavior causes an issue with `cargo fix` which has a global lock preventing concurrent `rustc` instances, but it also holds a jobserver token, causing a deadlock when `rustc` gives up its token. That is fixed by this PR. Fixes https://github.com/rust-lang/rust/issues/67385. Fixes https://github.com/rust-lang/rust/issues/133873. Fixes https://github.com/rust-lang/rust/issues/140093.
2025-05-01rustc_target: RISC-V: Add BF16 extensionsTsukasa OI-0/+3
This commit adds three ratified unprivileged RISC-V extensions related to BFloat16 (BF16) handling. Although that they are far from stabilization due to ABI issues, they are optional extensions of the RVA23U64 profile (application-class processor profile) and going to be discoverable from the Linux kernel (as of version 6.15-rc4). This commit mainly prepares runtime detection of those extensions.
2025-05-01rustc_target: RISC-V: Add atomics/memory-related extensionsTsukasa OI-0/+7
This commit adds a part of RISC-V extensions that are mandatory part of the RVA23U64 profile (application-class processor profile) and related to memory/atomic constraints. The Zic64b extension constrains the cache line to naturally-aligned 64 bytes that would make certain memory operations (like zeroing the memory using the Zicboz extension) easier. The Zicbom and Zicbop extensions enable managing cache block-based operations (the Zicbop contains hints that will work as a NOP when this extension is absent and the Zicbom contains control instructions). Of which, the Zicbom extension is going to be discoverable from the Linux kernel (as of the version 6.15-rc4) and this commit prepares for corresponding stdarch changes. The Zicc* extensions add certain constraints to "the main memory" (usually true on the user mode application on the application-class processor but those extensions make sure such constraints exist).
2025-05-01rustc_target: Adjust RISC-V feature implication (Za64rs and Za128rs)Tsukasa OI-1/+1
The Za64rs extension (reservation set -- a primitive memory unit of LR/SC atomic operations -- is naturally aligned and *at most* 64 bytes) is a superset of the Za128rs extension (*at most* 128 bytes; note that smaller the reservation set is, more fine grained control over atomics). This commit handles this as a feature implication.
2025-05-01Remove `avx512dq` and `avx512vl` implication for `avx512fp16`Sayantan Chakraborty-1/+1
2025-04-30Auto merge of #121909 - Zoxc:drop-ast-task, r=petrochenkovbors-3/+26
Drop AST on a separate thread and prefetch `hir_crate` This drop AST on a separate thread and prefetches `hir_crate`. A `spawn` function is added to the `parallel` module which spawn some work on the Rayon thread pool.
2025-04-30Change rustc_driver dependency on stable_mir crateCelina G. Val-2/+12
This fixes issues with RustAnalyzer not finding stable_mir crate. It is also part of the long term architecture plan for these crates, since we are moving towards having stable_mir depend on rustc_smir and not the other way around. I believe this is an utility function that will come handy eventually for stable_mir users, but I'm keeping it as part of rustc_internal since it initializes the StableMir context and requires `TyCtxt`. Finally, I added the rustc_internal crate under a feature since the APIs from this module shall not be stabilized.
2025-04-30Rollup merge of #140494 - ehuss:document-restrictions, r=traviscross,SparrowLiiMatthias Krüger-0/+49
Parser: Document restrictions I had trouble easily understanding what these various flags do. This is my attempt to try to explain what these do.
2025-04-30Rollup merge of #140468 - BoxyUwU:normalization_confusings2, r=lcnrMatthias Krüger-52/+56
Minor tweaks to make some normalization (adjacent) code less confusing r? lcnr sorry for double ping lol
2025-04-30Rollup merge of #140467 - BoxyUwU:no_fcw_assoc_consts, r=lcnrMatthias Krüger-9/+10
Don't FCW assoc consts in patterns Fixes #140447 See comment in added test. We could also check that the anon const is a const arg by looking at the HIR. I'm not sure that's necessary though :thinking: The only consts that are evaluated "for the type system" are const args (which *should* get FCWs) and const patterns (which cant be anon consts afaik).
2025-04-30Rollup merge of #140458 - azhogin:azhogin/async-drop-fix-dropped-tuple-ice, ↵Matthias Krüger-9/+15
r=oli-obk Fix for async drop ice with partly dropped tuple Fixes https://github.com/rust-lang/rust/issues/140427. Problem was with block data access with block id from new added blocks in patch.
2025-04-30Use select in projection lookupMichael Goulet-20/+22
2025-04-30interpret: better error message for out-of-bounds pointer arithmetic and ↵Ralf Jung-75/+64
accesses
2025-04-30Optimize the codegen for `Span::from_expansion`Jason Newcomb-2/+15
2025-04-30Rollup merge of #140516 - rperier:type-ir-to-type-middle, r=lcnrMatthias Krüger-26/+21
Replace use of rustc_type_ir by rustc_middle cc #138449 I want to help on this issue. I have replaced all the rustc_type_ir uses by the equivalent type in rustc_middle. DelayedSet is also re-exposed by rustc_middle.
2025-04-30Rollup merge of #140504 - tmiasko:answer-ensure-stack, r=jswrennMatthias Krüger-455/+284
transmutability: ensure_sufficient_stack when answering query Based on #140380. Fixes #118860. The compile time was addressed earlier, this merely addresses stack overflow part of the issue. r? `@jswrenn` `@joshlf`
2025-04-30Rollup merge of #140498 - compiler-errors:check-fn-tweaks, r=oli-obkMatthias Krüger-139/+91
Misc tweaks to HIR typeck (mostly w.r.t. checking calls) Just some cleanups. r? oli-obk
2025-04-30Rollup merge of #140450 - petrochenkov:vistok, r=nnethercoteMatthias Krüger-214/+32
ast: Remove token visiting from AST visitor It's no longer necessary after the removal of nonterminal tokens in #124141. r? `@nnethercote`
2025-04-30Rollup merge of #140203 - Wyliodrin:error_for_no_mangle_weak_language_items, ↵Matthias Krüger-0/+30
r=bjorn3 Issue an error when using `no_mangle` on language items This pull requests adds the code to issue an error or a warning when using `no_mangle` on language items. This should detail why the `undefined symbol` error is issued for the code described in #139923. The pull request adds two ui tests, one testing the error and the other one the warning. I would love some feedback here, as I am not sure that the error and warning are issues using the right API.
2025-04-30Rollup merge of #140090 - Urgau:snake_case-fn-var, r=petrochenkovMatthias Krüger-0/+10
Check bare function idents for non snake-case name This PR adds the check required to lint on bare function idents for non snake-case name. Reported at #140089. cc `@theemathas`
2025-04-30Rollup merge of #134232 - bjorn3:naked_asm_improvements, r=wesleywiserMatthias Krüger-397/+333
Share the naked asm impl between cg_ssa and cg_clif This was introduced in https://github.com/rust-lang/rust/pull/128004.
2025-04-30Use less rustc_type_ir in the compiler codebaseRomain Perier-26/+21
This commit does the following: - Replaces use of rustc_type_ir by rustc_middle - Removes the rustc_type_ir dependency - The DelayedSet type is exposed by rustc_middle so everything can be accessed through rustc_middle in a coherent manner.
2025-04-30Fix naked asm symbol name for cg_clif on macOSbjorn3-1/+2
2025-04-30transmutability: merge contiguous runs with a common destinationTomasz Miąsko-7/+19
2025-04-30error when using no_mangle on language itemsAlexandru RADOVICI-0/+30
add suggestion on how to add a panic breakpoint Co-authored-by: Pat Pannuto <pat.pannuto@gmail.com> delete no_mangle from ui/panic-handler/panic-handler-wrong-location test issue an error for the usage of #[no_mangle] on internal language items delete the comments add newline rephrase note Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com> update error not to leak implementation details delete no_mangle_span Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com> delete commented code
2025-04-30transmutability: ensure_sufficient_stack when answering queryTomasz Miąsko-117/+125
2025-04-30Rollup merge of #140448 - Zalathar:query-append, r=compiler-errorsMatthias Krüger-13/+36
Rename `rustc_query_append!` to `rustc_with_all_queries!` Whenever I'm trying to make sense of the query system internals, I always get tripped up on this unhelpfully-named macro. The fact that it's a higher-order proc macro is already mind-melting enough on its own. This new name, `rustc_with_all_queries!`, forms a much more intuitive combination with the helper macros that it invokes. And only one of the call sites was even making use of the “append” part of its old name. This PR also reformats the parameters matched by the helper macros, to make the actual argument syntax a bit easier to see. --- Renaming and reformatting only; no functional changes.
2025-04-30Rollup merge of #140445 - oli-obk:const-manually-drop, r=fee1-deadMatthias Krüger-0/+6
Treat ManuallyDrop as ~const Destruct cc https://github.com/rust-lang/rust/issues/133214#issuecomment-2838078133 r? ```@compiler-errors``` cc ```@fee1-dead```
2025-04-30Rollup merge of #140439 - RalfJung:miri-algebraic-float-nondet, r=oli-obkMatthias Krüger-2/+9
miri: algebraic intrinsics: bring back float non-determinism Fixes https://github.com/rust-lang/miri/issues/4289 Cc ```@bjoernager``` r? ```@oli-obk```
2025-04-30Rollup merge of #140404 - lcnr:canonical-no-type-foldable, r=compiler-errorsMatthias Krüger-26/+4
rm `TypeVistable` impls for `Canonical` similar to `EarlyBinder`, you generally do not want to fold a canonical value directly without first instantiating it. In places where you do want to look into the `Canonical`, it's likely better to do so manually. r? ```@compiler-errors```
2025-04-30Rollup merge of #140312 - nnethercote:DelimArgs-spacing, r=petrochenkovMatthias Krüger-17/+35
Improve pretty-printing of braces r? ````@petrochenkov````