about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPhilip Munksgaard <pmunksgaard@gmail.com>2014-12-18 13:10:41 +0100
committerPhilip Munksgaard <pmunksgaard@gmail.com>2014-12-19 11:06:38 +0100
commit3bb91aa28fd36173a87dd9dd47e120d5223042e2 (patch)
tree9dc81648ffbc8caa2b9d17fb09a90cf3d7eda65a /src
parentc0b2885ee12b79c99ac8245edb6eebaaa8e7fef1 (diff)
downloadrust-3bb91aa28fd36173a87dd9dd47e120d5223042e2.tar.gz
rust-3bb91aa28fd36173a87dd9dd47e120d5223042e2.zip
Add a check for uninferred type parameter
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. We now explicitly check if `strs[0]` is a single element tuple.
Diffstat (limited to 'src')
-rw-r--r--src/librustc/util/ppaux.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index 13b5c262bf7..b534823c2c5 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -543,7 +543,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(", "))