From c62c908f083ae5cc1fa914bba9837db054995450 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Mon, 4 May 2015 10:21:39 +0200 Subject: [PATCH] Correct pretty-printing of `type Foo where T: Bound = ...;` Fix #25031 --- src/libsyntax/print/pprust.rs | 2 +- src/test/pretty/issue-25031.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/test/pretty/issue-25031.rs diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 87c164f7550..5c1f6cc12f5 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -903,10 +903,10 @@ impl<'a> State<'a> { try!(self.print_generics(params)); try!(self.end()); // end the inner ibox + try!(self.print_where_clause(¶ms.where_clause)); try!(space(&mut self.s)); try!(self.word_space("=")); try!(self.print_type(&**ty)); - try!(self.print_where_clause(¶ms.where_clause)); try!(word(&mut self.s, ";")); try!(self.end()); // end the outer ibox } diff --git a/src/test/pretty/issue-25031.rs b/src/test/pretty/issue-25031.rs new file mode 100644 index 00000000000..6c5a847869e --- /dev/null +++ b/src/test/pretty/issue-25031.rs @@ -0,0 +1,17 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// Testing that type items with where clauses output correctly. + +// pp-exact + +fn main() { + type Foo where T: Copy = Box; +}