rust/tests/ui/attributes
jyn d50a8d5fb3 Improve -Z crate-attr diagnostics
- Show the `#![ ... ]` in the span (to make it clear that it should not
  be included in the CLI argument)
- Show more detailed errors when the crate has valid token trees but
  invalid syntax.
  Previously, `crate-attr=feature(foo),feature(bar)` would just say
  "invalid crate attribute" and point at the comma. Now, it explicitly
  says that the comma was unexpected, which is useful when using
  `--error-format=short`. It also fixes the column to show the correct
  span.
- Recover from parse errors. Previously we would abort immediately on
  syntax errors; now we go on to try and type-check the rest of the
  crate.

The new diagnostic code also happens to be slightly shorter.
2025-04-13 16:46:02 -04:00
..
auxiliary Fix the "used_with_archive" test on Fuchsia 2025-03-20 12:25:08 -04:00
inline Adjust tests/ui/attr-usage-inline.rs 2024-12-17 19:57:42 +08:00
main-removed-2 Update tests to use new proc-macro header 2024-11-27 07:18:25 -08:00
unsafe Do not visit whole crate to compute lints_that_dont_need_to_run. 2025-04-04 12:37:38 +00:00
z-crate-attr Improve -Z crate-attr diagnostics 2025-04-13 16:46:02 -04:00
arg-error-issue-121425.rs fix spans of arguments in diagnostic 2024-03-03 10:48:40 +08:00
arg-error-issue-121425.stderr Fix test output expectations 2025-02-24 14:31:19 +01:00
assoc-expr.rs Overhaul token collection. 2024-08-16 09:07:55 +10:00
attr-bad-crate-attr.rs compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03:00
attr-bad-crate-attr.stderr compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03:00
attr-before-view-item.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
attr-before-view-item2.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
attr-eq-token-tree.rs
attr-eq-token-tree.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
attr-mix-new.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
attr-shebang.rs Adjust tests/ui/attr-shebang.rs 2024-12-17 19:22:21 +08:00
attrs-on-params.rs
attrs-on-params.stderr
attrs-with-no-formal-in-generics-1.rs
attrs-with-no-formal-in-generics-1.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
attrs-with-no-formal-in-generics-2.rs
attrs-with-no-formal-in-generics-2.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
attrs-with-no-formal-in-generics-3.rs
attrs-with-no-formal-in-generics-3.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
check-builtin-attr-ice.rs tests: add regression test for incorrect "builtin attribute is checked" assertion ICE 2024-08-04 01:50:55 +00:00
check-builtin-attr-ice.stderr Reword "crate not found" resolve message 2025-01-24 01:19:50 +00:00
check-cfg_attr-ice.rs tests: add regression test to make sure cfg_attr isn't considered unhandled 2024-08-06 06:12:10 +00:00
check-cfg_attr-ice.stderr Reword "crate not found" resolve message 2025-01-24 01:19:50 +00:00
class-attributes-1.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
class-attributes-2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
collapse-debuginfo-invalid.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
collapse-debuginfo-invalid.stderr Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
const-stability-on-macro.rs Update since stability attributes in tests 2023-10-23 13:04:47 -07:00
const-stability-on-macro.stderr Update since stability attributes in tests 2023-10-23 13:04:47 -07:00
crate-name-empty.rs Add a test with an empty crate name. 2025-03-25 16:14:27 +11:00
crate-name-empty.stderr Add a test with an empty crate name. 2025-03-25 16:14:27 +11:00
crate-name-macro-call.rs Reject macro calls inside of #![crate_name] 2025-02-15 16:47:30 +01:00
crate-name-macro-call.stderr Reject macro calls inside of #![crate_name] 2025-02-15 16:47:30 +01:00
crate-type-delimited.rs Move #![crate_type] UI tests into attributes directory 2025-02-15 03:41:07 +01:00
crate-type-delimited.stderr Move #![crate_type] UI tests into attributes directory 2025-02-15 03:41:07 +01:00
crate-type-empty.rs Move #![crate_type] UI tests into attributes directory 2025-02-15 03:41:07 +01:00
crate-type-empty.stderr Move #![crate_type] UI tests into attributes directory 2025-02-15 03:41:07 +01:00
crate-type-macro-call.rs Move #![crate_type] UI tests into attributes directory 2025-02-15 03:41:07 +01:00
crate-type-macro-call.stderr Move #![crate_type] UI tests into attributes directory 2025-02-15 03:41:07 +01:00
crate-type-macro-empty.rs fix #137589 2025-02-25 18:17:32 +01:00
crate-type-macro-empty.stderr fix #137589 2025-02-25 18:17:32 +01:00
crate-type-macro-not-crate.rs fix #137589 2025-02-25 18:17:32 +01:00
crate-type-macro-not-crate.stderr fix #137589 2025-02-25 18:17:32 +01:00
crate-type-macro-not-found.rs fix #137589 2025-02-25 18:17:32 +01:00
crate-type-macro-not-found.stderr fix #137589 2025-02-25 18:17:32 +01:00
decl_macro_ty_in_attr_macro.rs add test to reproduce #137662 (using ty decl macro fragment in an attr) and fix it 2025-02-28 09:43:46 +01:00
doc-attr.rs Update ui tests 2024-02-29 14:43:43 +01:00
doc-attr.stderr Update ui tests 2024-02-29 14:43:43 +01:00
doc-test-literal.rs Update ui tests 2024-02-29 14:43:43 +01:00
doc-test-literal.stderr Update ui tests 2024-02-29 14:43:43 +01:00
dont-dup-expr-attrs.rs Fix problem causing rusqlite compilation to OOM. 2025-04-02 06:21:18 +11:00
dump-preds.rs Remove the -test suffix from normalize directives 2024-12-27 19:58:16 +11:00
dump-preds.stderr rustc_type_ir: derivative -> derive-where 2024-07-12 21:52:04 +03:00
dump_def_parents.rs Remove the -test suffix from normalize directives 2024-12-27 19:58:16 +11:00
dump_def_parents.stderr Filter empty lines, comments and delimiters from previous to last multiline span rendering 2024-12-12 23:36:27 +00:00
duplicated-attributes.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
duplicated-attributes.stderr
extented-attribute-macro-error.rs Remove the -test suffix from normalize directives 2024-12-27 19:58:16 +11:00
extented-attribute-macro-error.stderr Do not suggest using -Zmacro-backtrace for builtin macros 2025-03-14 19:50:03 +00:00
field-attributes-vis-unresolved.rs
field-attributes-vis-unresolved.stderr Reword "crate not found" resolve message 2025-01-24 01:19:50 +00:00
inner-attr-metavar.rs Fix a problem with metavars and inner attributes. 2025-04-02 06:21:18 +11:00
invalid-repr.rs add test for invalid places of repr align 2023-04-17 12:42:02 +00:00
invalid-repr.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
invalid-reprs.rs check if merged attributes list is empty 2025-04-05 06:09:14 +09:00
invalid-reprs.stderr check if merged attributes list is empty 2025-04-05 06:09:14 +09:00
invalid_macro_export_argument.deny.stderr Add invalid_macro_export_arguments to built-in macro list 2023-04-27 18:33:39 +00:00
invalid_macro_export_argument.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-40962.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-90873.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
issue-90873.stderr Make parse error suggestions verbose and fix spans 2024-07-12 03:02:57 +00:00
issue-100631.rs
issue-100631.stderr Fix test output expectations 2025-02-24 14:31:19 +01:00
issue-105594-invalid-attr-validation.rs remove #[cmse_nonsecure_entry] 2024-09-21 13:05:21 +02:00
issue-105594-invalid-attr-validation.stderr remove #[cmse_nonsecure_entry] 2024-09-21 13:05:21 +02:00
issue-115264-expr-field.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-115264-pat-field.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
item-attributes.rs Remove libc from rust_get_test_int uses 2024-04-17 09:18:14 -04:00
key-value-expansion-on-mac.rs Improve an error involving attribute values. 2023-12-12 15:54:25 +11:00
key-value-expansion-on-mac.stderr Improve an error involving attribute values. 2023-12-12 15:54:25 +11:00
key-value-expansion-scope-pass.rs resolve: Implement a lint for out-of-scope use of macro_rules 2024-06-24 17:12:08 +03:00
key-value-expansion-scope.rs Specify scope in out_of_scope_macro_calls lint 2025-02-19 18:29:00 +00:00
key-value-expansion-scope.stderr Reword message 2025-02-20 17:55:31 +00:00
key-value-expansion.rs Update tests. 2025-01-07 16:04:14 +01:00
key-value-expansion.stderr Improve an error involving attribute values. 2023-12-12 15:54:25 +11:00
key-value-non-ascii.rs
key-value-non-ascii.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
linkage.rs Emit an error for invalid use of the linkage attribute 2024-08-17 15:03:20 +09:00
linkage.stderr Emit an error for invalid use of the linkage attribute 2024-08-17 15:03:20 +09:00
log-backtrace.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
macro_export_on_decl_macro.rs check_attrs: Warn when #[macro_export] is used on macros 2.0 2023-08-07 21:14:28 +02:00
macro_export_on_decl_macro.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
main-removed-1.rs
main-removed-1.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
malformed-fn-align.rs add test to verify that #132391 can be closed 2025-02-24 14:31:19 +01:00
malformed-fn-align.stderr add test to verify that #132391 can be closed 2025-02-24 14:31:19 +01:00
may_dangle.rs Check that #[may_dangle] is properly applied 2024-08-18 20:32:00 +03:00
may_dangle.stderr Check that #[may_dangle] is properly applied 2024-08-18 20:32:00 +03:00
method-attributes.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
mixed_export_name_and_no_mangle.fixed Fix test output expectations 2025-02-24 14:31:19 +01:00
mixed_export_name_and_no_mangle.rs Fix test output expectations 2025-02-24 14:31:19 +01:00
mixed_export_name_and_no_mangle.stderr Fix test output expectations 2025-02-24 14:31:19 +01:00
multiple-invalid.rs
multiple-invalid.stderr
no-mangle-closure.rs Skip no_mangle if the item has no name. 2023-03-28 18:05:12 +00:00
no-mangle-closure.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
no-sanitize.rs Allow disabling ASan instrumentation for globals 2024-11-02 22:35:34 +01:00
no-sanitize.stderr Allow disabling ASan instrumentation for globals 2024-11-02 22:35:34 +01:00
nonterminal-expansion.rs Remove NtExpr and NtLiteral. 2025-04-02 06:20:35 +11:00
nonterminal-expansion.stderr Remove NtExpr and NtLiteral. 2025-04-02 06:20:35 +11:00
obsolete-attr.rs
obsolete-attr.stderr
optimize.rs misapplied optimize attribute throws a compilation error (#128488) 2024-10-20 08:34:15 -06:00
optimize.stderr misapplied optimize attribute throws a compilation error (#128488) 2024-10-20 08:34:15 -06:00
outer-mod-attr-applies-only-to-first.rs improves outer mod attribute test 2025-03-15 10:52:07 -06:00
repr-align-in-trait-issue-132391.rs Fix test output expectations 2025-02-24 14:31:19 +01:00
repr-align-in-trait-issue-132391.stderr Fix test output expectations 2025-02-24 14:31:19 +01:00
rustc_confusables.rs Deduplicate some logic and reword output 2024-02-22 18:05:28 +00:00
rustc_confusables.stderr Fix test output expectations 2025-02-24 14:31:19 +01:00
rustc_confusables_std_cases.rs Add get_line confusable to Stdin::read_line() 2024-10-02 23:19:26 -05:00
rustc_confusables_std_cases.stderr Trim suggestion parts to the subset that is purely additive 2025-02-14 00:44:10 -08:00
rustc_pub_transparent.rs New #[rustc_pub_transparent] attribute 2024-08-24 23:05:37 +03:00
rustc_pub_transparent.stderr New #[rustc_pub_transparent] attribute 2024-08-24 23:05:37 +03:00
statement-attribute-validation.rs Add regression test for #117058 2023-10-24 08:21:52 +00:00
statement-attribute-validation.stderr Add regression test for #117058 2023-10-24 08:21:52 +00:00
suffixed-literal-meta.rs
suffixed-literal-meta.stderr
tool_attributes.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
unknown-attr.rs
unknown-attr.stderr
unnamed-field-attributes-dup.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
unnamed-field-attributes-vis.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
unnamed-field-attributes.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
unrestricted-attribute-tokens.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
unused-item-in-attr.rs Improve an error involving attribute values. 2023-12-12 15:54:25 +11:00
unused-item-in-attr.stderr Improve an error involving attribute values. 2023-12-12 15:54:25 +11:00
used-issue-126789.rs Show used attribute's kind for user when find it isn't applied to a static variable. 2024-06-29 19:39:09 +08:00
used-issue-126789.stderr Show used attribute's kind for user when find it isn't applied to a static variable. 2024-06-29 19:39:09 +08:00
used_with_archive.rs Make #[used] work when linking with ld64 2025-02-24 04:04:59 +01:00
used_with_archive.run.stdout Make #[used] work when linking with ld64 2025-02-24 04:04:59 +01:00
used_with_arg.rs
used_with_arg.stderr
used_with_arg_no_mangle.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
used_with_multi_args.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
used_with_multi_args.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
validation-on-associated-items-issue-121537.rs fix attribute validation on associated items in traits 2024-02-24 08:14:38 -05:00
validation-on-associated-items-issue-121537.stderr fix attribute validation on associated items in traits 2024-02-24 08:14:38 -05:00
variant-attributes.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00