diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index af2a4977082..615f3301373 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -243,7 +243,7 @@ pub fn mk_printer(out: @io::Writer, linewidth: uint) -> @mut Printer { * the entire buffered window, but can't output anything until the size is >= * 0 (sizes are set to negative while they're pending calculation). * - * So SCAN takeks input and buffers tokens and pending calculations, while + * So SCAN takes input and buffers tokens and pending calculations, while * PRINT gobbles up completed calculations and tokens from the buffer. The * theory is that the two can never get more than 3N tokens apart, because * once there's "obviously" too much data to fit on a line, in a size diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index ec84cbda973..b5868cbc63d 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1535,15 +1535,15 @@ fn print_path_(s: @ps, print_ident(s, segment.identifier); - if segment.lifetime.is_some() || !segment.types.is_empty() { - // If this is the last segment, print the bounds. - if i == path.segments.len() - 1 { - match *opt_bounds { - None => {} - Some(ref bounds) => print_bounds(s, bounds, true), - } + // If this is the last segment, print the bounds. + if i == path.segments.len() - 1 { + match *opt_bounds { + None => {} + Some(ref bounds) => print_bounds(s, bounds, true), } + } + if segment.lifetime.is_some() || !segment.types.is_empty() { if colons_before_params { word(s.s, "::") } diff --git a/src/test/pretty/path-type-bounds.rs b/src/test/pretty/path-type-bounds.rs new file mode 100644 index 00000000000..a62fbdeeb18 --- /dev/null +++ b/src/test/pretty/path-type-bounds.rs @@ -0,0 +1,13 @@ +// pp-exact + +trait Tr { } +impl Tr for int; + +fn foo(x: ~Tr: Freeze) -> ~Tr: Freeze { x } + +fn main() { + let x: ~Tr: Freeze; + + ~1 as ~Tr: Freeze; +} + diff --git a/src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs b/src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs index 1492b5895ba..2f2b736294a 100644 --- a/src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs +++ b/src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// xfail-pretty #9253 pretty printer doesn't preserve the bounds on trait objects - /* #7673 Polymorphically creating traits barely works