about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAman Arora <me@aman-arora.com>2020-11-04 03:07:40 -0500
committerRoxane <roxane.fruytier@hotmail.com>2020-11-29 19:11:20 -0500
commit5da2bf197d301f83716a209cb28ea2b403c8a20c (patch)
tree161dc4649cbc2bf30349f8160ada1222fe7ccc20 /src/test
parent349b3b324dade7ca638091db93ba08bbc443c63d (diff)
downloadrust-5da2bf197d301f83716a209cb28ea2b403c8a20c.tar.gz
rust-5da2bf197d301f83716a209cb28ea2b403c8a20c.zip
Remove extra call to upvar_tys
Fixes #78720
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/issues/issue-78720.rs19
-rw-r--r--src/test/ui/issues/issue-78720.stderr55
2 files changed, 74 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-78720.rs b/src/test/ui/issues/issue-78720.rs
new file mode 100644
index 00000000000..57615d1a207
--- /dev/null
+++ b/src/test/ui/issues/issue-78720.rs
@@ -0,0 +1,19 @@
+fn server() -> impl {
+//~^ ERROR at least one trait must be specified
+    ().map2(|| "")
+}
+
+trait FilterBase2 {
+    fn map2<F>(self, F) -> Map2<F> {}
+    //~^ ERROR mismatched types
+    //~^^ ERROR the size for values of type `Self` cannot be known at compilation time
+}
+
+struct Map2<Segment2> {
+    _func: F,
+    //~^ ERROR cannot find type `F` in this scope
+}
+
+impl<F> FilterBase2 for F {}
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-78720.stderr b/src/test/ui/issues/issue-78720.stderr
new file mode 100644
index 00000000000..a3a14e34acb
--- /dev/null
+++ b/src/test/ui/issues/issue-78720.stderr
@@ -0,0 +1,55 @@
+error: at least one trait must be specified
+  --> $DIR/issue-78720.rs:1:16
+   |
+LL | fn server() -> impl {
+   |                ^^^^
+
+error[E0412]: cannot find type `F` in this scope
+  --> $DIR/issue-78720.rs:13:12
+   |
+LL |     _func: F,
+   |            ^
+   | 
+  ::: $SRC_DIR/core/src/ops/function.rs:LL:COL
+   |
+LL | pub trait Fn<Args>: FnMut<Args> {
+   | ------------------------------- similarly named trait `Fn` defined here
+   |
+help: a trait with a similar name exists
+   |
+LL |     _func: Fn,
+   |            ^^
+help: you might be missing a type parameter
+   |
+LL | struct Map2<Segment2, F> {
+   |                     ^^^
+
+error[E0308]: mismatched types
+  --> $DIR/issue-78720.rs:7:36
+   |
+LL |     fn map2<F>(self, F) -> Map2<F> {}
+   |                                    ^^ expected struct `Map2`, found `()`
+   |
+   = note: expected struct `Map2<F>`
+           found unit type `()`
+
+error[E0277]: the size for values of type `Self` cannot be known at compilation time
+  --> $DIR/issue-78720.rs:7:16
+   |
+LL |     fn map2<F>(self, F) -> Map2<F> {}
+   |                ^^^^ doesn't have a size known at compile-time
+   |
+   = help: unsized fn params are gated as an unstable feature
+help: consider further restricting `Self`
+   |
+LL |     fn map2<F>(self, F) -> Map2<F> where Self: Sized {}
+   |                                    ^^^^^^^^^^^^^^^^^
+help: function arguments must have a statically known size, borrowed types always have a known size
+   |
+LL |     fn map2<F>(&self, F) -> Map2<F> {}
+   |                ^
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0277, E0308, E0412.
+For more information about an error, try `rustc --explain E0277`.