1
Fork 0

auto merge of #13079 : alexcrichton/rust/colons, r=cmr

The previous syntax was `Foo:Bound<trait-parameters>`, but this is a little
ambiguous because it was being parsed as `Foo: (Bound<trait-parameters)` rather
than `Foo: (Bound) <trait-parameters>`

This commit changes the syntax to `Foo<trait-parameters>: Bound` in order to be
clear where the trait parameters are going.

Closes #9265
This commit is contained in:
bors 2014-03-26 19:32:01 -07:00
commit c329a17461
7 changed files with 59 additions and 73 deletions

View file

@ -1526,7 +1526,7 @@ impl<'a> State<'a> {
}
let mut first = true;
for (i, segment) in path.segments.iter().enumerate() {
for segment in path.segments.iter() {
if first {
first = false
} else {
@ -1535,14 +1535,6 @@ impl<'a> State<'a> {
try!(self.print_ident(segment.identifier));
// If this is the last segment, print the bounds.
if i == path.segments.len() - 1 {
match *opt_bounds {
None => {}
Some(ref bounds) => try!(self.print_bounds(bounds, true)),
}
}
if !segment.lifetimes.is_empty() || !segment.types.is_empty() {
if colons_before_params {
try!(word(&mut self.s, "::"))
@ -1571,7 +1563,11 @@ impl<'a> State<'a> {
try!(word(&mut self.s, ">"))
}
}
Ok(())
match *opt_bounds {
None => Ok(()),
Some(ref bounds) => self.print_bounds(bounds, true),
}
}
fn print_path(&mut self, path: &ast::Path,