rust/compiler/rustc_lint/src
Nicholas Nethercote 3e3a4192d8 Split MacArgs in two.
`MacArgs` is an enum with three variants: `Empty`, `Delimited`, and `Eq`. It's
used in two ways:
- For representing attribute macro arguments (e.g. in `AttrItem`), where all
  three variants are used.
- For representing function-like macros (e.g. in `MacCall` and `MacroDef`),
  where only the `Delimited` variant is used.

In other words, `MacArgs` is used in two quite different places due to them
having partial overlap. I find this makes the code hard to read. It also leads
to various unreachable code paths, and allows invalid values (such as
accidentally using `MacArgs::Empty` in a `MacCall`).

This commit splits `MacArgs` in two:
- `DelimArgs` is a new struct just for the "delimited arguments" case. It is
  now used in `MacCall` and `MacroDef`.
- `AttrArgs` is a renaming of the old `MacArgs` enum for the attribute macro
  case. Its `Delimited` variant now contains a `DelimArgs`.

Various other related things are renamed as well.

These changes make the code clearer, avoids several unreachable paths, and
disallows the invalid values.
2022-11-22 09:04:15 +11:00
..
nonstandard_style mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
array_into_iter.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
builtin.rs Split MacArgs in two. 2022-11-22 09:04:15 +11:00
context.rs drive-by: PolyExistentialPredicate 2022-11-19 04:04:27 +00:00
early.rs Box ExprKind::{Closure,MethodCall}, and QSelf in expressions, types, and patterns. 2022-11-17 13:45:59 +11:00
enum_intrinsics_non_enums.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
errors.rs Convert all #[suggestion_*] attributes to #[suggestion(style = "...")] 2022-10-26 15:04:09 +02:00
expect.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
for_loops_over_fallibles.rs Use TraitEngine less 2022-11-02 04:11:05 +00:00
hidden_unicode_codepoints.rs Use token::Lit in ast::ExprKind::Lit. 2022-11-16 09:41:28 +11:00
internal.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
late.rs Store a LocalDefId in hir::Variant & hir::Field. 2022-11-13 14:06:51 +00:00
let_underscore.rs Merge branch 'master' into patch-2 2022-11-15 21:16:11 +01:00
levels.rs Store a LocalDefId in hir::Variant & hir::Field. 2022-11-13 14:06:51 +00:00
lib.rs fix: lint against lint functions 2022-11-07 19:23:29 -05:00
methods.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
non_ascii_idents.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
non_fmt_panic.rs Rm diagnostic item, use lang item 2022-11-18 06:16:20 +00:00
nonstandard_style.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
noop_method_call.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
opaque_hidden_inferred_bound.rs Rollup merge of #104483 - oli-obk:santa-clauses-make-goals, r=compiler-errors 2022-11-17 22:33:19 +01:00
pass_by_value.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
passes.rs Remove unused argument from check_mac_def. 2022-09-12 14:05:54 +10:00
redundant_semicolon.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
tests.rs Update to last upstream version 2021-07-08 17:14:28 +02:00
traits.rs Rename some OwnerId fields. 2022-10-29 20:28:38 +11:00
types.rs Rollup merge of #104296 - compiler-errors:opaque-ty-ffi-normalization-cycle, r=lcnr 2022-11-15 10:44:10 +01:00
unused.rs Change to Ty::is_inhabited_from 2022-11-20 19:04:11 -06:00