about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-12-12 00:22:30 +0000
committerbors <bors@rust-lang.org>2016-12-12 00:22:30 +0000
commit5e2f37fca9a792a8780e6f427e77ca0fe707bd47 (patch)
treeb3043e095e7f7ab6398ab00c467f996a9df60fbb /src/test
parent3db197aa9d343c7974b06a9b18ae5f78d5c64637 (diff)
parentd24028b5a83f9bbad6eca2d276ad7c0f625f6f01 (diff)
downloadrust-5e2f37fca9a792a8780e6f427e77ca0fe707bd47.tar.gz
rust-5e2f37fca9a792a8780e6f427e77ca0fe707bd47.zip
Auto merge of #38057 - KiChjang:display-formal-type-param, r=nikomatsakis
Display better error messages for E0282

Fixes #36554.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/issue-23046.rs2
-rw-r--r--src/test/compile-fail/issue-5062.rs2
-rw-r--r--src/test/compile-fail/issue-6458-2.rs2
-rw-r--r--src/test/compile-fail/issue-6458-3.rs4
-rw-r--r--src/test/compile-fail/issue-6458.rs4
-rw-r--r--src/test/compile-fail/issue-7813.rs4
-rw-r--r--src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs2
-rw-r--r--src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs4
-rw-r--r--src/test/compile-fail/unconstrained-none.rs4
-rw-r--r--src/test/compile-fail/unconstrained-ref.rs4
-rw-r--r--src/test/compile-fail/vector-no-ann.rs4
-rw-r--r--src/test/ui/codemap_tests/repair_span_std_macros.stderr4
-rw-r--r--src/test/ui/missing-items/missing-type-parameter.rs15
-rw-r--r--src/test/ui/missing-items/missing-type-parameter.stderr10
14 files changed, 45 insertions, 20 deletions
diff --git a/src/test/compile-fail/issue-23046.rs b/src/test/compile-fail/issue-23046.rs
index dba9c32f9b4..c274665530f 100644
--- a/src/test/compile-fail/issue-23046.rs
+++ b/src/test/compile-fail/issue-23046.rs
@@ -25,6 +25,6 @@ pub fn let_<'var, VAR, F: for<'v: 'var> Fn(Expr<'v, VAR>) -> Expr<'v, VAR>>
 
 fn main() {
     let ex = |x| {
-        let_(add(x,x), |y| { //~ ERROR unable to infer enough type information about `_`
+        let_(add(x,x), |y| { //~ ERROR unable to infer enough type information about `VAR`
             let_(add(x, x), |x|x)})};
 }
diff --git a/src/test/compile-fail/issue-5062.rs b/src/test/compile-fail/issue-5062.rs
index f5aa4fadbed..cf78d6d8c0a 100644
--- a/src/test/compile-fail/issue-5062.rs
+++ b/src/test/compile-fail/issue-5062.rs
@@ -9,4 +9,4 @@
 // except according to those terms.
 
 fn main() { format!("{:?}", None); }
-    //~^ ERROR unable to infer enough type information about `_` [E0282]
+    //~^ ERROR unable to infer enough type information about `T` [E0282]
diff --git a/src/test/compile-fail/issue-6458-2.rs b/src/test/compile-fail/issue-6458-2.rs
index 71f28054579..3816896d43d 100644
--- a/src/test/compile-fail/issue-6458-2.rs
+++ b/src/test/compile-fail/issue-6458-2.rs
@@ -11,5 +11,5 @@
 fn main() {
     // Unconstrained type:
     format!("{:?}", None);
-    //~^ ERROR unable to infer enough type information about `_` [E0282]
+    //~^ ERROR unable to infer enough type information about `T` [E0282]
 }
diff --git a/src/test/compile-fail/issue-6458-3.rs b/src/test/compile-fail/issue-6458-3.rs
index e397805565b..8029522f5d3 100644
--- a/src/test/compile-fail/issue-6458-3.rs
+++ b/src/test/compile-fail/issue-6458-3.rs
@@ -12,7 +12,7 @@ use std::mem;
 
 fn main() {
     mem::transmute(0);
-    //~^ ERROR unable to infer enough type information about `_` [E0282]
-    //~| NOTE cannot infer type for `_`
+    //~^ ERROR unable to infer enough type information about `U` [E0282]
+    //~| NOTE cannot infer type for `U`
     //~| NOTE type annotations or generic parameter binding
 }
diff --git a/src/test/compile-fail/issue-6458.rs b/src/test/compile-fail/issue-6458.rs
index a64522a0e5b..f8354ddbf12 100644
--- a/src/test/compile-fail/issue-6458.rs
+++ b/src/test/compile-fail/issue-6458.rs
@@ -17,8 +17,8 @@ pub fn foo<State>(_: TypeWithState<State>) {}
 
 pub fn bar() {
    foo(TypeWithState(marker::PhantomData));
-   //~^ ERROR unable to infer enough type information about `_` [E0282]
-   //~| NOTE cannot infer type for `_`
+   //~^ ERROR unable to infer enough type information about `State` [E0282]
+   //~| NOTE cannot infer type for `State`
    //~| NOTE type annotations or generic parameter binding
 }
 
diff --git a/src/test/compile-fail/issue-7813.rs b/src/test/compile-fail/issue-7813.rs
index e3cb1d0c7da..e37a8816423 100644
--- a/src/test/compile-fail/issue-7813.rs
+++ b/src/test/compile-fail/issue-7813.rs
@@ -10,7 +10,7 @@
 
 fn main() {
     let v = &[];
-    let it = v.iter(); //~ ERROR unable to infer enough type information about `_` [E0282]
-                       //~| NOTE cannot infer type for `_`
+    let it = v.iter(); //~ ERROR unable to infer enough type information about `T` [E0282]
+                       //~| NOTE cannot infer type for `T`
                        //~| NOTE type annotations or generic parameter binding
 }
diff --git a/src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs b/src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs
index 4f86909765e..1cf41f95a2d 100644
--- a/src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs
+++ b/src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs
@@ -32,7 +32,7 @@ impl foo for Vec<isize> {
 fn m1() {
     // we couldn't infer the type of the vector just based on calling foo()...
     let mut x = Vec::new();
-    //~^ ERROR unable to infer enough type information about `_` [E0282]
+    //~^ ERROR unable to infer enough type information about `T` [E0282]
     x.foo();
 }
 
diff --git a/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs b/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs
index e6545063dbd..ed2ffa995e5 100644
--- a/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs
+++ b/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs
@@ -34,8 +34,8 @@ where T : Convert<U>
 
 fn a() {
     test(22, std::default::Default::default());
-    //~^ ERROR unable to infer enough type information about `_` [E0282]
-    //~| NOTE cannot infer type for `_`
+    //~^ ERROR unable to infer enough type information about `U` [E0282]
+    //~| NOTE cannot infer type for `U`
     //~| NOTE type annotations or generic parameter binding
 }
 
diff --git a/src/test/compile-fail/unconstrained-none.rs b/src/test/compile-fail/unconstrained-none.rs
index 380cdd266cd..88080bc70ca 100644
--- a/src/test/compile-fail/unconstrained-none.rs
+++ b/src/test/compile-fail/unconstrained-none.rs
@@ -11,7 +11,7 @@
 // Issue #5062
 
 fn main() {
-    None; //~ ERROR unable to infer enough type information about `_` [E0282]
-          //~| NOTE cannot infer type for `_`
+    None; //~ ERROR unable to infer enough type information about `T` [E0282]
+          //~| NOTE cannot infer type for `T`
           //~| NOTE type annotations or generic parameter binding
 }
diff --git a/src/test/compile-fail/unconstrained-ref.rs b/src/test/compile-fail/unconstrained-ref.rs
index ba94bf613d2..12278549215 100644
--- a/src/test/compile-fail/unconstrained-ref.rs
+++ b/src/test/compile-fail/unconstrained-ref.rs
@@ -13,7 +13,7 @@ struct S<'a, T:'a> {
 }
 
 fn main() {
-    S { o: &None }; //~ ERROR unable to infer enough type information about `_` [E0282]
-                    //~| NOTE cannot infer type for `_`
+    S { o: &None }; //~ ERROR unable to infer enough type information about `T` [E0282]
+                    //~| NOTE cannot infer type for `T`
                     //~| NOTE type annotations or generic parameter binding
 }
diff --git a/src/test/compile-fail/vector-no-ann.rs b/src/test/compile-fail/vector-no-ann.rs
index 25709f35246..d559caf77a1 100644
--- a/src/test/compile-fail/vector-no-ann.rs
+++ b/src/test/compile-fail/vector-no-ann.rs
@@ -11,7 +11,7 @@
 
 fn main() {
     let _foo = Vec::new();
-    //~^ ERROR unable to infer enough type information about `_` [E0282]
-    //~| NOTE cannot infer type for `_`
+    //~^ ERROR unable to infer enough type information about `T` [E0282]
+    //~| NOTE cannot infer type for `T`
     //~| NOTE type annotations or generic parameter binding
 }
diff --git a/src/test/ui/codemap_tests/repair_span_std_macros.stderr b/src/test/ui/codemap_tests/repair_span_std_macros.stderr
index 73a1c5bae85..7e0d778a3b2 100644
--- a/src/test/ui/codemap_tests/repair_span_std_macros.stderr
+++ b/src/test/ui/codemap_tests/repair_span_std_macros.stderr
@@ -1,8 +1,8 @@
-error[E0282]: unable to infer enough type information about `_`
+error[E0282]: unable to infer enough type information about `T`
   --> $DIR/repair_span_std_macros.rs:12:13
    |
 12 |     let x = vec![];
-   |             ^^^^^^ cannot infer type for `_`
+   |             ^^^^^^ cannot infer type for `T`
    |
    = note: type annotations or generic parameter binding required
    = note: this error originates in a macro outside of the current crate
diff --git a/src/test/ui/missing-items/missing-type-parameter.rs b/src/test/ui/missing-items/missing-type-parameter.rs
new file mode 100644
index 00000000000..3671abd6624
--- /dev/null
+++ b/src/test/ui/missing-items/missing-type-parameter.rs
@@ -0,0 +1,15 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo<X>() { }
+
+fn main() {
+    foo();
+}
diff --git a/src/test/ui/missing-items/missing-type-parameter.stderr b/src/test/ui/missing-items/missing-type-parameter.stderr
new file mode 100644
index 00000000000..2d007af4980
--- /dev/null
+++ b/src/test/ui/missing-items/missing-type-parameter.stderr
@@ -0,0 +1,10 @@
+error[E0282]: unable to infer enough type information about `X`
+  --> $DIR/missing-type-parameter.rs:14:5
+   |
+14 |     foo();
+   |     ^^^ cannot infer type for `X`
+   |
+   = note: type annotations or generic parameter binding required
+
+error: aborting due to previous error
+