diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-12-21 00:04:04 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-12-21 09:26:44 -0800 |
| commit | ca521fb7a91f6d6ab05af8f4dffdfaa474699abb (patch) | |
| tree | 2fd0a711a3956ac4c24a26ca41ea1aade804a730 | |
| parent | 1d34d93d117ef97f4034f06c62020bc1c919b175 (diff) | |
| parent | 3bb91aa28fd36173a87dd9dd47e120d5223042e2 (diff) | |
| download | rust-ca521fb7a91f6d6ab05af8f4dffdfaa474699abb.tar.gz rust-ca521fb7a91f6d6ab05af8f4dffdfaa474699abb.zip | |
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.
| -rw-r--r-- | src/librustc/util/ppaux.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index b0124977c9f..f1ec1e133a3 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -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(", ")) |
