about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-04-28 12:28:24 +0000
committerbors <bors@rust-lang.org>2020-04-28 12:28:24 +0000
commitb7bd7c1024a1449449c3ae7b4b4c63a904a620e6 (patch)
tree9c580230414c88a55eba7dd075fa6274cde01da8 /src/test/ui
parentd7afaa7247cc81e0cca7aa438aa1e1672328c0a2 (diff)
parent6cad1e30061a80a47faf6a2e1b3626de5af3c48d (diff)
downloadrust-b7bd7c1024a1449449c3ae7b4b4c63a904a620e6.tar.gz
rust-b7bd7c1024a1449449c3ae7b4b4c63a904a620e6.zip
Auto merge of #71636 - Dylan-DPC:rollup-9gc24ak, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #71311 (On `FnDef` type annotation suggestion, use fn-pointer output)
 - #71488 (normalize field projection ty to fix broken MIR issue)
 - #71489 (Fix off by one in treat err as bug)
 - #71585 (remove obsolete comment)
 - #71634 (Revert #71372 ("Fix #! (shebang) stripping account space issue").)

Failed merges:

r? @ghost
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/consts/issue-70773-mir-typeck-lt-norm.rs1
-rw-r--r--src/test/ui/suggestions/fn-needing-specified-return-type-param.rs5
-rw-r--r--src/test/ui/suggestions/fn-needing-specified-return-type-param.stderr11
3 files changed, 17 insertions, 0 deletions
diff --git a/src/test/ui/consts/issue-70773-mir-typeck-lt-norm.rs b/src/test/ui/consts/issue-70773-mir-typeck-lt-norm.rs
index 07af8310424..9d44aa1361c 100644
--- a/src/test/ui/consts/issue-70773-mir-typeck-lt-norm.rs
+++ b/src/test/ui/consts/issue-70773-mir-typeck-lt-norm.rs
@@ -7,6 +7,7 @@ fn init_hash(_: &mut [u8; HASH_LEN]) {}
 fn foo<'a>() -> &'a () {
     Hash([0; HASH_LEN]);
     init_hash(&mut [0; HASH_LEN]);
+    let (_array,) = ([0; HASH_LEN],);
     &()
 }
 
diff --git a/src/test/ui/suggestions/fn-needing-specified-return-type-param.rs b/src/test/ui/suggestions/fn-needing-specified-return-type-param.rs
new file mode 100644
index 00000000000..2f140f823af
--- /dev/null
+++ b/src/test/ui/suggestions/fn-needing-specified-return-type-param.rs
@@ -0,0 +1,5 @@
+fn f<A>() -> A { unimplemented!() }
+fn foo() {
+    let _ = f; //~ ERROR type annotations needed for `fn() -> A`
+}
+fn main() {}
diff --git a/src/test/ui/suggestions/fn-needing-specified-return-type-param.stderr b/src/test/ui/suggestions/fn-needing-specified-return-type-param.stderr
new file mode 100644
index 00000000000..b59a3818e70
--- /dev/null
+++ b/src/test/ui/suggestions/fn-needing-specified-return-type-param.stderr
@@ -0,0 +1,11 @@
+error[E0282]: type annotations needed for `fn() -> A`
+  --> $DIR/fn-needing-specified-return-type-param.rs:3:13
+   |
+LL |     let _ = f;
+   |         -   ^ cannot infer type for type parameter `A` declared on the function `f`
+   |         |
+   |         consider giving this pattern the explicit type `fn() -> A`, where the type parameter `A` is specified
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.