Skip to content

Commit d047536

Browse files
committed
Report unexpected verbatim literals in test
1 parent ce97767 commit d047536

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/test_precedence.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,9 @@ fn librustc_parenthesize(mut librustc_expr: Box<ast::Expr>) -> Box<ast::Expr> {
385385

386386
fn syn_parenthesize(syn_expr: syn::Expr) -> syn::Expr {
387387
use syn::fold::{fold_expr, fold_generic_argument, Fold};
388-
use syn::{token, BinOp, Expr, ExprParen, GenericArgument, MetaNameValue, Pat, Stmt, Type};
388+
use syn::{
389+
token, BinOp, Expr, ExprParen, GenericArgument, Lit, MetaNameValue, Pat, Stmt, Type,
390+
};
389391

390392
struct FullyParenthesize;
391393

@@ -463,6 +465,13 @@ fn syn_parenthesize(syn_expr: syn::Expr) -> syn::Expr {
463465
fn fold_type(&mut self, ty: Type) -> Type {
464466
ty
465467
}
468+
469+
fn fold_lit(&mut self, lit: Lit) -> Lit {
470+
if let Lit::Verbatim(lit) = &lit {
471+
panic!("unexpected verbatim literal: {lit}");
472+
}
473+
lit
474+
}
466475
}
467476

468477
let mut folder = FullyParenthesize;

0 commit comments

Comments
 (0)