about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-06-16 23:50:20 +0000
committerbors <bors@rust-lang.org>2022-06-16 23:50:20 +0000
commit349bda2051e94b7aefb33d6541f48f561bf06dbc (patch)
tree53b5320c033a44c0e0ed2f23b2ad5b194f083d2c /library/std/src
parentcacc75c82ebe15cf63d31034fcf7f1016cddf0e2 (diff)
parent6ac93185f4daacacb537d5b61e900eb9d58edcd1 (diff)
downloadrust-349bda2051e94b7aefb33d6541f48f561bf06dbc.tar.gz
rust-349bda2051e94b7aefb33d6541f48f561bf06dbc.zip
Auto merge of #98181 - JohnTitor:rollup-65ztwnz, r=JohnTitor
Rollup of 5 pull requests

Successful merges:

 - #97377 (Do not suggest adding semicolon/changing delimiters for macros in item position that originates in macros)
 - #97675 (Make `std::mem::needs_drop` accept `?Sized`)
 - #98118 (Test NLL fix of bad lifetime inference for reference captured in closure.)
 - #98166 (Add rustdoc-json regression test for #98009)
 - #98169 (Keyword docs: Link to wikipedia article for dynamic dispatch)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/keyword_docs.rs3
-rw-r--r--library/std/src/thread/tests.rs13
2 files changed, 15 insertions, 1 deletions
diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs
index 4f4b06fc47d..7157b5af00c 100644
--- a/library/std/src/keyword_docs.rs
+++ b/library/std/src/keyword_docs.rs
@@ -2257,7 +2257,7 @@ mod await_keyword {}
 /// `dyn` is a prefix of a [trait object]'s type.
 ///
 /// The `dyn` keyword is used to highlight that calls to methods on the associated `Trait`
-/// are dynamically dispatched. To use the trait this way, it must be 'object safe'.
+/// are [dynamically dispatched]. To use the trait this way, it must be 'object safe'.
 ///
 /// Unlike generic parameters or `impl Trait`, the compiler does not know the concrete type that
 /// is being passed. That is, the type has been [erased].
@@ -2281,6 +2281,7 @@ mod await_keyword {}
 /// the method won't be duplicated for each concrete type.
 ///
 /// [trait object]: ../book/ch17-02-trait-objects.html
+/// [dynamically dispatched]: https://en.wikipedia.org/wiki/Dynamic_dispatch
 /// [ref-trait-obj]: ../reference/types/trait-object.html
 /// [ref-obj-safety]: ../reference/items/traits.html#object-safety
 /// [erased]: https://en.wikipedia.org/wiki/Type_erasure
diff --git a/library/std/src/thread/tests.rs b/library/std/src/thread/tests.rs
index 5b8309cf5d2..ec68b529188 100644
--- a/library/std/src/thread/tests.rs
+++ b/library/std/src/thread/tests.rs
@@ -316,3 +316,16 @@ fn test_scoped_threads_drop_result_before_join() {
     });
     assert!(actually_finished.load(Ordering::Relaxed));
 }
+
+#[test]
+fn test_scoped_threads_nll() {
+    // this is mostly a *compilation test* for this exact function:
+    fn foo(x: &u8) {
+        thread::scope(|s| {
+            s.spawn(|| drop(x));
+        });
+    }
+    // let's also run it for good measure
+    let x = 42_u8;
+    foo(&x);
+}