diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index 87d5c2f742c41..13b02cd8d3abe 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -1337,21 +1337,19 @@ pub struct Thread { impl Thread { /// Used only internally to construct a thread object without spawning. pub(crate) fn new(name: ThreadNameString) -> Thread { - unsafe { Self::new_inner(ThreadName::Other(name)) } + Self::new_inner(ThreadName::Other(name)) } pub(crate) fn new_unnamed() -> Thread { - unsafe { Self::new_inner(ThreadName::Unnamed) } + Self::new_inner(ThreadName::Unnamed) } // Used in runtime to construct main thread pub(crate) fn new_main() -> Thread { - unsafe { Self::new_inner(ThreadName::Main) } + Self::new_inner(ThreadName::Main) } - /// # Safety - /// If `name` is `ThreadName::Other(_)`, the contained string must be valid UTF-8. - unsafe fn new_inner(name: ThreadName) -> Thread { + fn new_inner(name: ThreadName) -> Thread { // We have to use `unsafe` here to construct the `Parker` in-place, // which is required for the UNIX implementation. //