100 Commits
Author SHA1 Message Date
Jonathan Brouwer 9ceb997e04 Add myself to the review rotation 2025-10-23 17:52:54 +02:00
Jonathan Brouwer ebd3220b20 Remove unused field style from AttributeKind::CrateName
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-10-22 15:45:59 +02:00
Jonathan Brouwer 66b8a9db1f Update uitests with new unused_attributes warnings
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-10-18 21:17:48 +02:00
Jonathan Brouwer e3dd4c1987 Warn on unused_attributes in tests
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-10-18 21:13:52 +02:00
Jonathan Brouwer 090dad00a9 Changes in uitests for cfg_attr
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-10-15 22:18:18 +02:00
Jonathan Brouwer 7113d58c8e Port #[cfg_attr] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-10-15 22:18:18 +02:00
Jonathan Brouwer e0c190f681 Move parse_cfg_attr to rustc_attr_parsing
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-10-15 22:18:18 +02:00
Jonathan Brouwer 52cc311828 Rename some functions
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-10-15 22:18:17 +02:00
Jonathan Brouwer c050bfbf6f Fix double error for #[no_mangle] on consts 2025-10-08 17:46:33 +02:00
Jonathan Brouwer 730221e654 Fix double error for #[no_mangle] on closures 2025-10-08 17:46:33 +02:00
Jonathan Brouwer 1589c6c12d Add regression test for link_section targets 2025-10-07 09:40:27 +02:00
Jonathan Brouwer 4787834eda Fix target list of link_section
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-10-06 23:04:09 +02:00
Jonathan Brouwer 1c85a1dc2e Make #[link="dl"] a warning rather than an error 2025-10-04 11:22:56 +02:00
Jonathan Brouwer 5c95f8bea6 Add failing regression test for #[link="dl"] 2025-10-04 11:19:18 +02:00
Jonathan BrouwerandAnne Stijns 7d80c15fa0 Port #[macro_export] to the new attribute parsing infrastructure
Co-authored-by: Anne Stijns <anstijns@gmail.com>
2025-09-21 10:42:47 -04:00
Jonathan BrouwerandAnne Stijns f7fa83ec62 Changes to uitests for macro_export port
Co-authored-by: Anne Stijns <anstijns@gmail.com>
2025-09-21 10:42:47 -04:00
Jonathan BrouwerandAnne Stijns 6abcadc235 Port #[macro_export] to the new attribute parsing infrastructure
Co-authored-by: Anne Stijns <anstijns@gmail.com>
2025-09-21 10:42:47 -04:00
Jonathan Brouwer fcd6f284a1 Remove incorrect FIXME 2025-08-30 13:44:13 +02:00
Jonathan Brouwer e0bdc46d94 Update uitest stderr
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-28 20:05:04 +02:00
Jonathan Brouwer f328709276 Improve error messages around invalid literals in attribute arguments
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-28 20:05:04 +02:00
Jonathan Brouwer 2c7dfa91b5 Add another case to the bad-lit-suffixes test
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-28 19:23:55 +02:00
Jonathan Brouwer 7db1840569 Changes to the uitests
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-27 20:25:18 +02:00
Jonathan Brouwer e8d08b5416 Port the #[link] attribute to the new parser 2025-08-27 20:25:16 +02:00
Jonathan Brouwer aab5e0bf1f Move NativeLibKind from rustc_session to rustc_hir 2025-08-27 20:24:59 +02:00
Jonathan Brouwer fe81a79e59 Regression test for attributes on macro calls
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-24 14:54:15 +02:00
Jonathan Brouwer 3851e6c7b6 Warn on macro calls for attributes that had this behaviour previously 2025-08-24 14:29:03 +02:00
Jonathan Brouwer ec5b2cce8e Updated uitests for new parser 2025-08-22 08:58:45 +02:00
Jonathan Brouwer 17e34f6b24 Use the new attribute parser throughout the codebase 2025-08-22 08:58:45 +02:00
Jonathan Brouwer 549314bdb7 Rewrite the new attribute parser 2025-08-22 08:38:37 +02:00
Jonathan Brouwer 21d3189779 Move validate_attr to rustc_attr_parsing 2025-08-22 08:37:19 +02:00
Jonathan Brouwer d5dc797dce Update uitests 2025-08-19 09:03:54 +02:00
Jonathan Brouwer c1c204d707 Port must_use to the new target checking 2025-08-19 09:03:50 +02:00
Jonathan Brouwer f0addd040a Make tool-only suggestion to remove attributes on invalid targets 2025-08-19 09:03:07 +02:00
Jonathan Brouwer d4175033f0 Allow stability attributes on extern crates 2025-08-18 10:05:11 +02:00
Jonathan Brouwer a69ba29a0f Fix deprecation attribute on foreign statics & types 2025-08-16 09:44:43 +02:00
Jonathan Brouwer e8f90b12fc Don't show foreign types as an allowed target if the feature is not enabled 2025-08-16 09:44:39 +02:00
Jonathan Brouwer 4bb7bf64e0 Update uitests
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-14 18:18:42 +02:00
Jonathan Brouwer 5245c39972 Remove the old target checking logic 2025-08-14 18:18:42 +02:00
Jonathan Brouwer 35e04b67a6 Specify the list of allowed targets per attribute 2025-08-14 18:18:22 +02:00
Jonathan Brouwer 744d39ebe6 Allow attribute parsers to specify a list of allowed targets
Every acceptor gets an `ALLOWED_TARGETS` specification which can specify per target whether it is allowed, warned, or errored.
2025-08-14 18:11:56 +02:00
Jonathan Brouwer e7ef23e90e Pass the target type down to parse_attribute_list 2025-08-14 18:11:56 +02:00
Jonathan Brouwer 106731f714 Improved Target type
- Added a few more variants which are needed for various attributes
- Previously a trait method with default block had the same target representation as a method in a `impl trait for` block, this has been changed (See `MethodKind`)
- Added `plural_name` for more precision on the form of the name
2025-08-14 18:11:47 +02:00
Jonathan Brouwer b2b4bd41fa Start reporting future breakage for ILL_FORMED_ATTRIBUTE_INPUT in dependencies
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-10 10:48:08 +02:00
Jonathan Brouwer 4281e05a20 Changes to the tests for the #[should_panic] port
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-06 21:38:00 +02:00
Jonathan Brouwer f7ad4065fe Port #[should_panic] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-06 21:37:51 +02:00
Jonathan Brouwer b3317dd055 Correct the use of must_use on btree::IterMut
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-04 22:20:30 +02:00
Jonathan Brouwer f92934f43a Remove SHOULD_EMIT_LINTS in favor of should_emit 2025-08-03 21:48:23 +02:00
Jonathan Brouwer 32cf3d48b3 Cleanup the definition of group_type
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-01 17:08:02 +02:00
Jonathan Brouwer 31b6b66638 Fix tooling
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-26 20:26:16 +02:00
Jonathan Brouwer 97b65215ff Fix tooling
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-26 20:26:16 +02:00
Jonathan Brouwer e64f75b3d2 Remove now un-used code
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-26 20:26:16 +02:00
Jonathan Brouwer fea7809edb Update test results
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-26 20:26:15 +02:00
Jonathan Brouwer ec637000c6 Use the new attributes throughout the codebase
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-26 20:26:05 +02:00
Jonathan Brouwer 2f50c7807c Parsers for the attributes
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-26 20:25:40 +02:00
Jonathan Brouwer c4e7cb806c Implement check_attr 2025-07-26 20:25:39 +02:00
Jonathan Brouwer 39235beeb4 Add attributes to AttributeKind 2025-07-26 20:25:39 +02:00
Jonathan Brouwer a2b3d81034 Call is_parsed_attribute rather than keeping track of a list of parsed attributes manually 2025-07-24 22:53:09 +02:00
Jonathan Brouwer af06bb925f Stop using the old validate_attr logic for stability attributes 2025-07-23 14:31:50 +02:00
Jonathan Brouwer e07a4ee103 Ports #[macro_use] and #[macro_escape] to the new attribute parsing infrastructure 2025-07-23 13:33:23 +02:00
Jonathan Brouwer 3303534dc8 Update uitest stderrs
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-23 13:33:23 +02:00
Jonathan Brouwer a460b46d0f Ports #[macro_use] and #[macro_escape] to the new attribute parsing infrastructure 2025-07-23 13:33:23 +02:00
Jonathan Brouwer 9f16db6611 Regression test 2025-07-17 08:03:17 +02:00
Jonathan Brouwer 49ae52e3ff Fix encoding of link_section and no_mangle cross crate 2025-07-17 08:02:26 +02:00
Jonathan Brouwer bfa45ac78b Add regression test
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-15 23:28:15 +02:00
Jonathan Brouwer 8e400f97e5 Fix ice for feature-gated cfg attributes applied to the crate
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-15 23:28:15 +02:00
Jonathan Brouwer 7a7c74ad89 New example for E0536 2025-07-15 09:21:27 +02:00
Jonathan Brouwer c7f5ddc098 Changes to diagnostics 2025-07-15 09:21:27 +02:00
Jonathan Brouwer 6133c676d7 Define attribute parser & config evaluator 2025-07-15 09:21:26 +02:00
Jonathan Brouwer 30f4a9cd53 Move cfg -> cfg_old 2025-07-15 09:01:03 +02:00
Jonathan Brouwer 38dd6f5206 Allow Early stage to emit errors 2025-07-15 09:01:03 +02:00
Jonathan Brouwer a14baf1e56 Define datastructures for #[cfg] attribute, move StrippedCfgItem 2025-07-15 09:01:00 +02:00
Jonathan Brouwer f0d0afab8e Port #[pointee] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-14 23:16:31 +02:00
Jonathan Brouwer 86349e31dd Port #[omit_gdb_pretty_printer_section] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-12 22:55:48 +02:00
Jonathan Brouwer 3187aa751a Fix clippy & rustdoc-json
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-12 17:48:52 +02:00
Jonathan Brouwer 68066b90b8 Update uitest stderrs
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-12 17:48:52 +02:00
Jonathan Brouwer a1cfca3d07 Fix clippy & rustdoc-json
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-12 17:48:52 +02:00
Jonathan Brouwer ef82007ed7 Port #[automatically_derived] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-12 17:48:50 +02:00
Jonathan Brouwer 2f05fa6fff Fix ICE for parsed attributes with longer path not handled by CheckAttrVisitor
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-11 17:02:57 +02:00
Jonathan Brouwer 244d64e60b Port #[path] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 22:19:16 +02:00
Jonathan Brouwer ef3d7741e5 Move check for new attribute to check_builtin_meta_item
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 22:18:58 +02:00
Jonathan Brouwer f7046bd32a Regression tests for repr ICEs
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 22:07:09 +02:00
Jonathan Brouwer 33f2cc7eda Fix line break after ":" in unpretty attribute print
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 09:51:47 +02:00
Jonathan Brouwer 8aad0e6ad9 Rewrite empty attribute lint
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 09:51:35 +02:00
Jonathan Brouwer 3fa0ec91d8 Rewrite empty attribute lint
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 09:51:35 +02:00
Jonathan Brouwer 2d8ffff10a Port #[ignore] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-05 21:23:09 +02:00
Jonathan Brouwer 9c9ee34807 Port #[non_exhaustive] to the new attribute parsing infrastructure 2025-07-04 20:30:42 +02:00
Jonathan Brouwer 027126ce0b Port #[non_exhaustive] to the new attribute parsing infrastructure 2025-07-04 20:30:42 +02:00
Jonathan Brouwer fee5e3c3aa Port #[no_implicit_prelude] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-03 20:59:40 +02:00
Jonathan Brouwer 3d5d72b761 Port #[target_feature] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-03 07:54:19 +02:00
Jonathan Brouwer 57a5e3b6d2 Fix duplicate errors for link_section, rustc_layout_scalar_valid_range_start and rustc_layout_scalar_valid_range_end 2025-07-01 16:40:47 +02:00
Jonathan Brouwer 1e474c2c6c Port #[rustc_object_lifetime_default] to the new attribute parsing infrastructure 2025-07-01 16:31:23 +02:00
Jonathan Brouwer d22ce4c5eb Fix duplicate help on export_name and others
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01 16:10:07 +02:00
Jonathan Brouwer 0b67d14b31 Fix #[rustc_macro_transparency] giving two errors
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01 16:10:07 +02:00
Jonathan Brouwer 149bdde97e Fix #[must_use = 1] not giving an error
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01 16:10:05 +02:00
Jonathan Brouwer 86b54d5729 Fix double error for export_name
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01 16:10:02 +02:00
Jonathan Brouwer 0fcf295b64 New test for malformed attributes
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01 16:10:02 +02:00
Jonathan BrouwerandAnne Stijns 1249c14232 Port #[link_name] to the new attribute parsing infrastructure
Co-authored-by: Anne Stijns <anstijns@gmail.com>
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-28 13:53:37 +02:00
Jonathan Brouwer 58418d881a Fix rustdoc not correctly showing attributes with re-exports
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-27 23:31:25 +02:00
Jonathan Brouwer f98ea3d144 Port #[rustc_layout_scalar_valid_range_start/end] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-27 09:08:21 +02:00
Jonathan Brouwer 9e35684072 Port #[used] to new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-27 08:58:26 +02:00