E0623: include_str!("./error_codes/E0623.md"),
E0624: include_str!("./error_codes/E0624.md"),
E0626: include_str!("./error_codes/E0626.md"),
+E0631: include_str!("./error_codes/E0631.md"),
E0633: include_str!("./error_codes/E0633.md"),
E0635: include_str!("./error_codes/E0635.md"),
E0636: include_str!("./error_codes/E0636.md"),
// rustc_const_unstable attribute must be paired with stable/unstable
// attribute
E0630,
- E0631, // type mismatch in closure arguments
E0632, // cannot provide explicit generic arguments when `impl Trait` is
// used in argument position
E0634, // type has conflicting packed representaton hints
--- /dev/null
+This error indicates a type mismatch in closure arguments.
+
+Erroneous code example:
+
+```compile_fail,E0631
+fn test_strings(string_vec: Vec<String>) -> Vec<bool> {
+ string_vec
+ .iter()
+ .map(|arg: &i32| arg.eq("Test String"))
+ .collect()
+}
+```
+
+The closure passed to `map` expects a `&String` argument, since `some_vec`
+has the type `Vec<String>`.
+However, the closure argument is annotated as an `&i32`, which does not match
+the type of the iterable.
+
+This can be resolved by changing the type annotation or removing it entirely
+if it can be inferred.
+
+```
+fn test_strings(string_vec: Vec<String>) -> Vec<bool> {
+ string_vec
+ .iter()
+ .map(|arg| arg.eq("Test String"))
+ .collect()
+}
+```
error: aborting due to 11 previous errors
+For more information about this error, try `rustc --explain E0631`.
error: aborting due to 5 previous errors
-For more information about this error, try `rustc --explain E0308`.
+Some errors have detailed explanations: E0308, E0631.
+For more information about an error, try `rustc --explain E0308`.
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0631`.
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0271`.
+Some errors have detailed explanations: E0271, E0631.
+For more information about an error, try `rustc --explain E0271`.
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0271`.
+Some errors have detailed explanations: E0271, E0631.
+For more information about an error, try `rustc --explain E0271`.
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0271`.
+Some errors have detailed explanations: E0271, E0631.
+For more information about an error, try `rustc --explain E0271`.
error: aborting due to 4 previous errors
+For more information about this error, try `rustc --explain E0631`.
error: aborting due to 5 previous errors
-For more information about this error, try `rustc --explain E0271`.
+Some errors have detailed explanations: E0271, E0631.
+For more information about an error, try `rustc --explain E0271`.
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0271`.
+Some errors have detailed explanations: E0271, E0631.
+For more information about an error, try `rustc --explain E0271`.
error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0631`.
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0599`.
+Some errors have detailed explanations: E0599, E0631.
+For more information about an error, try `rustc --explain E0599`.
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0631`.