about summary refs log tree commit diff
path: root/compiler/rustc_hir
AgeCommit message (Collapse)AuthorLines
2025-09-29Rollup merge of #147101 - yotamofek:pr/iter-eq-and-eq-by, r=jdonszelmannStuart Cook-4/+1
Use `Iterator::eq` and (dogfood) `eq_by` in compiler and library Now that rust-lang/rust#137122 has landed, we can replace stuff that looks like: ```rust let a: &[T]; let b: &[T]; let eq = a.len() == b.len() && a.iter().zip(b).all(|(a,b)| a == b) ``` with the much simpler `a.iter().eq(b)`, without losing the perf benefit of the different-length-fast-path. Also dogfooded `Iterator::eq_by` (cc rust-lang/rust#64295 ) while I'm at it. First commit (4d1b6fad230f8a5ccceccc7562eadc4ea50059da) should be very straightforward to review, second one (049a4606cb3906787aedf508ee8eea09c2bb3b9a) is slightly more creative, but IMHO a nice cleanup.
2025-09-29Rollup merge of #146653 - jdonszelmann:empty-attr-diags, r=nnethercoteStuart Cook-7/+8
improve diagnostics for empty attributes Adds a note about them not having any effect. This was previously done for `feature` attributes but no other attributes. In [converting the `feature` parser](https://github.com/rust-lang/rust/pull/146652) I removed that note. This PR adds it back in and makes it so all attributes benefit from it. Not blocked on rust-lang/rust#146652, either can merge first
2025-09-29Use `Iterator::eq` and (dogfood) `eq_by` in compiler and libraryYotam Ofek-4/+1
2025-09-27Rollup merge of #146037 - aapoalas:reborrow-lang-experiment, r=tmandryMatthias Krüger-0/+1
Introduce CoerceShared lang item and trait, and basic Reborrow tests Part of rust-lang/rust#145612: This introduces the `CoerceShared` trait which is the `Reborrow` equivalent of a `&mut T` -> `&T` coercion. The trait has a `Target` GAT which makes this (currently) unique in the `core/src/marker.rs`; I'm not sure if this can be considered problematic. Maybe this is not the way such things should be done at the marker trait level? Or maybe it is fine. Improtantly, this PR introduces a battery of basic `Reborrow` and `CoerceShared` tests. These test the very basics of the feature; custom marker types intended to have exclusive semantics (`Custom<'a>(PhantomData<&'a mut ()>)`), custom exclusive reference wrappers, and standard library exclusive reference wrappers (`Pin<&mut T>` and `Option<&mut T>`). None of these of course work since the implementation for `Reborrow` and `CoerceShared` is entirely missing, but this is the first step towards making these work. Future PRs will introduce more tests, such as "recursive" reborrowing (ie. reborrowing structs that contain multiple reborrowable fields) and checks around the lifetime semantics of reborrowing ie. that a reborrow produces a new type with the same lifetime as the original.
2025-09-27improve empty attribute diagnosticJana Dönszelmann-7/+8
2025-09-26Rollup merge of #146704 - jdonszelmann:port-debug-visualizer, r=petrochenkovMatthias Krüger-1/+19
port `#[debugger_visualizer]` to the new attribute system
2025-09-25Rollup merge of #146667 - calebzulawski:simd-mono-lane-limit, r=lcnr,RalfJungStuart Cook-0/+4
Add an attribute to check the number of lanes in a SIMD vector after monomorphization Allows std::simd to drop the `LaneCount<N>: SupportedLaneCount` trait and maintain good error messages. Also, extends rust-lang/rust#145967 by including spans in layout errors for all ADTs. r? ``@RalfJung`` cc ``@workingjubilee`` ``@programmerjake``
2025-09-23Add an attribute to check the number of lanes in a SIMD vector after ↵Caleb Zulawski-0/+4
monomorphization Unify zero-length and oversized SIMD errors
2025-09-21port `#[debugger_visualizer]` to the new attribute systemJana Dönszelmann-1/+19
2025-09-21Port #[macro_export] to the new attribute parsing infrastructureJonathan Brouwer-5/+34
Co-authored-by: Anne Stijns <anstijns@gmail.com>
2025-09-17port `#[rustc_coherence_is_core]` to the new attribute parsing infrastructureJana Dönszelmann-4/+4
2025-09-17Rollup merge of #145660 - jbatez:darwin_objc, r=jdonszelmann,madsmtm,tmandryStuart Cook-0/+8
initial implementation of the darwin_objc unstable feature Tracking issue: https://github.com/rust-lang/rust/issues/145496 This feature makes it possible to reference Objective-C classes and selectors using the same ABI used by native Objective-C on Apple/Darwin platforms. Without it, Rust code interacting with Objective-C must resort to loading classes and selectors using costly string-based lookups at runtime. With it, these references can be loaded efficiently at dynamic load time. r? ```@tmandry``` try-job: `*apple*` try-job: `x86_64-gnu-nopt`
2025-09-16Rollup merge of #145095 - tiif:unstable_const_param, r=BoxyUwUStuart Cook-1/+0
Migrate `UnsizedConstParamTy` to unstable impl of `ConstParamTy_` Now that we have ``#[unstable_feature_bound]``, we can remove ``UnsizedConstParamTy`` that was meant to be an unstable impl of stable type and ``ConstParamTy_`` trait. r? `@BoxyUwU`
2025-09-15Introduce CoerceShared lang item and traitAapo Alasuutari-0/+1
2025-09-15Remove UnsizedConstParamTy trait and make it into an unstable impltiif-1/+0
2025-09-13initial implementation of the darwin_objc unstable featureJo Bates-0/+8
2025-09-13Auto merge of #145186 - camsteffen:assoc-impl-kind, r=petrochenkovbors-9/+28
Make `AssocItem` aware of its impl kind The general goal is to have fewer query dependencies by making `AssocItem` aware of its parent impl kind (inherent vs. trait) without having to query the parent def_kind. See individual commits.
2025-09-13Rollup merge of #146389 - jdonszelmann:no-std, r=oli-obkJana Dönszelmann-1/+9
Convert `no_std` and `no_core` to the new attribute infrastructure r? ```@oli-obk``` Also added a test for these, since we didn't have any and I was kind of surprised new diagnostics didn't break anything hehe
2025-09-12Introduce hir::ImplItemImplKindCameron Steffen-9/+28
2025-09-12Auto merge of #146328 - zetanumbers:fix-141951, r=lcnrbors-0/+37
Skip typeck for items w/o their own typeck context Skip items which forward typeck to their ancestor. Should remove some potential but unnecessary typeck query waits, hence might improve performance for the parallel frontend. Thanks to `@ywxt` for a fix suggestion Fixes rust-lang/rust#141951
2025-09-10Rollup merge of #144765 - Qelxiros:range-inclusive-last, r=jhprattMatthias Krüger-1/+15
inclusive `Range`s: change `end` to `last` Tracking issue: rust-lang/rust#125687 ACP: rust-lang/libs-team#511
2025-09-09port `#[no_std]` to the new attribute parsing infrastructureJana Dönszelmann-1/+5
2025-09-09port `#[no_core]` to the new attribute parsing infrastructureJana Dönszelmann-0/+4
2025-09-08change end to lastJeremy Smart-1/+15
2025-09-08fixup limit handling codeJana Dönszelmann-6/+73
2025-09-08port `#[pattern_complexity_limit]` to the new attribute parsing infrastructureJana Dönszelmann-0/+4
2025-09-08port `#[type_length_limit]` to the new attribute parsing infrastructureJana Dönszelmann-0/+4
2025-09-08port `#[move_size_limit]` to the new attribute parsing infrastructureJana Dönszelmann-0/+4
2025-09-08port `#[recursion_limit]` to the new attribute parsing infrastructureJana Dönszelmann-1/+5
2025-09-08Make `is_typeck_child` match exhaustiveDaria Sukhonina-1/+31
2025-09-08Skip typeck for items w/o their own typeck contextDaria Sukhonina-0/+7
More details on about this fix: https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fparallel-rustc/topic/ICE.3A.20typecks.20AnonConst.20under.20parallel.20rustc.28.23141951.29/with/538200980 Co-authored-by: ywxt <ywxtcwh@gmail.com>
2025-09-02Rollup merge of #146102 - fmease:rm-dead-eff-code-iii, r=fee1-deadGuillaume Gomez-2/+1
Remove dead code stemming from an old effects desugaring CC https://github.com/rust-lang/rust/pull/132374, https://github.com/rust-lang/rust/pull/133443. r? fee1-dead
2025-09-02Rollup merge of #145783 - Erk-:et-cetera-span, r=compiler-errorsGuillaume Gomez-4/+4
add span to struct pattern rest (..) Struct pattern rest (`..`) did not retain span information compared to normal fields. This patch adds span information for it. The motivation of this patch comes from when I implemented this PR for Clippy: https://github.com/rust-lang/rust-clippy/pull/15000#discussion_r2134145163 It is possible to get the span of the Et cetera in a bit roundabout way, but I thought this would be nicer.
2025-09-02Revert introduction of `[workspace.dependencies]`.Nicholas Nethercote-4/+4
This was done in #145740 and #145947. It is causing problems for people using r-a on anything that uses the rustc-dev rustup package, e.g. Miri, clippy. This repository has lots of submodules and subtrees and various different projects are carved out of pieces of it. It seems like `[workspace.dependencies]` will just be more trouble than it's worth.
2025-09-01Remove dead code stemming from an old effects desugaringLeón Orell Valerian Liehr-2/+1
2025-08-29Rollup merge of #145947 - nnethercote:workspace-members-2, r=KobzolStuart Cook-1/+1
Add more to the `[workspace.dependencies]` section in the top-level `Cargo.toml` Following on from rust-lang/rust#145740. r? `@Kobzol`
2025-08-28Add `odht` to `[workspace.dependencies]`.Nicholas Nethercote-1/+1
2025-08-27Port the `#[link]` attribute to the new parserJonathan Brouwer-0/+15
2025-08-27Move `NativeLibKind` from `rustc_session` to `rustc_hir`Jonathan Brouwer-0/+103
2025-08-27Add `tracing` to `[workspace.dependencies]`.Nicholas Nethercote-1/+1
2025-08-27Add `bitflags` to `[workspace.dependencies]`.Nicholas Nethercote-1/+1
2025-08-27Add `thin-vec` to newly added `[workspace.dependencies]`.Nicholas Nethercote-1/+1
2025-08-25Use attribute name in message for "outer attr used as inner attr" errorsSasha Pourcelot-0/+1
2025-08-25add span to struct pattern rest (..)Valdemar Erk-4/+4
2025-08-24Port crate name to the new attribute systemJana Dönszelmann-0/+9
2025-08-23port attribute to the new parsing infrastructureJana Dönszelmann-1/+20
2025-08-22Rollup merge of #145726 - aapoalas:reborrow-lang-experiment, r=petrochenkovJacob Pratt-0/+3
Experiment: Reborrow trait Tracking issue: rust-lang/rust#145612 Starting off really small here: just introduce the unstable feature and the feature gate, and one of the two traits that the Reborrow experiment deals with. ### Cliff-notes explanation The `Reborrow` trait is conceptually a close cousin of `Copy` with the exception that it disables the source (`self`) for the lifetime of the target / result of the reborrow action. It can be viewed as a method of `fn reborrow(self: Self<'a>) -> Self<'a>` with the compiler adding tracking of the resulting `Self<'a>` (or any value derived from it that retains the `'a` lifetime) to keep the `self` disabled for reads and writes. No method is planned to be surfaced to the user, however, as reborrowing cannot be seen in code (except for method calls [`a.foo()` reborrows `a`] and explicit reborrows [`&*a`]) and thus triggering user-code in it could be viewed as "spooky action at a distance". Furthermore, the added compiler tracking cannot be seen on the method itself, violating the Golden Rule. Note that the userland "reborrow" method is not True Reborrowing, but rather a form of a "Fancy Deref": ```rust fn reborrow(&'short self: Self<'long>) -> Self<'short>; ``` The lifetime shortening is the issue here: a reborrowed `Self` or any value derived from it is bound to the method that called `reborrow`, since `&'short` is effectively a local variable. True Reborrowing does not shorten the lifetime of the result. To avoid having to introduce new kinds of references, new kinds of lifetime annotations, or a blessed trait method, no method will be introduced at all. Instead, the `Reborrow` trait is intended to be a derived trait that effectively reborrows each field individually; `Copy` fields end up just copying, while fields that themselves `Reborrow` get disabled in the source, usually leading to the source itself being disabled (some differences may appear with structs that contain multiple reborrowable fields). The goal of the experiment is to determine how the actual implementation here will shape out, and what the "bottom case" for the recursive / deriving `Reborrow` is. `Reborrow` has a friend trait, `CoerceShared`, which is equivalent to a `&'a mut T -> &'a T` conversion. This is needed as a different trait and different operation due to the different semantics it enforces on the source: a `CoerceShared` operation only disables the source for writes / exclusive access for the lifetime of the result. That trait is not yet introduced in this PR, though there is no particular reason why it could not be introduced.
2025-08-22Rollup merge of #145573 - veluca93:unsafe-force-target-feature, r=davidtwcoJacob Pratt-3/+4
Add an experimental unsafe(force_target_feature) attribute. This uses the feature gate for https://github.com/rust-lang/rust/issues/143352, but is described in https://github.com/rust-lang/rfcs/pull/3820 which is strongly tied to the experiment.
2025-08-22Add an experimental unsafe(force_target_feature) attribute.Luca Versari-3/+4
This uses the feature gate for https://github.com/rust-lang/rust/issues/143352, but is described in https://github.com/rust-lang/rfcs/pull/3820 which is strongly tied to the experiment.
2025-08-21Introduce Reborrow lang item and traitAapo Alasuutari-0/+3