Skip to content

Commit

Permalink
Auto merge of rust-lang#123354 - SteveLauC:fix/haiku, r=Nilstrieb
Browse files Browse the repository at this point in the history
fix: build on haiku by adding missing import

Fix the build on Haiku by adding a missing import

```
error[E0433]: failed to resolve: use of undeclared crate or module `slice`
   --> /localhome/somers/.rustup/toolchains/nightly-x86_64-unknown-freebsd/lib/rustlib/src/rust/library/std/src/sys/pal/unix/thread.rs:272:24
    |
272 |             let name = slice::from_raw_parts(info.name.as_ptr() as *const u8, info.name.len());
    |                        ^^^^^ use of undeclared crate or module `slice`
    |
help: consider importing one of these items
    |
1   + use alloc::slice;
    |
1   + use core::slice;
    |
1   + use crate::slice;
```

Closes rust-lang#123343
  • Loading branch information
bors committed Apr 2, 2024
2 parents 5dbaafd + bb43990 commit 36b6f9b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion library/std/src/sys/pal/unix/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ impl Thread {
return None;
}
let info = tinfo.assume_init();
let name = slice::from_raw_parts(info.name.as_ptr() as *const u8, info.name.len());
let name =
core::slice::from_raw_parts(info.name.as_ptr() as *const u8, info.name.len());
CStr::from_bytes_until_nul(name).map(CStr::to_owned).ok()
}
}
Expand Down

0 comments on commit 36b6f9b

Please sign in to comment.