summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReese Williams <rtwill722@gmail.com>2019-12-02 21:52:04 -0500
committerReese Williams <rtwill722@gmail.com>2019-12-02 22:01:27 -0500
commit7693bb9e1d122bea1b0645dcc201c6ed79c910e2 (patch)
tree743cd8c89aabb51017a1492df875695172fcb540
parentAuto merge of #66874 - RalfJung:miri-assert-panic, r=oli-obk (diff)
downloadrust-7693bb9e1d122bea1b0645dcc201c6ed79c910e2.tar.gz
rust-7693bb9e1d122bea1b0645dcc201c6ed79c910e2.tar.bz2
rust-7693bb9e1d122bea1b0645dcc201c6ed79c910e2.tar.xz
Add long error for E0631 and update ui tests.
-rw-r--r--src/librustc_error_codes/error_codes.rs2
-rw-r--r--src/librustc_error_codes/error_codes/E0631.md29
-rw-r--r--src/test/ui/anonymous-higher-ranked-lifetime.stderr1
-rw-r--r--src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr3
-rw-r--r--src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr1
-rw-r--r--src/test/ui/closures/issue-41366.stderr3
-rw-r--r--src/test/ui/issues/issue-43623.stderr3
-rw-r--r--src/test/ui/issues/issue-60283.stderr3
-rw-r--r--src/test/ui/mismatched_types/E0631.stderr1
-rw-r--r--src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr3
-rw-r--r--src/test/ui/mismatched_types/closure-mismatch.stderr3
-rw-r--r--src/test/ui/mismatched_types/fn-variance-1.stderr1
-rw-r--r--src/test/ui/mismatched_types/issue-36053-2.stderr3
-rw-r--r--src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr1
14 files changed, 49 insertions, 8 deletions
diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs
index 7f111b4..9e4b704 100644
--- a/src/librustc_error_codes/error_codes.rs
+++ b/src/librustc_error_codes/error_codes.rs
@@ -347,6 +347,7 @@ E0622: include_str!("./error_codes/E0622.md"),
347E0623: include_str!("./error_codes/E0623.md"), 347E0623: include_str!("./error_codes/E0623.md"),
348E0624: include_str!("./error_codes/E0624.md"), 348E0624: include_str!("./error_codes/E0624.md"),
349E0626: include_str!("./error_codes/E0626.md"), 349E0626: include_str!("./error_codes/E0626.md"),
350E0631: include_str!("./error_codes/E0631.md"),
350E0633: include_str!("./error_codes/E0633.md"), 351E0633: include_str!("./error_codes/E0633.md"),
351E0635: include_str!("./error_codes/E0635.md"), 352E0635: include_str!("./error_codes/E0635.md"),
352E0636: include_str!("./error_codes/E0636.md"), 353E0636: include_str!("./error_codes/E0636.md"),
@@ -580,7 +581,6 @@ E0745: include_str!("./error_codes/E0745.md"),
580 // rustc_const_unstable attribute must be paired with stable/unstable 581 // rustc_const_unstable attribute must be paired with stable/unstable
581 // attribute 582 // attribute
582 E0630, 583 E0630,
583 E0631, // type mismatch in closure arguments
584 E0632, // cannot provide explicit generic arguments when `impl Trait` is 584 E0632, // cannot provide explicit generic arguments when `impl Trait` is
585 // used in argument position 585 // used in argument position
586 E0634, // type has conflicting packed representaton hints 586 E0634, // type has conflicting packed representaton hints
diff --git a/src/librustc_error_codes/error_codes/E0631.md b/src/librustc_error_codes/error_codes/E0631.md
new file mode 100644
index 0000000..ad419f8
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0631.md
@@ -0,0 +1,29 @@
1This error indicates a type mismatch in closure arguments.
2
3Erroneous code example:
4
5```compile_fail,E0631
6fn test_strings(string_vec: Vec<String>) -> Vec<bool> {
7 string_vec
8 .iter()
9 .map(|arg: &i32| arg.eq("Test String"))
10 .collect()
11}
12```
13
14The closure passed to `map` expects a `&String` argument, since `some_vec`
15has the type `Vec<String>`.
16However, the closure argument is annotated as an `&i32`, which does not match
17the type of the iterable.
18
19This can be resolved by changing the type annotation or removing it entirely
20if it can be inferred.
21
22```
23fn test_strings(string_vec: Vec<String>) -> Vec<bool> {
24 string_vec
25 .iter()
26 .map(|arg| arg.eq("Test String"))
27 .collect()
28}
29```
diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.stderr b/src/test/ui/anonymous-higher-ranked-lifetime.stderr
index 9be44c7..c6d9a61 100644
--- a/src/test/ui/anonymous-higher-ranked-lifetime.stderr
+++ b/src/test/ui/anonymous-higher-ranked-lifetime.stderr
@@ -121,3 +121,4 @@ LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(),
121 121
122error: aborting due to 11 previous errors 122error: aborting due to 11 previous errors
123 123
124For more information about this error, try `rustc --explain E0631`.
diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr
index a154442..0033395 100644
--- a/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr
+++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr
@@ -77,4 +77,5 @@ LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| {
77 77
78error: aborting due to 5 previous errors 78error: aborting due to 5 previous errors
79 79
80For more information about this error, try `rustc --explain E0308`. 80Some errors have detailed explanations: E0308, E0631.
81For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr
index 9fbe95a..1c6564e 100644
--- a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr
+++ b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr
@@ -13,3 +13,4 @@ LL | with_closure(|x: u32, y: i32| {
13 13
14error: aborting due to previous error 14error: aborting due to previous error
15 15
16For more information about this error, try `rustc --explain E0631`.
diff --git a/src/test/ui/closures/issue-41366.stderr b/src/test/ui/closures/issue-41366.stderr
index 91d26ef..2f2871e 100644
--- a/src/test/ui/closures/issue-41366.stderr
+++ b/src/test/ui/closures/issue-41366.stderr
@@ -19,4 +19,5 @@ LL | (&|_|()) as &dyn for<'x> Fn(<u32 as T<'x>>::V);
19 19
20error: aborting due to 2 previous errors 20error: aborting due to 2 previous errors
21 21
22For more information about this error, try `rustc --explain E0271`. 22Some errors have detailed explanations: E0271, E0631.
23For more information about an error, try `rustc --explain E0271`.
diff --git a/src/test/ui/issues/issue-43623.stderr b/src/test/ui/issues/issue-43623.stderr
index 2c57b85..d90eb53 100644
--- a/src/test/ui/issues/issue-43623.stderr
+++ b/src/test/ui/issues/issue-43623.stderr
@@ -25,4 +25,5 @@ LL | break_me::<Type, fn(_)>;
25 25
26error: aborting due to 2 previous errors 26error: aborting due to 2 previous errors
27 27
28For more information about this error, try `rustc --explain E0271`. 28Some errors have detailed explanations: E0271, E0631.
29For more information about an error, try `rustc --explain E0271`.
diff --git a/src/test/ui/issues/issue-60283.stderr b/src/test/ui/issues/issue-60283.stderr
index 69c1d85..d13dcd5 100644
--- a/src/test/ui/issues/issue-60283.stderr
+++ b/src/test/ui/issues/issue-60283.stderr
@@ -27,4 +27,5 @@ LL | foo((), drop)
27 27
28error: aborting due to 2 previous errors 28error: aborting due to 2 previous errors
29 29
30For more information about this error, try `rustc --explain E0271`. 30Some errors have detailed explanations: E0271, E0631.
31For more information about an error, try `rustc --explain E0271`.
diff --git a/src/test/ui/mismatched_types/E0631.stderr b/src/test/ui/mismatched_types/E0631.stderr
index 88c1efd..06f5c05 100644
--- a/src/test/ui/mismatched_types/E0631.stderr
+++ b/src/test/ui/mismatched_types/E0631.stderr
@@ -46,3 +46,4 @@ LL | bar(f);
46 46
47error: aborting due to 4 previous errors 47error: aborting due to 4 previous errors
48 48
49For more information about this error, try `rustc --explain E0631`.
diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr
index 85cad61..ed50282 100644
--- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr
+++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr
@@ -45,4 +45,5 @@ LL | baz(f);
45 45
46error: aborting due to 5 previous errors 46error: aborting due to 5 previous errors
47 47
48For more information about this error, try `rustc --explain E0271`. 48Some errors have detailed explanations: E0271, E0631.
49For more information about an error, try `rustc --explain E0271`.
diff --git a/src/test/ui/mismatched_types/closure-mismatch.stderr b/src/test/ui/mismatched_types/closure-mismatch.stderr
index fd2b9f3..f3874c0 100644
--- a/src/test/ui/mismatched_types/closure-mismatch.stderr
+++ b/src/test/ui/mismatched_types/closure-mismatch.stderr
@@ -24,4 +24,5 @@ LL | baz(|_| ());
24 24
25error: aborting due to 2 previous errors 25error: aborting due to 2 previous errors
26 26
27For more information about this error, try `rustc --explain E0271`. 27Some errors have detailed explanations: E0271, E0631.
28For more information about an error, try `rustc --explain E0271`.
diff --git a/src/test/ui/mismatched_types/fn-variance-1.stderr b/src/test/ui/mismatched_types/fn-variance-1.stderr
index 1a82dd5..88c9266 100644
--- a/src/test/ui/mismatched_types/fn-variance-1.stderr
+++ b/src/test/ui/mismatched_types/fn-variance-1.stderr
@@ -24,3 +24,4 @@ LL | apply(&mut 3, takes_imm);
24 24
25error: aborting due to 2 previous errors 25error: aborting due to 2 previous errors
26 26
27For more information about this error, try `rustc --explain E0631`.
diff --git a/src/test/ui/mismatched_types/issue-36053-2.stderr b/src/test/ui/mismatched_types/issue-36053-2.stderr
index 72f3220..da018aa 100644
--- a/src/test/ui/mismatched_types/issue-36053-2.stderr
+++ b/src/test/ui/mismatched_types/issue-36053-2.stderr
@@ -18,4 +18,5 @@ LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
18 18
19error: aborting due to 2 previous errors 19error: aborting due to 2 previous errors
20 20
21For more information about this error, try `rustc --explain E0599`. 21Some errors have detailed explanations: E0599, E0631.
22For more information about an error, try `rustc --explain E0599`.
diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr
index 2daf478..3c999f2 100644
--- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr
+++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr
@@ -12,3 +12,4 @@ LL | let z = call_it(3, f);
12 12
13error: aborting due to previous error 13error: aborting due to previous error
14 14
15For more information about this error, try `rustc --explain E0631`.