about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc-ui/pub-use-primitive-document-private-items-95633.rs (renamed from tests/rustdoc/issue-95633.rs)2
-rw-r--r--tests/rustdoc/asref-for-and-of-local-82465.rs (renamed from tests/rustdoc/issue-82465-asref-for-and-of-local.rs)5
-rw-r--r--tests/rustdoc/enum-variant-doc-hidden-field-88600.rs (renamed from tests/rustdoc/issue-88600.rs)4
-rw-r--r--tests/rustdoc/heading-levels-89309.rs (renamed from tests/rustdoc/issue-89309-heading-levels.rs)1
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/issue-85454.rs (renamed from tests/rustdoc/auxiliary/issue-85454.rs)0
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/reexport-with-anonymous-lifetime-98697.rs (renamed from tests/rustdoc/auxiliary/issue-98697-reexport-with-anonymous-lifetime.rs)0
-rw-r--r--tests/rustdoc/inline_cross/qpath-self-85454.rs (renamed from tests/rustdoc/issue-85454.rs)1
-rw-r--r--tests/rustdoc/inline_cross/reexport-with-anonymous-lifetime-98697.rs18
-rw-r--r--tests/rustdoc/inline_local/blanket-impl-reexported-trait-94183.rs (renamed from tests/rustdoc/issue-94183-blanket-impl-reexported-trait.rs)1
-rw-r--r--tests/rustdoc/inline_local/private-reexport-in-public-api-81141-2.rs (renamed from tests/rustdoc/issue-81141-private-reexport-in-public-api-2.rs)1
-rw-r--r--tests/rustdoc/inline_local/private-reexport-in-public-api-81141.rs (renamed from tests/rustdoc/issue-81141-private-reexport-in-public-api.rs)1
-rw-r--r--tests/rustdoc/inline_local/private-reexport-in-public-api-generics-81141.rs (renamed from tests/rustdoc/issue-81141-private-reexport-in-public-api-generics.rs)1
-rw-r--r--tests/rustdoc/inline_local/private-reexport-in-public-api-hidden-81141.rs (renamed from tests/rustdoc/issue-81141-private-reexport-in-public-api-hidden.rs)1
-rw-r--r--tests/rustdoc/inline_local/private-reexport-in-public-api-private-81141.rs (renamed from tests/rustdoc/issue-81141-private-reexport-in-public-api-private.rs)1
-rw-r--r--tests/rustdoc/inline_local/reexported-macro-and-macro-export-sidebar-89852.rs16
-rw-r--r--tests/rustdoc/issue-86620.rs9
-rw-r--r--tests/rustdoc/issue-89852.rs14
-rw-r--r--tests/rustdoc/issue-95873.rs2
-rw-r--r--tests/rustdoc/issue-98697.rs17
-rw-r--r--tests/rustdoc/method-anchor-in-blanket-impl-86620.rs11
-rw-r--r--tests/rustdoc/multiple-macro-rules-w-same-name-submodule-99221.rs (renamed from tests/rustdoc/issue-99221-multiple-macro-rules-w-same-name-submodule.rs)1
-rw-r--r--tests/rustdoc/multiple-mods-w-same-name-doc-inline-83375.rs (renamed from tests/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline-last-item.rs)7
-rw-r--r--tests/rustdoc/multiple-mods-w-same-name-doc-inline-last-item-83375.rs (renamed from tests/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline.rs)7
-rw-r--r--tests/rustdoc/pub-use-root-path-95873.rs5
-rw-r--r--tests/rustdoc/synthetic_auto/normalize-auto-trait-80233.rs (renamed from tests/rustdoc/issue-80233-normalize-auto-trait.rs)4
-rw-r--r--tests/rustdoc/underscore-type-in-trait-impl-96381.rs (renamed from tests/rustdoc/issue-96381.rs)1
-rw-r--r--tests/ui/async-await/async-closures/force-move-due-to-actually-fnonce.rs27
-rw-r--r--tests/ui/async-await/async-closures/force-move-due-to-inferred-kind.rs24
28 files changed, 131 insertions, 51 deletions
diff --git a/tests/rustdoc/issue-95633.rs b/tests/rustdoc-ui/pub-use-primitive-document-private-items-95633.rs
index 5695ef579f2..d53a67cde8b 100644
--- a/tests/rustdoc/issue-95633.rs
+++ b/tests/rustdoc-ui/pub-use-primitive-document-private-items-95633.rs
@@ -1,6 +1,8 @@
+//@ check-pass
 //@ compile-flags: --document-private-items
 
 // This ensures that no ICE is triggered when rustdoc is run on this code.
+// https://github.com/rust-lang/rust/issues/95633
 
 mod stdlib {
     pub (crate) use std::i8;
diff --git a/tests/rustdoc/issue-82465-asref-for-and-of-local.rs b/tests/rustdoc/asref-for-and-of-local-82465.rs
index adf4d111a6c..e6204688904 100644
--- a/tests/rustdoc/issue-82465-asref-for-and-of-local.rs
+++ b/tests/rustdoc/asref-for-and-of-local-82465.rs
@@ -1,7 +1,10 @@
+// https://github.com/rust-lang/rust/issues/82465
+#![crate_name = "foo"]
+
 use std::convert::AsRef;
 pub struct Local;
 
-// @has issue_82465_asref_for_and_of_local/struct.Local.html '//h3[@class="code-header"]' 'impl AsRef<str> for Local'
+// @has foo/struct.Local.html '//h3[@class="code-header"]' 'impl AsRef<str> for Local'
 impl AsRef<str> for Local {
     fn as_ref(&self) -> &str {
         todo!()
diff --git a/tests/rustdoc/issue-88600.rs b/tests/rustdoc/enum-variant-doc-hidden-field-88600.rs
index f89af472f6e..31d96e9db75 100644
--- a/tests/rustdoc/issue-88600.rs
+++ b/tests/rustdoc/enum-variant-doc-hidden-field-88600.rs
@@ -1,4 +1,6 @@
 // This test ensure that #[doc(hidden)] is applied correctly in enum variant fields.
+// https://github.com/rust-lang/rust/issues/88600
+#![crate_name = "foo"]
 
 // Denotes a field which should be hidden.
 pub struct H;
@@ -6,7 +8,7 @@ pub struct H;
 // Denotes a field which should not be hidden (shown).
 pub struct S;
 
-// @has issue_88600/enum.FooEnum.html
+// @has foo/enum.FooEnum.html
 pub enum FooEnum {
     // @has - '//*[@id="variant.HiddenTupleItem"]//h3' 'HiddenTupleItem(/* private fields */)'
     // @count - '//*[@id="variant.HiddenTupleItem.field.0"]' 0
diff --git a/tests/rustdoc/issue-89309-heading-levels.rs b/tests/rustdoc/heading-levels-89309.rs
index bb706c28ffa..caa99428525 100644
--- a/tests/rustdoc/issue-89309-heading-levels.rs
+++ b/tests/rustdoc/heading-levels-89309.rs
@@ -1,3 +1,4 @@
+// https://github.com/rust-lang/rust/issues/89309
 #![crate_name = "foo"]
 
 // @has foo/trait.Read.html
diff --git a/tests/rustdoc/auxiliary/issue-85454.rs b/tests/rustdoc/inline_cross/auxiliary/issue-85454.rs
index 5db4fe053af..5db4fe053af 100644
--- a/tests/rustdoc/auxiliary/issue-85454.rs
+++ b/tests/rustdoc/inline_cross/auxiliary/issue-85454.rs
diff --git a/tests/rustdoc/auxiliary/issue-98697-reexport-with-anonymous-lifetime.rs b/tests/rustdoc/inline_cross/auxiliary/reexport-with-anonymous-lifetime-98697.rs
index 4e55e7ed576..4e55e7ed576 100644
--- a/tests/rustdoc/auxiliary/issue-98697-reexport-with-anonymous-lifetime.rs
+++ b/tests/rustdoc/inline_cross/auxiliary/reexport-with-anonymous-lifetime-98697.rs
diff --git a/tests/rustdoc/issue-85454.rs b/tests/rustdoc/inline_cross/qpath-self-85454.rs
index 790db0c5dcf..de806db7709 100644
--- a/tests/rustdoc/issue-85454.rs
+++ b/tests/rustdoc/inline_cross/qpath-self-85454.rs
@@ -1,6 +1,7 @@
 //@ aux-build:issue-85454.rs
 //@ build-aux-docs
 #![crate_name = "foo"]
+// https://github.com/rust-lang/rust/issues/85454
 
 extern crate issue_85454;
 
diff --git a/tests/rustdoc/inline_cross/reexport-with-anonymous-lifetime-98697.rs b/tests/rustdoc/inline_cross/reexport-with-anonymous-lifetime-98697.rs
new file mode 100644
index 00000000000..fe6e5a39c81
--- /dev/null
+++ b/tests/rustdoc/inline_cross/reexport-with-anonymous-lifetime-98697.rs
@@ -0,0 +1,18 @@
+//@ aux-build:reexport-with-anonymous-lifetime-98697.rs
+//@ ignore-cross-compile
+#![crate_name = "foo"]
+
+// When reexporting a function with a HRTB with anonymous lifetimes,
+// make sure the anonymous lifetimes are not rendered.
+//
+// https://github.com/rust-lang/rust/issues/98697
+
+extern crate reexport_with_anonymous_lifetime_98697;
+
+// @has foo/fn.repro.html '//pre[@class="rust item-decl"]/code' 'fn repro<F>()where F: Fn(&str)'
+// @!has foo/fn.repro.html '//pre[@class="rust item-decl"]/code' 'for<'
+pub use reexport_with_anonymous_lifetime_98697::repro;
+
+// @has foo/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl MyTrait<&Extra> for Extra'
+// @!has foo/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl<'
+pub use reexport_with_anonymous_lifetime_98697::Extra;
diff --git a/tests/rustdoc/issue-94183-blanket-impl-reexported-trait.rs b/tests/rustdoc/inline_local/blanket-impl-reexported-trait-94183.rs
index 95ddd4c7471..343e030da9e 100644
--- a/tests/rustdoc/issue-94183-blanket-impl-reexported-trait.rs
+++ b/tests/rustdoc/inline_local/blanket-impl-reexported-trait-94183.rs
@@ -2,6 +2,7 @@
 // This test ensures that a publicly re-exported private trait will
 // appear in the blanket impl list.
 
+// https://github.com/rust-lang/rust/issues/94183
 #![crate_name = "foo"]
 
 // @has 'foo/struct.S.html'
diff --git a/tests/rustdoc/issue-81141-private-reexport-in-public-api-2.rs b/tests/rustdoc/inline_local/private-reexport-in-public-api-81141-2.rs
index fba310cec6d..c066f54b32b 100644
--- a/tests/rustdoc/issue-81141-private-reexport-in-public-api-2.rs
+++ b/tests/rustdoc/inline_local/private-reexport-in-public-api-81141-2.rs
@@ -1,5 +1,6 @@
 //@ edition:2015
 
+// https://github.com/rust-lang/rust/issues/81141
 #![crate_name = "foo"]
 
 use external::Public as Private;
diff --git a/tests/rustdoc/issue-81141-private-reexport-in-public-api.rs b/tests/rustdoc/inline_local/private-reexport-in-public-api-81141.rs
index bd54d02c6ec..d695ed7fbfa 100644
--- a/tests/rustdoc/issue-81141-private-reexport-in-public-api.rs
+++ b/tests/rustdoc/inline_local/private-reexport-in-public-api-81141.rs
@@ -1,6 +1,7 @@
 // This test ensures that if a private re-export is present in a public API, it'll be
 // replaced by the first public item in the re-export chain or by the private item.
 
+// https://github.com/rust-lang/rust/issues/81141
 #![crate_name = "foo"]
 
 use crate::bar::Bar as Alias;
diff --git a/tests/rustdoc/issue-81141-private-reexport-in-public-api-generics.rs b/tests/rustdoc/inline_local/private-reexport-in-public-api-generics-81141.rs
index 7e289508628..1c86c769a12 100644
--- a/tests/rustdoc/issue-81141-private-reexport-in-public-api-generics.rs
+++ b/tests/rustdoc/inline_local/private-reexport-in-public-api-generics-81141.rs
@@ -1,3 +1,4 @@
+// https://github.com/rust-lang/rust/issues/81141
 #![crate_name = "foo"]
 
 use crate::bar::Foo as Alias;
diff --git a/tests/rustdoc/issue-81141-private-reexport-in-public-api-hidden.rs b/tests/rustdoc/inline_local/private-reexport-in-public-api-hidden-81141.rs
index 388f69ba326..7d6fadf26e2 100644
--- a/tests/rustdoc/issue-81141-private-reexport-in-public-api-hidden.rs
+++ b/tests/rustdoc/inline_local/private-reexport-in-public-api-hidden-81141.rs
@@ -1,5 +1,6 @@
 //@ compile-flags: -Z unstable-options --document-hidden-items
 
+// https://github.com/rust-lang/rust/issues/81141
 #![crate_name = "foo"]
 
 #[doc(hidden)]
diff --git a/tests/rustdoc/issue-81141-private-reexport-in-public-api-private.rs b/tests/rustdoc/inline_local/private-reexport-in-public-api-private-81141.rs
index 2633f98c4f3..6bf507838d5 100644
--- a/tests/rustdoc/issue-81141-private-reexport-in-public-api-private.rs
+++ b/tests/rustdoc/inline_local/private-reexport-in-public-api-private-81141.rs
@@ -1,5 +1,6 @@
 //@ compile-flags: --document-private-items
 
+// https://github.com/rust-lang/rust/issues/81141
 #![crate_name = "foo"]
 
 use crate::bar::Bar as Alias;
diff --git a/tests/rustdoc/inline_local/reexported-macro-and-macro-export-sidebar-89852.rs b/tests/rustdoc/inline_local/reexported-macro-and-macro-export-sidebar-89852.rs
new file mode 100644
index 00000000000..cffe1289ce8
--- /dev/null
+++ b/tests/rustdoc/inline_local/reexported-macro-and-macro-export-sidebar-89852.rs
@@ -0,0 +1,16 @@
+//@ edition:2018
+
+// https://github.com/rust-lang/rust/issues/89852
+#![crate_name = "foo"]
+#![no_core]
+#![feature(no_core)]
+
+// @matchesraw 'foo/sidebar-items.js' '"repro"'
+// @!matchesraw 'foo/sidebar-items.js' '"repro".*"repro"'
+
+#[macro_export]
+macro_rules! repro {
+    () => {};
+}
+
+pub use crate::repro as repro2;
diff --git a/tests/rustdoc/issue-86620.rs b/tests/rustdoc/issue-86620.rs
deleted file mode 100644
index a7ac0f1d291..00000000000
--- a/tests/rustdoc/issue-86620.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//@ aux-build:issue-86620-1.rs
-
-extern crate issue_86620_1;
-
-use issue_86620_1::*;
-
-// @!has issue_86620/struct.S.html '//*[@id="method.vzip"]//a[@class="fnname"]/@href' #tymethod.vzip
-// @has issue_86620/struct.S.html '//*[@id="method.vzip"]//a[@class="anchor"]/@href' #method.vzip
-pub struct S;
diff --git a/tests/rustdoc/issue-89852.rs b/tests/rustdoc/issue-89852.rs
deleted file mode 100644
index e9b3d80c92e..00000000000
--- a/tests/rustdoc/issue-89852.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-//@ edition:2018
-
-#![no_core]
-#![feature(no_core)]
-
-// @matchesraw 'issue_89852/sidebar-items.js' '"repro"'
-// @!matchesraw 'issue_89852/sidebar-items.js' '"repro".*"repro"'
-
-#[macro_export]
-macro_rules! repro {
-    () => {};
-}
-
-pub use crate::repro as repro2;
diff --git a/tests/rustdoc/issue-95873.rs b/tests/rustdoc/issue-95873.rs
deleted file mode 100644
index 83f1f2f75bf..00000000000
--- a/tests/rustdoc/issue-95873.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-// @has issue_95873/index.html "//*[@class='item-name']" "pub use ::std as x;"
-pub use ::std as x;
diff --git a/tests/rustdoc/issue-98697.rs b/tests/rustdoc/issue-98697.rs
deleted file mode 100644
index df9f2915111..00000000000
--- a/tests/rustdoc/issue-98697.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-//@ aux-build:issue-98697-reexport-with-anonymous-lifetime.rs
-//@ ignore-cross-compile
-
-// When reexporting a function with a HRTB with anonymous lifetimes,
-// make sure the anonymous lifetimes are not rendered.
-//
-// https://github.com/rust-lang/rust/issues/98697
-
-extern crate issue_98697_reexport_with_anonymous_lifetime;
-
-// @has issue_98697/fn.repro.html '//pre[@class="rust item-decl"]/code' 'fn repro<F>()where F: Fn(&str)'
-// @!has issue_98697/fn.repro.html '//pre[@class="rust item-decl"]/code' 'for<'
-pub use issue_98697_reexport_with_anonymous_lifetime::repro;
-
-// @has issue_98697/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl MyTrait<&Extra> for Extra'
-// @!has issue_98697/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl<'
-pub use issue_98697_reexport_with_anonymous_lifetime::Extra;
diff --git a/tests/rustdoc/method-anchor-in-blanket-impl-86620.rs b/tests/rustdoc/method-anchor-in-blanket-impl-86620.rs
new file mode 100644
index 00000000000..537dadd2124
--- /dev/null
+++ b/tests/rustdoc/method-anchor-in-blanket-impl-86620.rs
@@ -0,0 +1,11 @@
+//@ aux-build:issue-86620-1.rs
+#![crate_name = "foo"]
+// https://github.com/rust-lang/rust/issues/86620
+
+extern crate issue_86620_1;
+
+use issue_86620_1::*;
+
+// @!has foo/struct.S.html '//*[@id="method.vzip"]//a[@class="fnname"]/@href' #tymethod.vzip
+// @has foo/struct.S.html '//*[@id="method.vzip"]//a[@class="anchor"]/@href' #method.vzip
+pub struct S;
diff --git a/tests/rustdoc/issue-99221-multiple-macro-rules-w-same-name-submodule.rs b/tests/rustdoc/multiple-macro-rules-w-same-name-submodule-99221.rs
index d3ccd1c069b..ed1e42c1f4e 100644
--- a/tests/rustdoc/issue-99221-multiple-macro-rules-w-same-name-submodule.rs
+++ b/tests/rustdoc/multiple-macro-rules-w-same-name-submodule-99221.rs
@@ -2,6 +2,7 @@
 //@ build-aux-docs
 //@ ignore-cross-compile
 
+// https://github.com/rust-lang/rust/issues/99221
 #![crate_name = "foo"]
 
 #[macro_use]
diff --git a/tests/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline-last-item.rs b/tests/rustdoc/multiple-mods-w-same-name-doc-inline-83375.rs
index 9bce25846d8..9b3dfd45370 100644
--- a/tests/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline-last-item.rs
+++ b/tests/rustdoc/multiple-mods-w-same-name-doc-inline-83375.rs
@@ -1,3 +1,4 @@
+// https://github.com/rust-lang/rust/issues/83375
 #![crate_name = "foo"]
 
 pub mod sub {
@@ -8,9 +9,9 @@ pub mod sub {
     }
 }
 
-#[doc(inline)]
-pub use sub::*;
-
 // @count foo/index.html '//a[@class="mod"][@title="mod foo::prelude"]' 1
 // @count foo/prelude/index.html '//div[@class="item-row"]' 0
 pub mod prelude {}
+
+#[doc(inline)]
+pub use sub::*;
diff --git a/tests/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline.rs b/tests/rustdoc/multiple-mods-w-same-name-doc-inline-last-item-83375.rs
index d0960dfef43..7bad825b35f 100644
--- a/tests/rustdoc/issue-83375-multiple-mods-w-same-name-doc-inline.rs
+++ b/tests/rustdoc/multiple-mods-w-same-name-doc-inline-last-item-83375.rs
@@ -1,3 +1,4 @@
+// https://github.com/rust-lang/rust/issues/83375
 #![crate_name = "foo"]
 
 pub mod sub {
@@ -8,9 +9,9 @@ pub mod sub {
     }
 }
 
+#[doc(inline)]
+pub use sub::*;
+
 // @count foo/index.html '//a[@class="mod"][@title="mod foo::prelude"]' 1
 // @count foo/prelude/index.html '//div[@class="item-row"]' 0
 pub mod prelude {}
-
-#[doc(inline)]
-pub use sub::*;
diff --git a/tests/rustdoc/pub-use-root-path-95873.rs b/tests/rustdoc/pub-use-root-path-95873.rs
new file mode 100644
index 00000000000..5a817fb3409
--- /dev/null
+++ b/tests/rustdoc/pub-use-root-path-95873.rs
@@ -0,0 +1,5 @@
+// https://github.com/rust-lang/rust/issues/95873
+#![crate_name = "foo"]
+
+// @has foo/index.html "//*[@class='item-name']" "pub use ::std as x;"
+pub use ::std as x;
diff --git a/tests/rustdoc/issue-80233-normalize-auto-trait.rs b/tests/rustdoc/synthetic_auto/normalize-auto-trait-80233.rs
index 62fbc2444db..06498018630 100644
--- a/tests/rustdoc/issue-80233-normalize-auto-trait.rs
+++ b/tests/rustdoc/synthetic_auto/normalize-auto-trait-80233.rs
@@ -1,7 +1,9 @@
 // Regression test for issue #80233
 // Tests that we don't ICE when processing auto traits
+// https://github.com/rust-lang/rust/issues/80233
 
 #![crate_type = "lib"]
+#![crate_name = "foo"]
 pub trait Trait1 {}
 
 pub trait Trait2 {
@@ -30,7 +32,7 @@ impl<T: Trait3> Trait3 for Vec<T> {
 
 pub struct Struct1 {}
 
-// @has issue_80233_normalize_auto_trait/struct.Question.html
+// @has foo/struct.Question.html
 // @has - '//h3[@class="code-header"]' 'impl<T> Send for Question<T>'
 pub struct Question<T: Trait1> {
     pub ins: <<Vec<T> as Trait3>::Type3 as Trait2>::Type2,
diff --git a/tests/rustdoc/issue-96381.rs b/tests/rustdoc/underscore-type-in-trait-impl-96381.rs
index 90875c07605..6d6e5e0a839 100644
--- a/tests/rustdoc/issue-96381.rs
+++ b/tests/rustdoc/underscore-type-in-trait-impl-96381.rs
@@ -1,4 +1,5 @@
 //@ should-fail
+// https://github.com/rust-lang/rust/issues/96381
 
 #![allow(unused)]
 
diff --git a/tests/ui/async-await/async-closures/force-move-due-to-actually-fnonce.rs b/tests/ui/async-await/async-closures/force-move-due-to-actually-fnonce.rs
new file mode 100644
index 00000000000..ce49f55e3e3
--- /dev/null
+++ b/tests/ui/async-await/async-closures/force-move-due-to-actually-fnonce.rs
@@ -0,0 +1,27 @@
+//@ aux-build:block-on.rs
+//@ edition:2021
+//@ check-pass
+
+#![feature(async_closure)]
+
+extern crate block_on;
+
+fn consume(_: String) {}
+
+fn main() {
+    block_on::block_on(async {
+        let x = 1i32;
+        let s = String::new();
+        // `consume(s)` pulls the closure's kind down to `FnOnce`,
+        // which means that we don't treat the borrow of `x` as a
+        // self-borrow (with `'env` lifetime). This leads to a lifetime
+        // error which is solved by forcing the inner coroutine to
+        // be `move` as well, so that it moves `x`.
+        let c = async move || {
+            println!("{x}");
+            // This makes the closure FnOnce...
+            consume(s);
+        };
+        c().await;
+    });
+}
diff --git a/tests/ui/async-await/async-closures/force-move-due-to-inferred-kind.rs b/tests/ui/async-await/async-closures/force-move-due-to-inferred-kind.rs
new file mode 100644
index 00000000000..803c990ef93
--- /dev/null
+++ b/tests/ui/async-await/async-closures/force-move-due-to-inferred-kind.rs
@@ -0,0 +1,24 @@
+//@ aux-build:block-on.rs
+//@ edition:2021
+//@ check-pass
+
+#![feature(async_closure)]
+
+extern crate block_on;
+
+fn force_fnonce<T: async FnOnce()>(t: T) -> T { t }
+
+fn main() {
+    block_on::block_on(async {
+        let x = 1i32;
+        // `force_fnonce` pulls the closure's kind down to `FnOnce`,
+        // which means that we don't treat the borrow of `x` as a
+        // self-borrow (with `'env` lifetime). This leads to a lifetime
+        // error which is solved by forcing the inner coroutine to
+        // be `move` as well, so that it moves `x`.
+        let c = force_fnonce(async move || {
+            println!("{x}");
+        });
+        c().await;
+    });
+}