summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_ast_pretty/src
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_ast_pretty/src')
-rw-r--r--compiler/rustc_ast_pretty/src/pprust/mod.rs4
-rw-r--r--compiler/rustc_ast_pretty/src/pprust/state.rs7
-rw-r--r--compiler/rustc_ast_pretty/src/pprust/state/expr.rs5
-rw-r--r--compiler/rustc_ast_pretty/src/pprust/state/item.rs28
4 files changed, 31 insertions, 13 deletions
diff --git a/compiler/rustc_ast_pretty/src/pprust/mod.rs b/compiler/rustc_ast_pretty/src/pprust/mod.rs
index ac9e7d06c..83b7e1390 100644
--- a/compiler/rustc_ast_pretty/src/pprust/mod.rs
+++ b/compiler/rustc_ast_pretty/src/pprust/mod.rs
@@ -32,6 +32,10 @@ pub fn bounds_to_string(bounds: &[ast::GenericBound]) -> String {
State::new().bounds_to_string(bounds)
}
+pub fn where_bound_predicate_to_string(where_bound_predicate: &ast::WhereBoundPredicate) -> String {
+ State::new().where_bound_predicate_to_string(where_bound_predicate)
+}
+
pub fn pat_to_string(pat: &ast::Pat) -> String {
State::new().pat_to_string(pat)
}
diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs
index 3f80728a2..59239b49e 100644
--- a/compiler/rustc_ast_pretty/src/pprust/state.rs
+++ b/compiler/rustc_ast_pretty/src/pprust/state.rs
@@ -824,6 +824,13 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
Self::to_string(|s| s.print_type_bounds(bounds))
}
+ fn where_bound_predicate_to_string(
+ &self,
+ where_bound_predicate: &ast::WhereBoundPredicate,
+ ) -> String {
+ Self::to_string(|s| s.print_where_bound_predicate(where_bound_predicate))
+ }
+
fn pat_to_string(&self, pat: &ast::Pat) -> String {
Self::to_string(|s| s.print_pat(pat))
}
diff --git a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
index 87c32ffce..609920180 100644
--- a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
+++ b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
@@ -537,6 +537,11 @@ impl<'a> State<'a> {
self.print_expr_maybe_paren(expr, parser::PREC_JUMP);
}
}
+ ast::ExprKind::Become(result) => {
+ self.word("become");
+ self.word(" ");
+ self.print_expr_maybe_paren(result, parser::PREC_JUMP);
+ }
ast::ExprKind::InlineAsm(a) => {
// FIXME: This should have its own syntax, distinct from a macro invocation.
self.word("asm!");
diff --git a/compiler/rustc_ast_pretty/src/pprust/state/item.rs b/compiler/rustc_ast_pretty/src/pprust/state/item.rs
index c465f8c94..5c01b7ea7 100644
--- a/compiler/rustc_ast_pretty/src/pprust/state/item.rs
+++ b/compiler/rustc_ast_pretty/src/pprust/state/item.rs
@@ -623,19 +623,8 @@ impl<'a> State<'a> {
pub fn print_where_predicate(&mut self, predicate: &ast::WherePredicate) {
match predicate {
- ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate {
- bound_generic_params,
- bounded_ty,
- bounds,
- ..
- }) => {
- self.print_formal_generic_params(bound_generic_params);
- self.print_type(bounded_ty);
- self.word(":");
- if !bounds.is_empty() {
- self.nbsp();
- self.print_type_bounds(bounds);
- }
+ ast::WherePredicate::BoundPredicate(where_bound_predicate) => {
+ self.print_where_bound_predicate(where_bound_predicate);
}
ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate {
lifetime,
@@ -658,6 +647,19 @@ impl<'a> State<'a> {
}
}
+ pub fn print_where_bound_predicate(
+ &mut self,
+ where_bound_predicate: &ast::WhereBoundPredicate,
+ ) {
+ self.print_formal_generic_params(&where_bound_predicate.bound_generic_params);
+ self.print_type(&where_bound_predicate.bounded_ty);
+ self.word(":");
+ if !where_bound_predicate.bounds.is_empty() {
+ self.nbsp();
+ self.print_type_bounds(&where_bound_predicate.bounds);
+ }
+ }
+
fn print_use_tree(&mut self, tree: &ast::UseTree) {
match &tree.kind {
ast::UseTreeKind::Simple(rename) => {