Skip to content

Commit ca521fb

Browse files
committed
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.
2 parents 1d34d93 + 3bb91aa commit ca521fb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/librustc/util/ppaux.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,11 @@ pub fn parameterized<'tcx>(cx: &ctxt<'tcx>,
532532
if cx.lang_items.fn_trait_kind(did).is_some() {
533533
format!("{}({}){}",
534534
base,
535-
strs[0][1 .. strs[0].len() - (strs[0].ends_with(",)") as uint+1)],
535+
if strs[0].starts_with("(") && strs[0].ends_with(",)") {
536+
strs[0][1 .. strs[0].len() - 2] // Remove '(' and ',)'
537+
} else {
538+
strs[0][]
539+
},
536540
if &*strs[1] == "()" { String::new() } else { format!(" -> {}", strs[1]) })
537541
} else if strs.len() > 0 {
538542
format!("{}<{}>", base, strs.connect(", "))

0 commit comments

Comments
 (0)