Skip to content

Commit ba5b6f3

Browse files
committed
Switch pretty-printer roundtrip test to better parser
1 parent b100d8e commit ba5b6f3

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

tests/ui-fulldeps/pprust-expr-roundtrip.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
extern crate rustc_ast;
2323
extern crate rustc_ast_pretty;
2424
extern crate rustc_data_structures;
25+
extern crate rustc_errors;
2526
extern crate rustc_parse;
2627
extern crate rustc_session;
2728
extern crate rustc_span;
@@ -32,27 +33,20 @@ extern crate thin_vec;
3233
#[allow(unused_extern_crates)]
3334
extern crate rustc_driver;
3435

36+
#[path = "auxiliary/parser.rs"]
37+
mod parser;
38+
3539
use rustc_ast::mut_visit::{visit_clobber, MutVisitor};
3640
use rustc_ast::ptr::P;
3741
use rustc_ast::*;
3842
use rustc_ast_pretty::pprust;
39-
use rustc_parse::{new_parser_from_source_str, unwrap_or_emit_fatal};
4043
use rustc_session::parse::ParseSess;
4144
use rustc_span::source_map::Spanned;
4245
use rustc_span::symbol::Ident;
43-
use rustc_span::{FileName, DUMMY_SP};
46+
use rustc_span::DUMMY_SP;
4447
use thin_vec::{thin_vec, ThinVec};
4548

46-
fn parse_expr(psess: &ParseSess, src: &str) -> Option<P<Expr>> {
47-
let src_as_string = src.to_string();
48-
49-
let mut p = unwrap_or_emit_fatal(new_parser_from_source_str(
50-
psess,
51-
FileName::Custom(src_as_string.clone()),
52-
src_as_string,
53-
));
54-
p.parse_expr().map_err(|e| e.cancel()).ok()
55-
}
49+
use crate::parser::parse_expr;
5650

5751
// Helper functions for building exprs
5852
fn expr(kind: ExprKind) -> P<Expr> {

0 commit comments

Comments
 (0)