rollup merge of #19979: Munksgaard/19978

This fixes #19978. The bug was introduced by 570325d, where if the type
of an Fn has not been inferred (strs[0] is "_") we slice from 1 to 0.
This commit is contained in:
Alex Crichton 2014-12-21 00:04:04 -08:00
commit ca521fb7a9

View File

@ -532,7 +532,11 @@ pub fn parameterized<'tcx>(cx: &ctxt<'tcx>,
if cx.lang_items.fn_trait_kind(did).is_some() {
format!("{}({}){}",
base,
strs[0][1 .. strs[0].len() - (strs[0].ends_with(",)") as uint+1)],
if strs[0].starts_with("(") && strs[0].ends_with(",)") {
strs[0][1 .. strs[0].len() - 2] // Remove '(' and ',)'
} else {
strs[0][]
},
if &*strs[1] == "()" { String::new() } else { format!(" -> {}", strs[1]) })
} else if strs.len() > 0 {
format!("{}<{}>", base, strs.connect(", "))