Skip to content

pretty-print bounds in paths with no generic params #9264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 18, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libsyntax/print/pp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions src/libsyntax/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, "::")
}
Expand Down
13 changes: 13 additions & 0 deletions src/test/pretty/path-type-bounds.rs
Original file line number Diff line number Diff line change
@@ -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;
}

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down