Commit graph

2247 commits

Author SHA1 Message Date
Oscar Bray
8081e86c94 Port #![default_lib_allocator] to the new attribute parser 2026-02-16 19:42:12 +00:00
Jana Dönszelmann
12e6628977
Port rustc_nonnull_optimization_guaranteed to the new attribute parser 2026-02-16 09:46:04 +01:00
Jana Dönszelmann
47ca78040a
Port rustc_do_not_const_check to the new attribute parser 2026-02-16 09:38:31 +01:00
Jonathan Brouwer
38cc50b6e4
Rollup merge of #152612 - JonathanBrouwer:rename_to_msg, r=jdonszelmann
Rename `inline_fluent!` to `msg!`

This was the most popular name for the macro as voted in [#t-compiler > Bikeshed the new `inline_fluent!` macro @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Bikeshed.20the.20new.20.60inline_fluent!.60.20macro/near/572751863)
2026-02-14 18:55:38 +01:00
Jonathan Brouwer
923fb76303
Rollup merge of #152570 - Ozzy1423:attr-parse, r=JonathanBrouwer
Port #[rustc_test_marker] to the attribute parser

Tracking issue: https://github.com/rust-lang/rust/issues/131229

Targets:
Const is for normal tests (const test::TestDescAndFn is inserted before the test fn)
Const/Static/Fn is for custom_test_framework's #[test_case] e.g. tests/ui/custom_test_frameworks/full.rs

r? @JonathanBrouwer

Again I left the use-sites as is since they are early uses.
2026-02-14 18:55:37 +01:00
Jonathan Brouwer
cf0cb74612
Rollup merge of #152577 - Ozzy1423:macro-attr, r=JonathanBrouwer
Port #[rustc_proc_macro_decls] to the new attribute parser.

Tracking issue: https://github.com/rust-lang/rust/issues/131229

r? @JonathanBrouwer
2026-02-14 18:55:36 +01:00
Oscar Bray
6ed7615608 Port #[rustc_test_marker] to the attribute parser 2026-02-14 13:14:57 +00:00
Jonathan Brouwer
018a5efcf7
Rename inline_fluent! to msg! 2026-02-14 13:47:52 +01:00
Jacob Pratt
22f973db34
Rollup merge of #152568 - JonathanBrouwer:port_lang, r=jdonszelmann
Port `#[lang]` and `#[panic_handler]` to the new attribute parsers

For https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163

r? @jdonszelmann
2026-02-13 22:26:35 -05:00
Jonathan Brouwer
ee8ca0a89f Port #[panic_handler] to the new attribute parsers 2026-02-13 16:05:17 +00:00
Jonathan Brouwer
c61c2603cf Port #[lang] to the new attribute parsers 2026-02-13 16:04:19 +00:00
Oscar Bray
ab13120882 Port #[rustc_proc_macro_decls] to the new attribute parser. 2026-02-13 13:24:37 +00:00
Jonathan Brouwer
1944af691e
Rollup merge of #152554 - JonathanBrouwer:remove_deprecated_safe, r=jdonszelmann
Remove `deprecated_safe` and its corresponding feature gate

This unimplements the feature gate for tracking issue https://github.com/rust-lang/rust/issues/94978
The author of that tracking issue and the MCP seem to no longer exist
Afaik we can just do this, but let me know if I'm wrong

Because this feature has been idle for 3+ years, and it is in the way to finish the attribute refactoring (https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163)
When someone wants to do work on it the feature gate can be re-added

r? @jdonszelmann
2026-02-13 13:35:03 +01:00
Jonathan Brouwer
f1b935d08f
Rollup merge of #152356 - JonathanBrouwer:inline_diag4, r=jdonszelmann
Improve the `inline_fluent!` macro

For https://github.com/rust-lang/rust/issues/151366

This PR turns `inline_fluent!` into a proc macro, so we can run validation on the messages in this macro :)
I started a thread here because I don't like the name of the macro, but that's for a future PR: [#t-compiler > Bikeshed the new `inline_fluent!` macro](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Bikeshed.20the.20new.20.60inline_fluent!.60.20macro/with/572646242)
2026-02-13 13:35:01 +01:00
Jonathan Brouwer
a211e2fbba
Rollup merge of #152555 - JonathanBrouwer:port_diagnostic_item, r=jdonszelmann
Port `#[rustc_diagnostic_item]` to the new attribute parsers

r? @jdonszelmann
2026-02-13 13:34:59 +01:00
Jonathan Brouwer
65d982abd8
Rollup merge of #152469 - mu001999-contrib:cleanup/unused-features, r=nadrieril,jdonszelmann
Remove unused features

Detected by https://github.com/rust-lang/rust/pull/152164.

~~Only allow `unused_features` if there are complex platform-specific features enabled.~~
2026-02-13 13:34:58 +01:00
Jonathan Brouwer
cbc661022e Port #[rustc_diagnostic_item] to the new attribute parsers 2026-02-13 09:46:47 +00:00
mu001999
a07f837491 Remove unused features in compiler 2026-02-13 09:25:39 +08:00
Jonathan Brouwer
42a3c864d2
Remove deprecated_safe and its corresponding feature gate 2026-02-12 22:16:28 +01:00
Oscar Bray
8526aa5361 Port #[prelude_import] to the attribute parser 2026-02-12 17:43:04 +00:00
Oscar Bray
d1f11fd734 Port #![test_runner] to the attribute parser 2026-02-11 11:33:49 +00:00
Jana Dönszelmann
eab26e329b
Port rustc_no_mir_inline to the new attribute parser 2026-02-10 10:25:19 +01:00
Jana Dönszelmann
f4c135f91b
Port rustc_trivial_field_reads to the new attribute parser 2026-02-10 10:19:08 +01:00
Jana Dönszelmann
954f483557
Port rustc_never_type_options to the new attribute parser 2026-02-10 10:17:24 +01:00
Jana Dönszelmann
a17eb934db
Port rustc_capture_analysis to the new attribute parser 2026-02-10 10:10:38 +01:00
Jana Dönszelmann
9d10b2ff37
Port rustc_conversion_suggestion to the new attribute parser 2026-02-10 10:10:38 +01:00
Jana Dönszelmann
9cc2924959
Port rustc_deprecated_safe_2024 to the new attribute parser 2026-02-10 10:10:38 +01:00
Jana Dönszelmann
00fef81964
Port rustc_expected_cgu_reuse to the new attribute parser 2026-02-10 10:10:38 +01:00
bors
381e9ef09e Auto merge of #152324 - Keith-Cancel:mgca4, r=BoxyUwU
Update mgca to use `type const` syntax instead of the `#[type_const]` attribute. 

This PR changes the `#[type_const]` attribute to the `type const` syntax for  https://github.com/rust-lang/rust/issues/132980.

This will fixes https://github.com/rust-lang/rust/issues/151273 and similar issues, since we need to check `type const` of items before expansion. The move to add a syntax was mentioned here: https://github.com/rust-lang/rust/pull/151289#issuecomment-3765241397

The first part of this PR adds support by allowing `type const <IDENT>: <TYPE> { = <EXPR> };` syntax in `rustc_parse/src/parser/item.rs`.

The next part since the AST item does not contain enough information to determine if we have a `type const` was rework `ConstItemRhs` into `ConstItemRhsKind` to store the information since we no longer have the attribute acting as a source of extra data/metadata. 

The hir node `ConstItemRhsKind` current shape mostly works, except in the case of `TraitItemKind` where it is an option. I initially went about giving `hir::ConstItemRhsKind` a similar form the AST, but it touches a lot more lines of code and files so because of that, the less invasive option was to add a simple boolean flag to `TraitItemKind`. 

The forth part of this PR includes adding a query I called `is_rhs_type_const` so that we can handle both local and foreign def_ids. 

The fifth aspect of the PR is adding a `mgca_type_const_syntax` feature gate that is checked before expansion. The standard mgca feature gate is ran after expansion. This feature gate allows for conditional compilation (e.g #[cfg(..)]) of the `type const` syntax  in nightly without `min_generic_const_args` being enabled. 

The last bit is updating all the the tests that used the `#[type_const]` attribute to use the new syntax that failed because of the changes. This is the bulk of touched/edited files in the PR. 

r? @BoxyUwU 
@rustbot label +F-associated_const_equality +F-min_generic_const_args
2026-02-09 22:37:29 +00:00
Jonathan Brouwer
6eb2a8fa9e
Reformat existing error messages 2026-02-09 19:12:22 +01:00
Matthias Krüger
c1f716ae53
Rollup merge of #152131 - Ozzy1423:attrs6, r=JonathanBrouwer
Port rustc_no_implicit_bounds attribute to parser.

Tracking Issue: https://github.com/rust-lang/rust/issues/131229

r? @JonathanBrouwer
2026-02-09 18:39:42 +01:00
Keith-Cancel
73a991fb9d Allow provisional mgca syntax of type const <IDENT> = <EXPR> to be reconized.
Revert, but without type const.

Update symbol for feature err, then update suggestion output, and lastly update tests that change because of those.

Update these new tests with the correct syntax, and few existing tests with the new outputs the merge with main added.

Fix for tidyfmt and some errors when manually resolving a merge conflicts.

Update these tests to use update error messages and type const syntax.

Update comments and error message to use new syntax instead of old type_const attribute.

Remove the type_const attribute

update some more tests to use the new syntax.

Update these test cases.

update feature gate test

Change gate logic for `mgca_type_const_syntax` to work also if `min_generic_const_args` is enabled.

Create a new feature gate that checks for the feature before expansion.

Make rustfmt handle the `type const` syntax correctly.

Add a convience method to check if a RhsKind is type const.

Rename `Const` discriminant to `Body` for `ConstItemRhsKind`

Give the `TraitItemKind` flag an enum instead of a simple bool to better describe what the flag is for.

Update formatting for these match statements.

Update clippy test to use type const syntax.

Update test to use type const syntax.

update rustfmt to match ast items.

Update clippy to match ast and hir items.

Few more test cases that used old attribute, instead of 'type const'

Update to match the output from the feature gate checks.

tidyfmt adjustments.

Update the is_type_const, so I can constrain record!(..) in encoder.rs

Update conditional compilation test.

Move the feature gate to after expansion to allow for cfg(...) to work.

Update some more tests to use the new syntax.

Update type const tests in associated-const-bindings to use new syntax.

Don't check based off the attribute, but the item here.

Update some tests outside of the const_generics folder that were using #[type_const]

update the tests in associated consts that use #[type_const] to use type const

Update these mgca tests with the type const syntax.

Add a flag to TraitItemKind for detecting type const for now. Maybe later change ItemConstRhs to have optional consts but that touches a lot more lines of code.

Don't need into for these now that it's a query.

Add is_type_const query to handle foreign def ids.

update this test to use type const syntax.

Fix logic here, we only want to lower if there is expression in this case.

Update built-in macros to use ConstItemRhsKind

Update more instance of the old ConstItemRhs.

Rename ConstItemKind to ConstItemRhsKind, I noticed there is a typed called ConstantItemKind, so add the Rhs to the name to avoid confusion.

Update lower to use ConstItemKind

Add an other helper method to check if the rhs kinda has an expr.

Update item parse to use ConstItemKind enum.

Felt the field name could a be little clear when editing a few other things.

Change the ConstItem struct see know if we have a type const or regular const.

Make sure this syntax is properly feature gated.
2026-02-09 07:59:24 -08:00
Oscar Bray
2b22150c18 Port rustc_no_implicit_bounds attribute to parser. 2026-02-09 13:44:10 +00:00
Jacob Pratt
9d31498271
Rollup merge of #152276 - JonathanBrouwer:fmt-check, r=jdonszelmann
Add message format checking

Checks the indentation of diagnostic messages, it checks that everything is at least as indented as the attribute that contains it

r? @jdonszelmann (Anyone else, also feel free to review, just assigning to Jana because she's been reviewing the other PRs)
2026-02-09 05:20:29 -05:00
Jana Dönszelmann
6babe687a5
Port rustc_reservation_impl to the new attribute parser 2026-02-09 10:55:22 +01:00
Stuart Cook
7cb4501916
Rollup merge of #152291 - jdonszelmann:port-rustc-insignificant-dtor, r=jonathanbrouwer
Port `rustc_insignificant_dtor`

r? @JonathanBrouwer

Second commit removes it from an impl in std. I looked, and I really think it had no effect in the past. We only look for this attr on ADTs...
2026-02-09 14:32:01 +11:00
Stuart Cook
12f0ef7480
Rollup merge of #152171 - jdonszelmann:port-rustc-strict-coherence, r=jonathanbrouwer
Port `rustc_strict_coherence` to the new attribute parser

r? @JonathanBrouwer
2026-02-09 14:32:00 +11:00
Jonathan Brouwer
99c6009c45
Reformat existing messages 2026-02-08 23:07:58 +01:00
Jana Dönszelmann
2dda303229
Port rustc_strict_coherence to the new attribute parser 2026-02-08 22:28:58 +01:00
Jana Dönszelmann
f1b4c2a0e6
Port rustc_insignificant_dtor to the new attribute parser 2026-02-08 22:22:58 +01:00
Oscar Bray
6361d5f279 Parse #[rustc_outlives] 2026-02-08 11:41:36 +00:00
Oscar Bray
7668496274 Parse #[rustc_evaluate_where_clauses] 2026-02-08 11:41:10 +00:00
Oscar Bray
842bed6f93 Parse #[rustc_delayed_bug_from_inside_query] 2026-02-08 11:40:42 +00:00
Jonathan Brouwer
4230c3ab25
Rollup merge of #152300 - jdonszelmann:port-rustc-regions, r=JonathanBrouwer
Port `rustc_regions` to the new attribute parser

r? @JonathanBrouwer
2026-02-07 19:34:51 +01:00
Jana Dönszelmann
cf1a784f3f
Port rustc_regions to the new attribute parser 2026-02-07 17:24:40 +01:00
Jana Dönszelmann
c42a581d2f
Port rustc_intrinsic_const_stable_indirect to the new attribute parser 2026-02-07 14:12:56 +01:00
Jana Dönszelmann
9249e9f78a
Port rustc_intrinsic to the new attribute parser 2026-02-07 14:12:56 +01:00
Edvin Bryntesson
10f0c2d579
Port #[rustc_symbol_name] and #[rustc_def_path] to attr parser 2026-02-07 01:43:00 +01:00
Jonathan Brouwer
ea43035654
Convert to inline diagnostics in rustc_passes 2026-02-06 13:31:54 +01:00
Jonathan Brouwer
0cc62c81e5
Rollup merge of #152184 - Ozzy1423:attrs3, r=jdonszelmann
Port rustc_abi to the attribute parser

Tracking issue: https://github.com/rust-lang/rust/issues/131229

This attribute either dumps the abi info for functions (debug arg)
or if you put it on a pair of fn ptr's it checks they match (assert_eq arg)

r? @JonathanBrouwer
2026-02-06 10:06:47 +01:00