rust/compiler/rustc_metadata/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
..
rmeta Split MacArgs in two. 2022-11-22 09:04:15 +11:00
creader.rs Rewrite implementation of #[alloc_error_handler] 2022-10-31 16:32:57 +00:00
dependency_format.rs Rollup merge of #100928 - CleanCut:rustc_metadata_diagnostics, r=davidtwco 2022-09-03 10:33:05 +05:30
errors.rs Auto merge of #103217 - mejrs:track, r=eholk 2022-11-01 21:09:45 +00:00
foreign_modules.rs Rename some OwnerId fields. 2022-10-29 20:28:38 +11:00
fs.rs Wrap bundlen static libraries into object files 2022-11-14 12:01:49 +03:00
lib.rs Wrap bundlen static libraries into object files 2022-11-14 12:01:49 +03:00
locator.rs Rollup merge of #100928 - CleanCut:rustc_metadata_diagnostics, r=davidtwco 2022-09-03 10:33:05 +05:30
native_libs.rs Rename some OwnerId fields. 2022-10-29 20:28:38 +11:00