Fix span issue with generic method calls

This commit is contained in:
Marcus Klaas 2015-11-13 14:53:34 +01:00
parent 686ec52b50
commit c93c771e71
3 changed files with 18 additions and 4 deletions

View File

@ -217,15 +217,17 @@ fn rewrite_method_call(method_name: ast::Ident,
width: usize,
offset: Indent)
-> Option<String> {
let type_str = if types.is_empty() {
String::new()
let (lo, type_str) = if types.is_empty() {
(args[0].span.hi, String::new())
} else {
let type_list = types.iter().map(|ty| pprust::ty_to_string(ty)).collect::<Vec<_>>();
format!("::<{}>", type_list.join(", "))
(types.last().unwrap().span.hi,
format!("::<{}>", type_list.join(", ")))
};
let callee_str = format!(".{}{}", method_name, type_str);
let span = mk_sp(args[0].span.hi, span.hi);
let span = mk_sp(lo, span.hi);
rewrite_call(context, &callee_str, &args[1..], span, width, offset)
}

View File

@ -106,3 +106,9 @@ fn is_replaced_content() -> bool {
constellat.send(ConstellationMsg::ViewportConstrained(
self.id, constraints)).unwrap();
}
fn issue587() {
a.b::<()>(c);
std::mem::transmute(dl.symbol::<()>("init").unwrap())
}

View File

@ -132,3 +132,9 @@ fn is_replaced_content() -> bool {
constellat.send(ConstellationMsg::ViewportConstrained(self.id, constraints))
.unwrap();
}
fn issue587() {
a.b::<()>(c);
std::mem::transmute(dl.symbol::<()>("init").unwrap())
}