Skip to content

Commit 80a1321

Browse files
committed
Auto merge of rust-lang#117272 - matthiaskrgr:rollup-upg122z, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - rust-lang#114998 (feat(docs): add cargo-pgo to PGO documentation 📝) - rust-lang#116868 (Tweak suggestion span for outer attr and point at item following invalid inner attr) - rust-lang#117240 (Fix documentation typo in std::iter::Iterator::collect_into) - rust-lang#117241 (Stash and cancel cycle errors for auto trait leakage in opaques) - rust-lang#117262 (Create a new ConstantKind variant (ZeroSized) for StableMIR) - rust-lang#117266 (replace transmute by raw pointer cast) r? `@ghost` `@rustbot` modify labels: rollup
2 parents a065bdf + 300913a commit 80a1321

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

core/src/iter/traits/iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2142,7 +2142,7 @@ pub trait Iterator {
21422142
/// passed collection. The collection is then returned, so the call chain
21432143
/// can be continued.
21442144
///
2145-
/// This is useful when you already have a collection and wants to add
2145+
/// This is useful when you already have a collection and want to add
21462146
/// the iterator items to it.
21472147
///
21482148
/// This method is a convenience method to call [Extend::extend](trait.Extend.html),

std/src/thread/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,13 @@ impl Builder {
545545
scope_data.increment_num_running_threads();
546546
}
547547

548+
let main = Box::new(main);
549+
#[cfg(bootstrap)]
550+
let main =
551+
unsafe { mem::transmute::<Box<dyn FnOnce() + 'a>, Box<dyn FnOnce() + 'static>>(main) };
552+
#[cfg(not(bootstrap))]
553+
let main = unsafe { Box::from_raw(Box::into_raw(main) as *mut (dyn FnOnce() + 'static)) };
554+
548555
Ok(JoinInner {
549556
// SAFETY:
550557
//
@@ -559,14 +566,7 @@ impl Builder {
559566
// Similarly, the `sys` implementation must guarantee that no references to the closure
560567
// exist after the thread has terminated, which is signaled by `Thread::join`
561568
// returning.
562-
native: unsafe {
563-
imp::Thread::new(
564-
stack_size,
565-
mem::transmute::<Box<dyn FnOnce() + 'a>, Box<dyn FnOnce() + 'static>>(
566-
Box::new(main),
567-
),
568-
)?
569-
},
569+
native: unsafe { imp::Thread::new(stack_size, main)? },
570570
thread: my_thread,
571571
packet: my_packet,
572572
})

0 commit comments

Comments
 (0)