Files
rust/tests/pretty/block-index-paren.pp
Andrew V. Teylu 56f43b5142 Parenthesize block-like expressions in call callee of pretty printer
When a macro expands to a call whose callee is a block (or other
"complete" expression like `match`, `if`, `loop`), the AST pretty
printer emits the callee without parentheses. In statement position
the closing brace ends the expression and the argument list is parsed
as a separate tuple expression, producing a parse error.
2026-04-08 14:52:01 +01:00

18 lines
408 B
Rust

#![feature(prelude_import)]
#![no_std]
extern crate std;
#[prelude_import]
use ::std::prelude::rust_2015::*;
//@ pretty-mode:expanded
//@ pp-exact:block-index-paren.pp
macro_rules! block_arr { () => {{ [0u8; 4] }}; }
macro_rules! as_slice { () => {{ &block_arr!()[..] }}; }
macro_rules! group { ($e:expr) => { $e }; }
fn scope() { &({ drop })(0); }
fn main() { let _: &[u8] = { &({ [0u8; 4] })[..] }; }