about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-03-25Avoid some more global stateOli Scherer-22/+35
2025-03-25acquire more accurate HirId for ABI check lintsRalf Jung-19/+37
2025-03-25Track whether an assoc item is in a trait impl or an inherent implOli Scherer-67/+149
2025-03-25Deduplicate assoc item cfg handlingOli Scherer-10/+3
2025-03-25privacy: Visit types and traits in impls in type privacy lintsVadim Petrochenkov-9/+31
2025-03-25make -Zwasm-c-abi=legacy suppress the lintRalf Jung-10/+15
2025-03-25add FCW to warn about wasm ABI transitionRalf Jung-12/+133
2025-03-25Use `sym::dummy` for a dummy arg in `parse_fn_params`.Nicholas Nethercote-1/+1
2025-03-25Auto merge of #136410 - saethlin:clean-up-cgu-internal-copy, r=compiler-errorsbors-64/+68
Remove InstanceKind::generates_cgu_internal_copy This PR should not contain any behavior changes. Before this PR, the logic for selecting instantiation mode is spread across all of * `instantiation_mode` * `cross_crate_inlinable` * `generates_cgu_internal_copy` * `requires_inline` The last two of those functions are not well-designed. The function that actually decides if we generate a CGU-internal copy is `instantiation_mode`, _not_ `generates_cgu_internal_copy`. The function `requires_inline` documents that it is about the LLVM `inline` attribute and that it is a hint. The LLVM attribute is called `inlinehint`, this function is also used by other codegen backends, and since it is part of instantiation mode selection it is *not* a hint. The goal of this PR is to start cleaning up the logic into a sequence of checks that have a more logical flow and are easier to customize in the future (to do things like improve incrementality or improve optimizations without causing obscure linker errors because you forgot to update another part of the compiler).
2025-03-25Rollup merge of #138895 - oli-obk:dedup-owner-id-creation, r=compiler-errorsTakayuki Maeda-16/+17
Add a helper for building an owner id in ast lowering Just some deduplication of owner-id creations. Will also help me later split up ast lowering into per-owner queries, as it won't be possible anymore to go from a NodeId to a DefId of an owner without doing extra work to check whether we have an owner id. So I'd just do that in the new `owner_id` function and keep the `local_def_id` function free of that logic
2025-03-25Rollup merge of #138838 - compiler-errors:new-solver-crashes-tweaks, r=lcnrTakayuki Maeda-13/+11
Fix/tweak some tests in new solver Bunch of miscellaneous new solver tweaks that I found from the failing tests. Can split these out, but they all seemed small enough to not warrant separate PRs. r? lcnr
2025-03-25Rollup merge of #138837 - petrochenkov:resinstab2, r=jieyouxuTakayuki Maeda-12/+6
resolve: Avoid remaining unstable iteration Continuation of #138580. This should be the performance sensitive part.
2025-03-25Rollup merge of #138701 - tvladyslav:serializable_default_codegen_backend, ↵Takayuki Maeda-0/+8
r=workingjubilee Make default_codegen_backend serializable This PR makes default_codegen_backend serializable.
2025-03-25Rollup merge of #138580 - petrochenkov:resinstab, r=NadrierilTakayuki Maeda-14/+9
resolve: Avoid some unstable iteration 2 Continuation of https://github.com/rust-lang/rust/pull/138502.
2025-03-25Rollup merge of #138385 - nnethercote:keyword-tweaks, r=NoratriebTakayuki Maeda-36/+33
Keyword tweaks r? ```@Noratrieb```
2025-03-25Avoid `kw::Empty` when dealing with `rustc_allowed_through_unstable_modules`.Nicholas Nethercote-7/+3
The existing code produces `Some(kw::Empty)` for these invalid forms: - a non-name-value, e.g. `#[rustc_allowed_through_unstable_modules]` - a non-string arg, e.g. `#[rustc_allowed_through_unstable_modules = 3]` The new code avoids the `kw::Empty` and is a little shorter. It will produce `None` in those cases, which means E0789 won't be produced if the `stable` attribute is missing for these invalid forms. This doesn't matter, because these invalid forms will trigger an "malformed `rustc_allowed_through_unstable_modules` attribute" anyway.
2025-03-25Reduce visibility of most items in `rustc_codegen_llvm`Daniel Paoliello-136/+144
2025-03-25Use `Option<Symbol>` in `DuplicateLangItem`.Nicholas Nethercote-14/+20
For the the symbols that might not be present, instead of `kw::Empty`.
2025-03-25Use `Option<Symbol>` in `ModuleKind::Def`.Nicholas Nethercote-18/+20
This way, `None` represents "crate root without a name" instead of `kw::Empty`. This changes makes it impossible to forget to handle the exceptional case.
2025-03-25Use `Option<Symbol>` in `panic_call`.Nicholas Nethercote-5/+8
Instead of `kw::Empty`. It makes it clearer that this is a name that is searched for and might not be found.
2025-03-25Use `Ident::dummy()` in `dummy_annotatable`.Nicholas Nethercote-1/+1
This is exactly the kind of case `Ident::dummy()` is for.
2025-03-25Auto merge of #138634 - saethlin:repeated-uninit, r=scottmcm,oli-obkbors-4/+45
Lower to a memset(undef) when Rvalue::Repeat repeats uninit Fixes https://github.com/rust-lang/rust/issues/138625. It is technically correct to just do nothing. But if we actually do nothing, we may miss that this is de-initializing something, so instead we just lower to a single memset that writes undef. This is still superior to the memcpy loop, in both quality of code we hand to the backend and LLVM's final output.
2025-03-24Remove InstanceKind::generates_cgu_internal_copyBen Kimock-64/+68
2025-03-24Instantiate binder before registering nested obligations for auto/built-in ↵Michael Goulet-32/+16
traits
2025-03-24Auto merge of #133984 - DaniPopes:scmp-ucmp, r=scottmcmbors-0/+57
Lower BinOp::Cmp to llvm.{s,u}cmp.* intrinsics Lowers `mir::BinOp::Cmp` (`three_way_compare` intrinsic) to the corresponding LLVM `llvm.{s,u}cmp.i8.*` intrinsics. These are the intrinsics mentioned in https://github.com/rust-lang/rust/pull/118310, which are now available in LLVM 19. I couldn't find any follow-up PRs/discussions about this, please let me know if I missed something. r? `@scottmcm`
2025-03-24Reject test executables when not supported by targetThalia Archibald-0/+7
Currently, compiling tests for SOLID produces an ICE, because SOLID does not support executables.
2025-03-25rustc_session: Add a helper function for obtaining staticlib prefix and suffixVadim Petrochenkov-24/+24
2025-03-25linker: Avoid calling `linker_and_flavor` twiceVadim Petrochenkov-6/+9
2025-03-25linker: Fix staticlib naming for UEFIVadim Petrochenkov-4/+13
It uses `libname.a` instead of the standard MSVC naming `name.lib`. Naming for import libraries isn't touched.
2025-03-24resolve: Avoid some unstable iteration 2Vadim Petrochenkov-14/+9
2025-03-24Rollup merge of #138882 - oli-obk:ast-lowering-mod-rib, r=fee1-deadMatthias Krüger-14/+11
`with_scope` is only ever used for ast modules Thus I renamed it to match other similar functions (`with_mod_rib`) and made it panic if used on non-modules
2025-03-24Rollup merge of #138868 - mejrs:d_not_recommend_typo, r=davidtwcoMatthias Krüger-7/+7
Add do_not_recommend typo help
2025-03-24Rollup merge of #138821 - dianne:cleanup-non-scalar-compare, r=oli-obkMatthias Krüger-94/+24
match lowering cleanup: remove unused unsizing logic from `non_scalar_compare` Since array and slice constants are now translated to array and slice patterns, `non_scalar_compare` is only used for string comparisons. This specializes it to strings, renames it, and removes the unused array-unsizing logic. This also updates the doc comments for `thir::PatKind::Constant` and `TestKind::Eq`, which referred to them being used for slice references. r? ````@oli-obk````
2025-03-24Emit `unused_attributes` for `#[inline]` on exported functionsNoratrieb-0/+29
I saw someone post a code sample that contained these two attributes, which immediately made me suspicious. My suspicions were confirmed when I did a small test and checked the compiler source code to confirm that in these cases, `#[inline]` is indeed ignored (because you can't exactly `LocalCopy`an unmangled symbol since that would lead to duplicate symbols, and doing a mix of an unmangled `GloballyShared` and mangled `LocalCopy` instantiation is too complicated for our current instatiation mode logic, which I don't want to change right now). So instead, emit the usual unused attribute lint with a message saying that the attribute is ignored in this position. I think this is not 100% true, since I expect LLVM `inlinehint` to still be applied to such a function, but that's not why people use this attribute, they use it for the `LocalCopy` instantiation mode, where it doesn't work.
2025-03-24Remove fields that are dead since the removal of type ascription syntaxLeón Orell Valerian Liehr-63/+13
Since `{ ident: ident }` is a parse error, these fields are dead.
2025-03-24Remove `prev_index_to_index` field from `CurrentDepGraph`John Kåre Alsaker-185/+144
2025-03-24Don't ICE when encountering placeholders in layout computationMichael Goulet-6/+2
2025-03-24Allow WellFormed goals to be returned from relating in new solverMichael Goulet-7/+9
2025-03-24Revert "Rollup merge of #136127 - WaffleLapkin:dyn_ptr_unwrap_cast, ↵Michael Goulet-60/+8
r=compiler-errors" This reverts commit 84c2050bf63f734246572345aedca9edb2abe96e, reversing changes made to a96fa317d78c78a9de996afd317603c6970efc0d.
2025-03-24bump thorin to drop duped depsklensy-2/+2
2025-03-24Add a helper for building an owner id in ast loweringOli Scherer-16/+17
2025-03-24Auto merge of #138629 - Zoxc:graph-anon-hashmap, r=oli-obkbors-62/+155
Only use the new node hashmap for anonymous nodes This is a rebase of https://github.com/rust-lang/rust/pull/112469. cc `@cjgillot`
2025-03-24Fix autofix for `self` and `self as …` in `unused_imports` lintSamuel Tardieu-1/+2
This fixes two problems with the autofixes for the `unused_imports` lint: - `use std::collections::{HashMap, self as coll};` would suggest, when `HashMap` is unused, the incorrect `use std::collections::self as coll;` which does not compile. - `use std::borrow::{self, Cow};` would suggest, when `self` is unused, `use std::borrow::{Cow};`, which contains unnecessary brackets.
2025-03-24Auto merge of #115747 - Zoxc:query-hashes, r=oli-obkbors-30/+47
Optimize hash map operations in the query system This optimizes hash map operations in the query system by explicitly passing hashes and using more optimal operations. `find_or_find_insert_slot` in particular saves a hash table lookup over `entry`. It's not yet available in a safe API, but will be in https://github.com/rust-lang/hashbrown/pull/466. <table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.6189s</td><td align="right">1.6129s</td><td align="right"> -0.37%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2353s</td><td align="right">0.2337s</td><td align="right"> -0.67%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9344s</td><td align="right">0.9289s</td><td align="right"> -0.59%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.4693s</td><td align="right">1.4652s</td><td align="right"> -0.28%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">5.6606s</td><td align="right">5.6439s</td><td align="right"> -0.30%</td></tr><tr><td>Total</td><td align="right">9.9185s</td><td align="right">9.8846s</td><td align="right"> -0.34%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9956s</td><td align="right"> -0.44%</td></tr></table> r? `@cjgillot`
2025-03-24`with_scope` is only ever used for ast modulesOli Scherer-14/+11
2025-03-24Move `is_used_keyword_conditional`.Nicholas Nethercote-4/+4
So the order of the `Symbol::is_*` predicates match the order of the keywords list.
2025-03-24Alphabetize the keywords list.Nicholas Nethercote-8/+21
2025-03-24Fix some formatting.Nicholas Nethercote-2/+2
2025-03-24Improve keyword comments a little.Nicholas Nethercote-5/+4
2025-03-24Remove `is_any_keyword` methods.Nicholas Nethercote-22/+7
They're dodgy, covering all the keywords, including weak ones, and edition-specific ones without considering the edition. They have a single use in rustfmt. This commit changes that use to `is_reserved_ident`, which is a much more widely used alternative and is good enough, judging by the lack of effect on the test suite.