about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-12-20 14:47:21 +0000
committerbors <bors@rust-lang.org>2017-12-20 14:47:21 +0000
commit81622c6b02536bdcf56145beb317da0d336703c1 (patch)
tree2624499fcf70ff3d8f4072b6aab9a42b9ec9342a /src/libsyntax
parentdf8dfdeff68e60a68d026a3374cfb8159d0495cb (diff)
parent66e5c790682204d35191dd62332c6f503cdeddbd (diff)
downloadrust-81622c6b02536bdcf56145beb317da0d336703c1.tar.gz
rust-81622c6b02536bdcf56145beb317da0d336703c1.zip
Auto merge of #46874 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests

- Successful merges: #46359, #46517, #46671, #46751, #46760, #46787, #46794, #46828, #46831, #46835, #46851, #46852, #46856, #46870
- Failed merges:
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/parse/parser.rs2
-rw-r--r--src/libsyntax/print/pprust.rs35
2 files changed, 19 insertions, 18 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index c3dd17e8775..74ec11b83c7 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1553,7 +1553,7 @@ impl<'a> Parser<'a> {
             if self.eat(&token::Not) {
                 // Macro invocation in type position
                 let (_, tts) = self.expect_delimited_token_tree()?;
-                TyKind::Mac(respan(lo.to(self.span), Mac_ { path: path, tts: tts }))
+                TyKind::Mac(respan(lo.to(self.prev_span), Mac_ { path: path, tts: tts }))
             } else {
                 // Just a type path or bound list (trait object type) starting with a trait.
                 //   `Type`
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index e9386e5187f..da4d5f5f676 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -1066,11 +1066,11 @@ impl<'a> State<'a> {
                 self.print_qpath(path, qself, false)?
             }
             ast::TyKind::TraitObject(ref bounds, syntax) => {
-                let prefix = if syntax == ast::TraitObjectSyntax::Dyn { "dyn " } else { "" };
+                let prefix = if syntax == ast::TraitObjectSyntax::Dyn { "dyn" } else { "" };
                 self.print_bounds(prefix, &bounds[..])?;
             }
             ast::TyKind::ImplTrait(ref bounds) => {
-                self.print_bounds("impl ", &bounds[..])?;
+                self.print_bounds("impl", &bounds[..])?;
             }
             ast::TyKind::Array(ref ty, ref v) => {
                 self.s.word("[")?;
@@ -1398,7 +1398,8 @@ impl<'a> State<'a> {
                         real_bounds.push(b.clone());
                     }
                 }
-                self.print_bounds(" = ", &real_bounds[..])?;
+                self.nbsp()?;
+                self.print_bounds("=", &real_bounds[..])?;
                 self.print_where_clause(&generics.where_clause)?;
                 self.s.word(";")?;
             }
@@ -1444,6 +1445,7 @@ impl<'a> State<'a> {
                 comma = true;
             }
             self.s.word(">")?;
+            self.nbsp()?;
         }
         Ok(())
     }
@@ -2818,30 +2820,29 @@ impl<'a> State<'a> {
             self.s.word(prefix)?;
             let mut first = true;
             for bound in bounds {
-                self.nbsp()?;
+                if !(first && prefix.is_empty()) {
+                    self.nbsp()?;
+                }
                 if first {
                     first = false;
                 } else {
                     self.word_space("+")?;
                 }
 
-                (match *bound {
-                    TraitTyParamBound(ref tref, TraitBoundModifier::None) => {
-                        self.print_poly_trait_ref(tref)
-                    }
-                    TraitTyParamBound(ref tref, TraitBoundModifier::Maybe) => {
-                        self.s.word("?")?;
-                        self.print_poly_trait_ref(tref)
+                match bound {
+                    TraitTyParamBound(tref, modifier) => {
+                        if modifier == &TraitBoundModifier::Maybe {
+                            self.s.word("?")?;
+                        }
+                        self.print_poly_trait_ref(tref)?;
                     }
-                    RegionTyParamBound(ref lt) => {
-                        self.print_lifetime(lt)
+                    RegionTyParamBound(lt) => {
+                        self.print_lifetime(lt)?;
                     }
-                })?
+                }
             }
-            Ok(())
-        } else {
-            Ok(())
         }
+        Ok(())
     }
 
     pub fn print_lifetime(&mut self,