about summary refs log tree commit diff
path: root/compiler/rustc_passes/src/check_attr.rs
AgeCommit message (Collapse)AuthorLines
2025-09-27Improve code and fix typoGuillaume Gomez-28/+13
2025-09-27Improve code and better check `doc(cfg(...))` attributesGuillaume Gomez-1/+22
2025-09-27Add code documentation, improve code and improve error messageGuillaume Gomez-6/+3
2025-09-27Strenghten checks for `doc(auto_cfg(show/hide))` attributesGuillaume Gomez-1/+14
2025-09-27Implement RFC 3631Guillaume Gomez-14/+39
2025-09-26Rollup merge of #146704 - jdonszelmann:port-debug-visualizer, r=petrochenkovMatthias Krüger-15/+1
port `#[debugger_visualizer]` to the new attribute system
2025-09-25Rollup merge of #146667 - calebzulawski:simd-mono-lane-limit, r=lcnr,RalfJungStuart Cook-0/+1
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/+1
monomorphization Unify zero-length and oversized SIMD errors
2025-09-21port `#[debugger_visualizer]` to the new attribute systemJana Dönszelmann-15/+1
2025-09-21Port #[macro_export] to the new attribute parsing infrastructureJonathan Brouwer-40/+20
Co-authored-by: Anne Stijns <anstijns@gmail.com>
2025-09-17port `#[rustc_coherence_is_core]` to the new attribute parsing infrastructureJana Dönszelmann-1/+1
2025-09-13initial implementation of the darwin_objc unstable featureJo Bates-0/+2
2025-09-13Rollup merge of #146389 - jdonszelmann:no-std, r=oli-obkJana Dönszelmann-0/+2
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-10Rollup merge of #146178 - folkertdev:static-align, ↵Matthias Krüger-1/+7
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-0/+1
2025-09-09port `#[no_core]` to the new attribute parsing infrastructureJana Dönszelmann-0/+1
2025-09-09allow `#[rustc_align_static(N)]` on `static`sFolkert de Vries-1/+7
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-08port `#[pattern_complexity_limit]` to the new attribute parsing infrastructureJana Dönszelmann-0/+1
2025-09-08port `#[type_length_limit]` to the new attribute parsing infrastructureJana Dönszelmann-0/+1
2025-09-08port `#[move_size_limit]` to the new attribute parsing infrastructureJana Dönszelmann-0/+1
2025-09-08port `#[recursion_limit]` to the new attribute parsing infrastructureJana Dönszelmann-0/+1
2025-08-28Rollup merge of #142472 - GuillaumeGomez:doc-attribute-attribute, r=fmeaseGuillaume Gomez-11/+68
Add new `doc(attribute = "...")` attribute Fixes rust-lang/rust#141123. The implementation and purpose of this new `#[doc(attribute = "...")]` attribute is very close to `#[doc(keyword = "...")]`. Which means that luckily for us, most of the code needed was already in place and `@Noratrieb` nicely wrote a first draft that helped me implement this new attribute very fast. Now with all this said, there is one thing I didn't do yet: adding a `rustdoc-js-std` test. I added GUI tests with search results for attributes so should be fine but I still plan on adding one for it once documentation for builtin attributes will be written into the core/std libs. You can test it [here](https://rustdoc.crud.net/imperio/doc-attribute-attribute/foo/index.html). cc `@Noratrieb` `@Veykril`
2025-08-28Add ui test for unsupported `doc(attribute = "...")` case for attributes ↵Guillaume Gomez-0/+1
with namespace
2025-08-28Create new `Item::is_fake_item` method as equivalent to check for ↵Guillaume Gomez-21/+45
`is_primitive`, `is_keyword` and `is_attribute` methods
2025-08-28Add new `doc(attribute = "...")` attributeGuillaume Gomez-9/+41
2025-08-27Port the `#[link]` attribute to the new parserJonathan Brouwer-3/+5
2025-08-26Rollup merge of #145892 - jdonszelmann:codegen-fn-attrs-foreign-item, r=bjorn3Samuel Tardieu-1/+1
add a flag to codegen fn attrs for foreign items r? `@ghost` refiled to rerun CI
2025-08-26add a flag to codegen fn attrs for foreign itemsJana Dönszelmann-1/+1
2025-08-25Use attribute name in message for "outer attr used as inner attr" errorsSasha Pourcelot-30/+39
2025-08-24Port crate name to the new attribute systemJana Dönszelmann-9/+37
2025-08-23port attribute to the new parsing infrastructureJana Dönszelmann-34/+40
2025-08-22Add an experimental unsafe(force_target_feature) attribute.Luca Versari-1/+1
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-19Rollup merge of #145500 - JonathanBrouwer:must_use_target, r=jdonszelmann许杰友 Jieyou Xu (Joe)-39/+2
Port must_use to the new target checking This PR ports `must_use` to the new target checking logic This also adds a tool-only suggestion to remove attributes on invalid targets, as to not immediately undo the work of https://github.com/rust-lang/rust/pull/145274 r? `@jdonszelmann`
2025-08-19Port `must_use` to the new target checkingJonathan Brouwer-39/+2
2025-08-19Rollup merge of #142681 - 1c3t3a:sanitize-off-on, r=rcvalleStuart Cook-29/+32
Remove the `#[no_sanitize]` attribute in favor of `#[sanitize(xyz = "on|off")]` This came up during the sanitizer stabilization (rust-lang/rust#123617). Instead of a `#[no_sanitize(xyz)]` attribute, we would like to have a `#[sanitize(xyz = "on|off")]` attribute, which is more powerful and allows to be extended in the future (instead of just focusing on turning sanitizers off). The implementation is done according to what was [discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/channel/343119-project-exploit-mitigations/topic/Stabilize.20the.20.60no_sanitize.60.20attribute/with/495377292)). The new attribute also works on modules, traits and impl items and thus enables usage as the following: ```rust #[sanitize(address = "off")] mod foo { fn unsanitized(..) {} #[sanitize(address = "on")] fn sanitized(..) {} } trait MyTrait { #[sanitize(address = "off")] fn unsanitized_default(..) {} } #[sanitize(thread = "off")] impl MyTrait for () { ... } ``` r? ```@rcvalle```
2025-08-18Remove the no_sanitize attribute in favor of sanitizeBastian Kersting-39/+0
This removes the #[no_sanitize] attribute, which was behind an unstable feature named no_sanitize. Instead, we introduce the sanitize attribute which is more powerful and allows to be extended in the future (instead of just focusing on turning sanitizers off). This also makes sanitize(kernel_address = ..) attribute work with -Zsanitize=address To do it the same as how clang disables address sanitizer, we now disable ASAN on sanitize(kernel_address = "off") and KASAN on sanitize(address = "off"). The same was added to clang in https://reviews.llvm.org/D44981.
2025-08-18Implement the #[sanitize(..)] attributeBastian Kersting-1/+43
This change implements the #[sanitize(..)] attribute, which opts to replace the currently unstable #[no_sanitize]. Essentially the new attribute works similar as #[no_sanitize], just with more flexible options regarding where it is applied. E.g. it is possible to turn a certain sanitizer either on or off: `#[sanitize(address = "on|off")]` This attribute now also applies to more places, e.g. it is possible to turn off a sanitizer for an entire module or impl block: ```rust \#[sanitize(address = "off")] mod foo { fn unsanitized(..) {} #[sanitize(address = "on")] fn sanitized(..) {} } \#[sanitize(thread = "off")] impl MyTrait for () { ... } ``` This attribute is enabled behind the unstable `sanitize` feature.
2025-08-15Port `#[custom_mir(..)]` to the new attribute systemSasha Pourcelot-4/+47
2025-08-14Remove the old target checking logicJonathan Brouwer-835/+108
2025-08-13Port the `#[linkage]` attribute to the new attribute systemSasha Pourcelot-3/+5
2025-08-13Rollup merge of #145274 - compiler-errors:unused-must-use, r=fmeaseJakub Beránek-1/+1
Remove unused `#[must_use]` Self-explanatory Fixes https://github.com/rust-lang/rust/issues/145257
2025-08-12Remove unused must_useMichael Goulet-1/+1
2025-08-12Auto merge of #144678 - jdonszelmann:no-mangle-extern, r=bjorn3bors-18/+18
Make no_mangle on foreign items explicit instead of implicit for a followup PR I'm working on I need some foreign items to mangle. I could add a new attribute: `no_no_mangle` or something silly like that but by explicitly putting `no_mangle` in the codegen fn attrs of foreign items we can default it to `no_mangle` and then easily remove it when we don't want it. I guess you'd know about this r? `@bjorn3.` Shouldn't be too hard to review :) Builds on rust-lang/rust#144655 which should merge first.
2025-08-12Rollup merge of #145251 - tiif:support_trait, r=BoxyUwUStuart Cook-2/+1
Support using #[unstable_feature_bound] on trait This is needed to unblock https://github.com/rust-lang/rust/pull/145095 r? ```````@BoxyUwU```````
2025-08-12Rollup merge of #145155 - scrabsha:push-tkvwkolzooyq, r=jdonszelmannStuart Cook-8/+41
Port `#[allow_internal_unsafe]` to the new attribute system (attempt 2) This is a slightly modified version of ae1487aa9922de7642c448cc0908584026699e1c, which caused a performance regression (reverted in https://github.com/rust-lang/rust/pull/145086#issue-3303428759). The diff between this PR and the previous one can be seen in 027a1def. r? ```````@jdonszelmann``````` :sparkling_heart:
2025-08-12make no_mangle explicit on foreign itemsJana Dönszelmann-18/+18
2025-08-11Propagate TraitImplHeader to hirCameron Steffen-4/+3
2025-08-11Support using #[unstable_feature_bound] on traittiif-2/+1
2025-08-11Port `#[allow_internal_unsafe]` to the new attribute system (attempt 2)Sasha Pourcelot-8/+41
2025-08-08Revert "Port `#[allow_internal_unsafe]` to the new attribute system"Jana Dönszelmann-41/+8
This reverts commit 4f7a6ace9e2f2192af7b5d32f4b1664189e0e143.