diff options
| author | varkor <github@varkor.com> | 2019-02-05 16:50:16 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-02-07 15:02:16 +0100 |
| commit | b4ef753e8f45a67f6756ad4c9103e0e327a1e078 (patch) | |
| tree | 0f166cda41204e15aed2a8e7e0e86b87ec7335da /src/libsyntax | |
| parent | d7695abb7667d2e8b7a010282ad5f44abbc58a58 (diff) | |
| download | rust-b4ef753e8f45a67f6756ad4c9103e0e327a1e078.tar.gz rust-b4ef753e8f45a67f6756ad4c9103e0e327a1e078.zip | |
Add pretty-printing for const generics
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index c7c4c4f1620..c670f47b597 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1025,6 +1025,7 @@ impl<'a> State<'a> { match generic_arg { GenericArg::Lifetime(lt) => self.print_lifetime(*lt), GenericArg::Type(ty) => self.print_type(ty), + GenericArg::Const(ct) => self.print_expr(&ct.value), } } @@ -2929,7 +2930,7 @@ impl<'a> State<'a> { s.print_outer_attributes_inline(¶m.attrs)?; let lt = ast::Lifetime { id: param.id, ident: param.ident }; s.print_lifetime_bounds(lt, ¶m.bounds) - }, + } ast::GenericParamKind::Type { ref default } => { s.print_outer_attributes_inline(¶m.attrs)?; s.print_ident(param.ident)?; @@ -2943,6 +2944,15 @@ impl<'a> State<'a> { _ => Ok(()) } } + ast::GenericParamKind::Const { ref ty } => { + s.print_outer_attributes_inline(¶m.attrs)?; + s.word_space("const")?; + s.print_ident(param.ident)?; + s.s.space()?; + s.word_space(":")?; + s.print_type(ty)?; + s.print_type_bounds(":", ¶m.bounds) + } } })?; |
