Skip to content

Commit

Permalink
Fix pretty printer when there are multiple lifetime parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Nov 9, 2013
1 parent 98f7973 commit 044dec4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions src/libsyntax/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1572,17 +1572,24 @@ fn print_path_(s: @ps,
}
word(s.s, "<");

let mut comma = false;
for lifetime in segment.lifetimes.iter() {
print_lifetime(s, lifetime);
if !segment.types.is_empty() {
if comma {
word_space(s, ",")
}
print_lifetime(s, lifetime);
comma = true;
}

commasep(s,
inconsistent,
segment.types.map_to_vec(|t| (*t).clone()),
print_type);
if !segment.types.is_empty() {
if comma {
word_space(s, ",")
}
commasep(s,
inconsistent,
segment.types.map_to_vec(|t| (*t).clone()),
print_type);
}

word(s.s, ">")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn use_<'short,'long>(c: Invariant<'long>,
// 'short <= 'long, this would be true if the Invariant type were
// contravariant with respect to its parameter 'a.

let _: Invariant<'short> = c; //~ ERROR lifetime mistach
let _: Invariant<'short> = c; //~ ERROR mismatched types
}

fn main() { }

2 comments on commit 044dec4

@nikomatsakis
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=pnkfelix

@huonw
Copy link

@huonw huonw commented on 044dec4 Nov 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors: retry

Please sign in to comment.