about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-03-06Lower BinOp::Cmp to llvm.{s,u}cmp.* intrinsicsDaniPopes-0/+57
Lowers `mir::BinOp::Cmp` (`three_way_compare` intrinsic) to the corresponding LLVM `llvm.{s,u}cmp.i8.*` intrinsics, added in LLVM 19.
2025-03-06Factor out edge breaking codeTomasz Miąsko-13/+11
2025-03-06fix typolcnr-1/+1
Co-authored-by: Rémy Rakic <remy.rakic+github@gmail.com>
2025-03-06`TypeVerifier` do not walk into required constslcnr-12/+23
2025-03-06expand comments of `TyCtxt` impl of `DynSync`/`DynSend`Rémy Rakic-1/+3
so that it doesn't get removed again
2025-03-06Hide the end of ranges in pretty printing if it's also the maximum of the typeOli Scherer-1/+23
2025-03-06Remove the `Option` part of range ends in the HIROli Scherer-172/+167
2025-03-06`apply_closure_requirement` use `LocalDefId`lcnr-4/+4
2025-03-06Avoid having to handle an `Option` in the type systemOli Scherer-88/+125
2025-03-06Prefer a two value enum over boolOli Scherer-23/+19
2025-03-06Revert "rustc_middle: parallel: TyCtxt: remove "unsafe impl DynSend/DynSync""Rémy Rakic-0/+3
This reverts commit 8eba29ac1015e989e6ba96ff17a75d548afde7ff.
2025-03-06Calculate predecessor count directlyTomasz Miąsko-2/+6
Avoid allocating a vector of small vectors merely to determine how many predecessors each basic block has. Additionally use u8 and saturating operations. The pass only needs to distinguish between [0..1] and [2..].
2025-03-06Remove start block special caseTomasz Miąsko-1/+0
Edges to the start block are invalid. The special case is unnecessary.
2025-03-05compiler: factor Windows x86-32 ABI impl into its own fileJubilee Young-23/+89
While it shares more than zero code with the SysV x86-32 ABI impl, there is no particular reason to organize wildly different ABIs using if-else in the same function.
2025-03-05Use final path segment for diagnosticMichael Goulet-1/+1
2025-03-05Auto merge of #137907 - compiler-errors:inline-fnonce, r=saethlinbors-20/+16
Inline `FnOnce`/`FnMut`/`Fn` shims once again This PR fixes the argument checking for `extern "rust-call"` ABI functions with a spread arg, which do no expect their arguments to be exploded from a tuple like closures do. Secondly, it removes the hack that prevented them from being inlined. This results in more work done by the compiler, but it does end up allowing us to inline functions we didn't before. Fixes #137901
2025-03-05feat: Remove - from xtensa targets cpu namesSergio Gasquez-4/+4
Co-authored-by: MabezDev <scott@mabez.dev>
2025-03-05Revert #138019 after further discussion about adding this exception in ↵Jana Dönszelmann-74/+0
hir-pretty
2025-03-05Simplify `parse_self_param`Frank King-43/+20
2025-03-05Implement `&pin const self` and `&pin mut self` sugarsFrank King-3/+70
2025-03-05Rollup merge of #138028 - workingjubilee:is-rustic-abi, r=compiler-errors许杰友 Jieyou Xu (Joe)-32/+28
compiler: add `ExternAbi::is_rustic_abi` Various parts of the compiler were hand-rolling this extremely simple check that is nonetheless easy to get wrong as the compiler evolves over time. Discourage them from being so "original" again by replacing it with a single implementation on the type that represents these ABIs. This simplifies a surprising amount of code as a result. Also fixes #132981, an ICE that emerged due to other checks being made stricter.
2025-03-05Rollup merge of #137875 - Zalathar:irrefutable, r=Nadrieril许杰友 Jieyou Xu (Joe)-204/+168
mir_build: Integrate "simplification" steps into match-pair-tree creation The “simplification” step helps to prepare THIR patterns for lowering into MIR, and originally dates back to the earliest days of MIR in the compiler. Over time, various intermediate data structures have been introduced (e.g. `MatchPair`, later renamed to `MatchPairTree`) that reduce the need for a separate simplification step, because some of the necessary simplifications can be built into the construction of those intermediate structures instead. This PR continues that process to its logical conclusion and removes the simplification step entirely, by integrating its remaining responsibilities into match-pair-tree creation: flattening “irrefutable” nodes, collecting bindings/ascriptions in flat lists, and sorting or-patterns after other subpatterns. This has a few immediate benefits: - We can remove `TestCase::Irrefutable`, which was not allowed to exist after simplification, and was much larger than other test-case variants. - We can make `MatchPairTree::place` non-optional, because only irrefutable nodes could fail to have a place. In the future, this should also help with some ideas I have for simplifying how `AscribeUserType` and `ExpandedConstant` nodes are handled, by representing them as side-data keyed by THIR pattern ID, so that they are no longer their own kinds of THIR pattern node.
2025-03-05Rollup merge of #137731 - SparrowLii:waiter, r=nnethercote许杰友 Jieyou Xu (Joe)-2/+15
Resume one waiter at once in deadlock handler When multiple query loop errors occur in the code, only one waiter should be resumed at a time to avoid waking up multiple waiters at the same time and causing deadlock due to thread grabbing. This fixes the UI failures in #132051 cc `@Zoxc` `@cjgillot` `@nnethercote` `@bjorn3` `@Kobzol` Zulip discussion [here](https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fwg-parallel-rustc/topic/Deadlocks.20and.20Rayon) Edit: We can't reproduce these bugs with the existing test suits, so we keep them until we merge #132051 UPDATES #129912 UPDATES #120757 UPDATES #129911
2025-03-05Rollup merge of #137728 - Darksonn:no-tuple-unsize, r=oli-obk许杰友 Jieyou Xu (Joe)-125/+7
Remove unsizing coercions for tuples See https://github.com/rust-lang/rust/issues/42877#issuecomment-2686010847 and below comments for justification. Tracking issue: #42877 Fixes: #135217
2025-03-05Rollup merge of #137633 - ↵许杰友 Jieyou Xu (Joe)-246/+99
compiler-errors:no-implied-bounds-hack-unless-bevy, r=lcnr Only use implied bounds hack if bevy, and use deeply normalize in implied bounds hack Consolidates the implied bounds computation mode into a single function, which deeply normalizes, and if it's in **compat** mode (for bevy), it extracts outlives bounds from the infcx. Previously, we were using the implied bounds compat mode in two cases: 1. During WF, if it detects `ParamSet` 2. EVERYWHERE ELSE (lol) -- e.g. borrowck, predicate entailment, etc. While I think this is fine, and the net effect was just that we emitted fewer diagnostics, it makes me uncomfortable that all crates were using the supposed "compat" code. Fixes #137767
2025-03-05Rollup merge of #137298 - compiler-errors:mir-wf, r=lcnr许杰友 Jieyou Xu (Joe)-20/+41
Check signature WF when lowering MIR body Alternative to #137233. https://github.com/rust-lang/rust/pull/137233#issuecomment-2667879143 Fixes https://github.com/rust-lang/rust/issues/137186 We do this check in `mir_drops_elaborated_and_const_checked` and not during `mir_promoted` because that may result in borrowck cycles if WF requires looking into an opaque hidden type. This causes some TAIT tests to fail unnecessarily. r? lcnr try-job: test-various
2025-03-05Rollup merge of #136764 - ↵许杰友 Jieyou Xu (Joe)-74/+72
traviscross:TC/make-ptr_cast_add_auto_to_object-hard-error, r=oli-obk Make `ptr_cast_add_auto_to_object` lint into hard error In Rust 1.81, we added a FCW lint (including linting in dependencies) against pointer casts that add an auto trait to dyn bounds. This was part of work making casts of pointers involving trait objects stricter, and was part of the work needed to restabilize trait upcasting. We considered just making this a hard error, but opted against it at that time due to breakage found by crater. This breakage was mostly due to the `anymap` crate which has been a persistent problem for us. It's now a year later, and the fact that this is not yet a hard error is giving us pause about stabilizing arbitrary self types and `derive(CoercePointee)`. So let's see about making a hard error of this. r? ghost cc ```@adetaylor``` ```@Darksonn``` ```@BoxyUwU``` ```@RalfJung``` ```@compiler-errors``` ```@oli-obk``` ```@WaffleLapkin``` Related: - https://github.com/rust-lang/rust/pull/135881 - https://github.com/rust-lang/rust/issues/136702 - https://github.com/rust-lang/rust/pull/136776 Tracking: - https://github.com/rust-lang/rust/issues/127323 - https://github.com/rust-lang/rust/issues/44874 - https://github.com/rust-lang/rust/issues/123430
2025-03-05Make `MatchPairTree::place` non-optionalZalathar-23/+9
As the invariant indicated, this place could only be none for `TestCase::Irrefutable` nodes, which no longer exist.
2025-03-05Remove the separate simplify step for match-pair treesZalathar-71/+14
What remained of this simplification process has been integrated into construction of the match-pair trees.
2025-03-05Remove `TestCase::Irrefutable`Zalathar-58/+38
2025-03-05Populate pattern bindings/ascriptions while building `MatchPairTree`Zalathar-46/+100
2025-03-05Make `MatchPairTree::for_pattern` push its output node to a vectorZalathar-19/+23
2025-03-05Make `field_match_pairs` push its output nodes to a vectorZalathar-12/+9
2025-03-05keep inductive cycles as ambig in coherencelcnr-3/+22
2025-03-05change definitely non-productive cycles to errorlcnr-81/+174
2025-03-05Suggest struct or union to add generic that impls traitxizheyin-2/+61
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-03-05linux x64: default to `-znostart-stop-gc`Rémy Rakic-0/+29
This will help stabilization of lld.
2025-03-05Auto merge of #138031 - workingjubilee:rollup-5bsotpz, r=workingjubileebors-82/+114
Rollup of 15 pull requests Successful merges: - #137829 (Stabilize [T]::split_off... methods) - #137850 (Stabilize `box_uninit_write`) - #137912 (Do not recover missing lifetime with random in-scope lifetime) - #137913 (Allow struct field default values to reference struct's generics) - #137923 (Simplify `<Postorder as Iterator>::size_hint`) - #137949 (Update MSVC INSTALL.md instructions to recommend VS 2022 + recent Windows 10/11 SDK) - #137963 (Add ``dyn`` keyword to `E0373` examples) - #137975 (Remove unused `PpMode::needs_hir`) - #137981 (rustdoc search: increase strictness of typechecking) - #137986 (Fix some typos) - #137991 (Add `avr-none` to SUMMARY.md and platform-support.md) - #137993 (Remove obsolete comment from DeduceReadOnly) - #137996 (Revert "compiler/rustc_data_structures/src/sync/worker_local.rs: delete "unsafe impl Sync"") - #138019 (Pretty-print `#[deprecated]` attribute in HIR.) - #138026 (Make CrateItem::body() function return an option) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-05Update `compiler-builtins` to 0.1.151Trevor Gross-2/+2
This enables `f16` builtins for loongarch [1] and adds support for Cygwin [2]. [1]: https://github.com/rust-lang/compiler-builtins/pull/770 [2]: https://github.com/rust-lang/compiler-builtins/pull/774
2025-03-04compiler: use `is_rustic_abi` in ty_utilsJubilee Young-5/+2
expands some conditionals to include different "rustic" ABIs, so that we actually handle passing args through all "rustic" ABIs
2025-03-04Rollup merge of #138026 - celinval:chores-item-has-body, r=compiler-errorsJubilee-5/+16
Make CrateItem::body() function return an option When we initially created `CrateItem`, it would only represent items that contain a body. That is no longer the case, for now, make this explicit by expanding the APIs to retrieve the item body. This is related to https://github.com/rust-lang/project-stable-mir/issues/34 r? `@oli-obk`
2025-03-04Rollup merge of #138019 - obi1kenobi:pg/pretty-print-more-attrs, ↵Jubilee-0/+74
r=compiler-errors Pretty-print `#[deprecated]` attribute in HIR. Pretty-print `#[deprecated]` attribute in a form closer to how it might appear in Rust source code, rather than using a `Debug`-like representation. Consider the following Rust code: ```rust #[deprecated] pub struct PlainDeprecated; #[deprecated = "here's why this is deprecated"] pub struct DirectNote; #[deprecated(since = "1.2.3", note = "here's why this is deprecated")] pub struct SinceAndNote; ``` Here's the previous output: ``` #[attr="Deprecation{deprecation: Deprecation{since: Unspecifiednote: suggestion: }span: }")] struct PlainDeprecated; #[attr="Deprecation{deprecation: Deprecation{since: Unspecifiednote: here's why this is deprecatedsuggestion: }span: }")] struct DirectNote; #[attr="Deprecation{deprecation: Deprecation{since: NonStandard(1.2.3)note: here's why this is deprecatedsuggestion: }span: }")] struct SinceAndNote; ``` Here's the new output: ```rust #[deprecated] struct PlainDeprecated; #[deprecated = "here's why this is deprecated"] struct DirectNote; #[deprecated(since = "1.2.3", note = "here's why this is deprecated"] struct SinceAndNote; ``` Also includes a test for `#[diagnostic::(..)]` attributes, though their behavior is not changed here. I already wrote the test, so I figured it probably won't hurt to have it. Related to discussion in #137645. r? `@jdonszelmann`
2025-03-04Rollup merge of #137996 - safinaskar:2025-03-04-revert-parallel, ↵Jubilee-5/+6
r=compiler-errors Revert "compiler/rustc_data_structures/src/sync/worker_local.rs: delete "unsafe impl Sync"" Revert "compiler/rustc_data_structures/src/sync/worker_local.rs: delete "unsafe impl Sync"" This reverts commit 02406903b0c26440428580a4bbaf30da973c5b23. See https://github.com/rust-lang/rust/pull/136858#discussion_r1977482593 cc "Parallel Rustc Front-end" https://github.com/rust-lang/rust/issues/113349 r? SparrowLii ``@rustbot`` label: +WG-compiler-parallel ``@rustbot`` label: +C-cleanup
2025-03-04Rollup merge of #137993 - tmiasko:deduce-comment, r=compiler-errorsJubilee-29/+0
Remove obsolete comment from DeduceReadOnly The situation described in the comment does arise in practice now and described panic is long gone.
2025-03-04Rollup merge of #137975 - Zalathar:needs-hir, r=compiler-errorsJubilee-8/+0
Remove unused `PpMode::needs_hir` This method was added in #99360 to avoid an overzealous `span_delayed_bug` ICE in specific circumstances, but the only caller was subsequently removed in #136603, which presumably avoids the problem in a more principled way.
2025-03-04Rollup merge of #137963 - Eclips4:fix-E0373, r=compiler-errorsJubilee-2/+2
Add ``dyn`` keyword to `E0373` examples Closes #137962
2025-03-04Rollup merge of #137923 - scottmcm:fix-postorder-size-hint, r=tmiaskoJubilee-26/+11
Simplify `<Postorder as Iterator>::size_hint` The current version is sometimes malformed (cc #137919); let's see if we can get away with a loose but trivially-correct one.
2025-03-04Rollup merge of #137913 - compiler-errors:struct-field-default-generic, ↵Jubilee-1/+5
r=BoxyUwU Allow struct field default values to reference struct's generics Right now, the default field value feature (https://github.com/rust-lang/rust/issues/132162) lowers anon consts whose types may reference ADT params that the const doesn't inherit. This PR fixes this, so that these defaults can reference ADTs' generics, and sets the `generics_of` parenting up correctly. There doesn't seem to be a good reason not to support this, since the anon const has a well-defined type from the field, and the anon const doesn't interact with the type system like generic parameter defaults do. r? `````@boxyuwu````` or reassign I could also make this into an error if this seems problematic (https://github.com/rust-lang/rust/compare/master...compiler-errors:rust:default-field-value-implicit-param?expand=1)...... but I'd rather make this work and register an open question on the tracking issue about validating that this is well-vetted. Fixes #137896
2025-03-04Rollup merge of #137912 - compiler-errors:no-missing-lifetime-recovery, ↵Jubilee-6/+0
r=oli-obk Do not recover missing lifetime with random in-scope lifetime Suppresses a ton of stray errors, since this recovery doesn't really make sense anymore now that we have a dedicated `ReError` kind. r? oli-obk or reassign
2025-03-05resume one waiter at a callroot-2/+15