diff options
| author | Trevor Gross <tmgross@umich.edu> | 2025-06-20 17:10:57 -0400 |
|---|---|---|
| committer | Trevor Gross <tmgross@umich.edu> | 2025-06-30 19:02:36 +0000 |
| commit | a1a066999b9fbfc10e93931d9a552bf87dc32e4d (patch) | |
| tree | 18d43ed69c37cd2fb4555a78b4bd382d93e85286 | |
| parent | 3d9e5104610dfef38f6772b097baa8fa2d6a60c1 (diff) | |
| download | rust-a1a066999b9fbfc10e93931d9a552bf87dc32e4d.tar.gz rust-a1a066999b9fbfc10e93931d9a552bf87dc32e4d.zip | |
mbe: Move `MetaVarExprConcatElem` closer to where it is used
Move this structure directly above the `parse_<expr>` functions that return it to keep top-down flow. This is a non-functional change.
| -rw-r--r-- | compiler/rustc_expand/src/mbe/metavar_expr.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/compiler/rustc_expand/src/mbe/metavar_expr.rs b/compiler/rustc_expand/src/mbe/metavar_expr.rs index 396d65b6f9d..ffd3548019a 100644 --- a/compiler/rustc_expand/src/mbe/metavar_expr.rs +++ b/compiler/rustc_expand/src/mbe/metavar_expr.rs @@ -87,20 +87,6 @@ impl MetaVarExpr { } } -/// Indicates what is placed in a `concat` parameter. For example, literals -/// (`${concat("foo", "bar")}`) or adhoc identifiers (`${concat(foo, bar)}`). -#[derive(Debug, Decodable, Encodable, PartialEq)] -pub(crate) enum MetaVarExprConcatElem { - /// Identifier WITHOUT a preceding dollar sign, which means that this identifier should be - /// interpreted as a literal. - Ident(Ident), - /// For example, a number or a string. - Literal(Symbol), - /// Identifier WITH a preceding dollar sign, which means that this identifier should be - /// expanded and interpreted as a variable. - Var(Ident), -} - // Checks if there are any remaining tokens. For example, `${ignore(ident ... a b c ...)}` fn check_trailing_token<'psess>( iter: &mut TokenStreamIter<'_>, @@ -117,6 +103,20 @@ fn check_trailing_token<'psess>( } } +/// Indicates what is placed in a `concat` parameter. For example, literals +/// (`${concat("foo", "bar")}`) or adhoc identifiers (`${concat(foo, bar)}`). +#[derive(Debug, Decodable, Encodable, PartialEq)] +pub(crate) enum MetaVarExprConcatElem { + /// Identifier WITHOUT a preceding dollar sign, which means that this identifier should be + /// interpreted as a literal. + Ident(Ident), + /// For example, a number or a string. + Literal(Symbol), + /// Identifier WITH a preceding dollar sign, which means that this identifier should be + /// expanded and interpreted as a variable. + Var(Ident), +} + /// Parse a meta-variable `concat` expression: `concat($metavar, ident, ...)`. fn parse_concat<'psess>( iter: &mut TokenStreamIter<'_>, |
