about summary refs log tree commit diff
path: root/compiler/rustc_attr_parsing/src
AgeCommit message (Collapse)AuthorLines
2025-10-02Auto merge of #147231 - CrooseGit:dev/reucru01/extend_rustc_force_inline, ↵bors-1/+5
r=saethlin Extending `#[rustc_force_inline]` to be applicable to inherent methods `#[rustc_force_inline]` is an internal-only attribute similar to `#[inline(always)]` but which emits an error if inlining cannot occur. rustc_force_inline uses the MIR inliner to do this and has limitations on where it can be applied to ensure that an error is always emitted if inlining can't happen (e.g. it can't be applied to trait methods because calls to those can't always be resolved). `#[rustc_force_inline]` is motivated by AArch64 pointer authentication intrinsics where it is vital for the security properties of these intrinsics that they do not exist in standalone functions that could be used as gadgets in an exploit (if they could, then you could sign whatever pointers you want, for example, which is bad, but if you force inlining, then you can't jump to a reusable function containing only these instructions). Since its initial implementation, `#[rustc_force_inline]` could only be applied to free functions. This can be relaxed to also allow inherent methods while still preserving the desired properties. In a work-in-progress patch for manual pointer authentication intrinsics, it is useful to introduce types with inherent methods that would need to be force inlined. r? `@saethlin`
2025-10-02Extends `rustc_force_inline` to inherent methodsReuben Cruise-1/+5
- Changes parser to allow application to inherent methods. - Adds tests to confirm extended functionality works just as the existing.
2025-10-02Rollup merge of #146535 - joshtriplett:mbe-unsafe-attr, r=petrochenkovMatthias Krüger-7/+5
mbe: Implement `unsafe` attribute rules This implements `unsafe attr` rules for declarative `macro_rules!` attributes, as specified in [RFC 3697](https://github.com/rust-lang/rfcs/pull/3697). An invocation of an attribute that uses an `unsafe attr` rule requires the `unsafe(attr(...))` syntax. An invocation of an attribute that uses an ordinary `attr` rule must *not* use the `unsafe(attr(...))` syntax. `unsafe` is only supported on an `attr` rule, not any other kind of `macro_rules!` rule. Tracking issue for `macro_rules!` attributes: https://github.com/rust-lang/rust/issues/143547
2025-10-01mbe: Support `unsafe` attribute rulesJosh Triplett-7/+5
2025-09-29Rollup merge of #147101 - yotamofek:pr/iter-eq-and-eq-by, r=jdonszelmannStuart Cook-1/+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-29Use `Iterator::eq` and (dogfood) `eq_by` in compiler and libraryYotam Ofek-1/+1
2025-09-27improve empty attribute diagnosticJana Dönszelmann-7/+21
2025-09-26Rollup merge of #146704 - jdonszelmann:port-debug-visualizer, r=petrochenkovMatthias Krüger-0/+63
port `#[debugger_visualizer]` to the new attribute system
2025-09-25Rollup merge of #146667 - calebzulawski:simd-mono-lane-limit, r=lcnr,RalfJungStuart Cook-38/+56
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-38/+56
monomorphization Unify zero-length and oversized SIMD errors
2025-09-21port `#[debugger_visualizer]` to the new attribute systemJana Dönszelmann-0/+63
2025-09-21Port #[macro_export] to the new attribute parsing infrastructureJonathan Brouwer-1/+77
Co-authored-by: Anne Stijns <anstijns@gmail.com>
2025-09-17port `#[rustc_coherence_is_core]` to the new attribute parsing infrastructureJana Dönszelmann-14/+15
2025-09-17Rollup merge of #145660 - jbatez:darwin_objc, r=jdonszelmann,madsmtm,tmandryStuart Cook-3/+100
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-13merge crate-level into ALLOWED_TARGETSJana Dönszelmann-62/+23
2025-09-13initial implementation of the darwin_objc unstable featureJo Bates-3/+100
2025-09-13Rollup merge of #146389 - jdonszelmann:no-std, r=oli-obkJana Dönszelmann-2/+28
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-10fixup no_{core,std} handling codeJana Dönszelmann-4/+5
2025-09-10Rollup merge of #146178 - folkertdev:static-align, ↵Matthias Krüger-1/+30
r=jdonszelmann,ralfjung,traviscross Implement `#[rustc_align_static(N)]` on `static`s Tracking issue: https://github.com/rust-lang/rust/issues/146177 ```rust #![feature(static_align)] #[rustc_align_static(64)] static SO_ALIGNED: u64 = 0; ``` We need a different attribute than `rustc_align` because unstable attributes are tied to their feature (we can't have two unstable features use the same unstable attribute). Otherwise this uses all of the same infrastructure as `#[rustc_align]`. r? `@traviscross`
2025-09-09port `#[no_std]` to the new attribute parsing infrastructureJana Dönszelmann-1/+13
2025-09-09port `#[no_core]` to the new attribute parsing infrastructureJana Dönszelmann-2/+15
2025-09-09allow `#[rustc_align_static(N)]` on `static`sFolkert de Vries-1/+30
We need a different attribute than `rustc_align` because unstable attributes are tied to their feature (we can't have two unstable features use the same unstable attribute). Otherwise this uses all of the same infrastructure as `#[rustc_align]`.
2025-09-08fixup limit handling codeJana Dönszelmann-23/+27
2025-09-08port `#[pattern_complexity_limit]` to the new attribute parsing infrastructureJana Dönszelmann-1/+30
2025-09-08port `#[type_length_limit]` to the new attribute parsing infrastructureJana Dönszelmann-1/+31
2025-09-08port `#[move_size_limit]` to the new attribute parsing infrastructureJana Dönszelmann-1/+28
2025-09-08port `#[recursion_limit]` to the new attribute parsing infrastructureJana Dönszelmann-3/+74
2025-08-30Remove incorrect FIXMEJonathan Brouwer-1/+1
2025-08-28Rollup merge of #145937 - jdonszelmann:doc-hidden-prelude, r=fmeaseGuillaume Gomez-1/+11
add doc-hidden to exports in attribute prelude Seems to fix rust-lang/rust#145870, at least temporarily. The underlying problem of course is still there. r? `@fmease` <img width="653" height="167" alt="image" src="https://github.com/user-attachments/assets/b5a8094c-849e-4328-997d-b772f9aa4088" /> Fixes rust-lang/rust#145870
2025-08-28Improve error messages around invalid literals in attribute argumentsJonathan Brouwer-23/+36
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-28Rollup merge of #143193 - JonathanBrouwer:link_rework, r=jdonszelmannStuart Cook-4/+515
Port `#[link]` to the new attribute parsing infrastructure Ports `link` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197
2025-08-27Port the `#[link]` attribute to the new parserJonathan Brouwer-4/+514
2025-08-27Move `NativeLibKind` from `rustc_session` to `rustc_hir`Jonathan Brouwer-0/+1
2025-08-27add doc-hidden to exports in attribute preludeJana Dönszelmann-1/+11
2025-08-27Use `AcceptContext` in `AttribueParser::check_target`Sasha Pourcelot-29/+17
2025-08-26Rollup merge of #145792 - scrabsha:push-umpytyxunpxq, r=jdonszelmannSamuel Tardieu-10/+94
Use attribute name in message for "outer attr used as inner attr" errors
2025-08-25Use attribute name in message for "outer attr used as inner attr" errorsSasha Pourcelot-10/+94
2025-08-24Warn on macro calls for attributes that had this behaviour previouslyJonathan Brouwer-11/+27
2025-08-24fix ICE on stable related to attrs on macrosJana Dönszelmann-29/+12
2025-08-24Port crate name to the new attribute systemJana Dönszelmann-9/+43
2025-08-24Support lints in early attribute parsingJana Dönszelmann-12/+32
2025-08-24Allow errors to be emitted as fatal during attribute parsingJana Dönszelmann-22/+43
2025-08-23port attribute to the new parsing infrastructureJana Dönszelmann-7/+110
2025-08-22Rollup merge of #145762 - jdonszelmann:attrs-strings-to-symbols, r=lqdJacob Pratt-31/+36
convert strings to symbols in attr diagnostics r? `@lcnr` As you rightfully noticed in https://github.com/rust-lang/rust/pull/145670
2025-08-22Rollup merge of #145573 - veluca93:unsafe-force-target-feature, r=davidtwcoJacob Pratt-42/+81
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-22convert strings to symbols in attr diagnosticsJana Dönszelmann-31/+36
2025-08-22Use the new attribute parser throughout the codebaseJonathan Brouwer-26/+55
2025-08-22Rewrite the new attribute parserJonathan Brouwer-232/+284
2025-08-22Move validate_attr to `rustc_attr_parsing`Jonathan Brouwer-1/+395
2025-08-22Add an experimental unsafe(force_target_feature) attribute.Luca Versari-42/+81
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.