Skip to content

Commit 2c27da0

Browse files
committed
syntax: Publically expose printing where clauses, and add attr_to_string
1 parent 1986c62 commit 2c27da0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3855,7 +3855,7 @@ impl<'a> Parser<'a> {
38553855
/// ```
38563856
/// where T : Trait<U, V> + 'b, 'a : 'b
38573857
/// ```
3858-
fn parse_where_clause(&mut self) -> PResult<ast::WhereClause> {
3858+
pub fn parse_where_clause(&mut self) -> PResult<ast::WhereClause> {
38593859
let mut where_clause = WhereClause {
38603860
id: ast::DUMMY_NODE_ID,
38613861
predicates: Vec::new(),

src/libsyntax/print/pprust.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,10 @@ pub fn stmt_to_string(stmt: &ast::Stmt) -> String {
352352
$to_string(|s| s.print_stmt(stmt))
353353
}
354354

355+
pub fn attr_to_string(attr: &ast::Attr) -> String {
356+
$to_string(|s| s.print_attribute(attr))
357+
}
358+
355359
pub fn item_to_string(i: &ast::Item) -> String {
356360
$to_string(|s| s.print_item(i))
357361
}

0 commit comments

Comments
 (0)