[macro_metavar_expr_concat] Allow concat in repetitions#127720
[macro_metavar_expr_concat] Allow concat in repetitions#127720bors merged 1 commit intorust-lang:masterfrom
macro_metavar_expr_concat] Allow concat in repetitions#127720Conversation
|
I created a new issue for the problem and referenced that in your description, your previous "fixes" would have closed the tracking issue. |
|
☔ The latest upstream changes (presumably #127892) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@cjgillot If preferable, the dice of rustbot can be re-rolled |
| match *self { | ||
| MetaVarExpr::Count(ident, _) | MetaVarExpr::Ignore(ident) => Some(ident), | ||
| MetaVarExpr::Concat { .. } | MetaVarExpr::Index(..) | MetaVarExpr::Len(..) => None, | ||
| pub(crate) fn metavars<A>(&self, mut aux: A, mut cb: impl FnMut(A, &Ident) -> A) -> A { |
There was a problem hiding this comment.
Could we get this signature?
This would make the logic a bit easier to read in consumer code.
| pub(crate) fn metavars<A>(&self, mut aux: A, mut cb: impl FnMut(A, &Ident) -> A) -> A { | |
| pub(crate) fn for_each_metavar(&self, mut cb: impl FnMut(&Ident)) { |
There was a problem hiding this comment.
That was my first attempt. Unfortunately, LockstepIterSize::with takes ownership.
The name has been changed.
| ident: Ident, | ||
| interp: &FxHashMap<MacroRulesNormalizedIdent, NamedMatch>, | ||
| pnr: &ParseNtResult, | ||
| ) -> PResult<'a, Symbol> { |
There was a problem hiding this comment.
Could you make all this a match?
There was a problem hiding this comment.
Refactored to use match but it is important to note that the only diff in this function is the removal of the outer most block.
|
|
||
| /// Extracts an metavariable symbol that can be an identifier, a token tree or a literal. | ||
| fn extract_var_symbol<'a>( | ||
| fn extract_symbol_from_pnr<'a>( |
There was a problem hiding this comment.
The jargon is getting a bit obscure. It took me a while to figure what a pnr is. "Parc Naturel Régional"?
There was a problem hiding this comment.
Non, ce n'est pas "Parc Naturel Régional" :)
pnr is in the function signature and extract_symbol_from_parse_nt_result would be too long IMO.
| fn extract_var_symbol<'a>( | ||
| fn extract_symbol_from_pnr<'a>( | ||
| dcx: DiagCtxtHandle<'a>, | ||
| ident: Ident, |
There was a problem hiding this comment.
Should we only pass the span? It may be interesting to document that it's meant for error reporting only.
|
@rustbot review |
|
@bors r+ |
|
Thanks |
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#127720 ([`macro_metavar_expr_concat`] Allow `concat` in repetitions) - rust-lang#127734 (Windows: move BSD socket shims to netc) - rust-lang#127752 (Ignore allocation bytes in one more mir-opt test) - rust-lang#127839 (Fix git safe-directory path for docker images) - rust-lang#127867 (Add `wasm32-wasip2` to `build-manifest` tool) - rust-lang#127958 (Cleanup rmake.rs setup in compiletest) - rust-lang#127975 (Fix trait bounds display) - rust-lang#128005 (Remove _tls_used hack) r? `@ghost` `@rustbot` modify labels: rollup
[`macro_metavar_expr_concat`] Allow `concat` in repetitions cc rust-lang#127723
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#127720 ([`macro_metavar_expr_concat`] Allow `concat` in repetitions) - rust-lang#127734 (Windows: move BSD socket shims to netc) - rust-lang#127752 (Ignore allocation bytes in one more mir-opt test) - rust-lang#127839 (Fix git safe-directory path for docker images) - rust-lang#127867 (Add `wasm32-wasip2` to `build-manifest` tool) - rust-lang#127958 (Cleanup rmake.rs setup in compiletest) - rust-lang#127975 (Fix trait bounds display) - rust-lang#128005 (Remove _tls_used hack) r? `@ghost` `@rustbot` modify labels: rollup
…mpiler-errors Rollup of 7 pull requests Successful merges: - rust-lang#126450 (Promote Mac Catalyst targets to Tier 2, and ship with rustup) - rust-lang#127177 (Distribute rustc_codegen_cranelift for arm64 macOS) - rust-lang#127510 (Rewrite `test-float-parse` in Rust) - rust-lang#127720 ([`macro_metavar_expr_concat`] Allow `concat` in repetitions) - rust-lang#127734 (Windows: move BSD socket shims to netc) - rust-lang#127839 (Fix git safe-directory path for docker images) - rust-lang#128005 (Remove _tls_used hack) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#127720 - c410-f3r:concat-rep, r=cjgillot [`macro_metavar_expr_concat`] Allow `concat` in repetitions cc rust-lang#127723
cc #127723