about summary refs log tree commit diff
path: root/src/libsyntax/print
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2018-05-28 13:33:28 +0100
committervarkor <github@varkor.com>2018-06-20 12:22:46 +0100
commitaed530a457dd937fa633dfe52cf07811196d3173 (patch)
treed7848036bf766e1153e965028d8c4c5c8ecb5940 /src/libsyntax/print
parenta5328bc17b8d18083478554b3381d55183647f15 (diff)
downloadrust-aed530a457dd937fa633dfe52cf07811196d3173.tar.gz
rust-aed530a457dd937fa633dfe52cf07811196d3173.zip
Lift bounds into GenericParam
Diffstat (limited to 'src/libsyntax/print')
-rw-r--r--src/libsyntax/print/pprust.rs23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 84a4a51b716..c8d139c7de9 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -12,7 +12,7 @@ pub use self::AnnNode::*;
 
 use rustc_target::spec::abi::{self, Abi};
 use ast::{self, BlockCheckMode, PatKind, RangeEnd, RangeSyntax};
-use ast::{SelfKind, RegionTyParamBound, TraitTyParamBound, TraitBoundModifier};
+use ast::{SelfKind, Outlives, TraitTyParamBound, TraitBoundModifier};
 use ast::{Attribute, MacDelimiter, GenericArg};
 use util::parser::{self, AssocOp, Fixity};
 use attr;
@@ -292,7 +292,7 @@ pub fn ty_to_string(ty: &ast::Ty) -> String {
     to_string(|s| s.print_type(ty))
 }
 
-pub fn bounds_to_string(bounds: &[ast::TyParamBound]) -> String {
+pub fn bounds_to_string(bounds: &[ast::ParamBound]) -> String {
     to_string(|s| s.print_bounds("", bounds))
 }
 
@@ -1178,7 +1178,7 @@ impl<'a> State<'a> {
 
     fn print_associated_type(&mut self,
                              ident: ast::Ident,
-                             bounds: Option<&ast::TyParamBounds>,
+                             bounds: Option<&ast::ParamBounds>,
                              ty: Option<&ast::Ty>)
                              -> io::Result<()> {
         self.word_space("type")?;
@@ -2811,7 +2811,7 @@ impl<'a> State<'a> {
 
     pub fn print_bounds(&mut self,
                         prefix: &str,
-                        bounds: &[ast::TyParamBound])
+                        bounds: &[ast::ParamBound])
                         -> io::Result<()> {
         if !bounds.is_empty() {
             self.s.word(prefix)?;
@@ -2833,7 +2833,7 @@ impl<'a> State<'a> {
                         }
                         self.print_poly_trait_ref(tref)?;
                     }
-                    RegionTyParamBound(lt) => {
+                    Outlives(lt) => {
                         self.print_lifetime(lt)?;
                     }
                 }
@@ -2879,14 +2879,19 @@ impl<'a> State<'a> {
 
         self.commasep(Inconsistent, &generic_params, |s, param| {
             match param.kind {
-                ast::GenericParamKind::Lifetime { ref bounds, ref lifetime } => {
+                ast::GenericParamKind::Lifetime { ref lifetime } => {
                     s.print_outer_attributes_inline(&param.attrs)?;
-                    s.print_lifetime_bounds(lifetime, bounds)
+                    s.print_lifetime_bounds(lifetime, &param.bounds.iter().map(|bound| {
+                        match bound {
+                            ast::ParamBound::Outlives(lt) => *lt,
+                            _ => panic!(),
+                        }
+                    }).collect::<Vec<_>>().as_slice())
                 },
-                ast::GenericParamKind::Type { ref bounds, ref default } => {
+                ast::GenericParamKind::Type { ref default } => {
                     s.print_outer_attributes_inline(&param.attrs)?;
                     s.print_ident(param.ident)?;
-                    s.print_bounds(":", bounds)?;
+                    s.print_bounds(":", &param.bounds)?;
                     match default {
                         Some(ref default) => {
                             s.s.space()?;