Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #120795

Closed
wants to merge 29 commits into from
Closed
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8148053
Add supporting infrastructure for `run-make` V2 tests
jieyouxu Jan 20, 2024
e1826bf
Point to stage1-std when in stage2 rustc
jieyouxu Feb 2, 2024
6b2a824
Remove dead args from functions
compiler-errors Feb 2, 2024
c2a0d11
Fix incorrect stage std paths
jieyouxu Feb 2, 2024
0bfcafd
std::thread::available_parallelism merging linux/android/freebsd version
devnexen Feb 2, 2024
0ac1195
Invert diagnostic lints.
nnethercote Feb 5, 2024
ad3d04c
A drive-by rewrite of give_region_a_name()
amandasystems Feb 6, 2024
cd21b1d
No need to take ImplTraitContext by ref
compiler-errors Feb 7, 2024
0e4b55b
Reorder the diagnostic API methods.
nnethercote Feb 8, 2024
d1920a7
Fix inconsistencies in the diagnostic API methods.
nnethercote Feb 8, 2024
795be51
Make `RegionName` `Copy` by (transitively) interning the few string v…
amandasystems Feb 7, 2024
eb0d70e
also try to normalize opaque types in alias-relate
lcnr Jan 29, 2024
3eef669
use alias-relate to structurally normalize in the solver
lcnr Feb 1, 2024
4ced269
add revisions
lcnr Feb 1, 2024
45377df
one must imagine ci happy
lcnr Feb 8, 2024
f676c3d
Remove myself from review rotation.
m-ou-se Feb 8, 2024
9224387
Correctly generate path for non-local items in source code pages
GuillaumeGomez Feb 2, 2024
41f9b57
Add regression test for non local items link generation
GuillaumeGomez Feb 3, 2024
11bd2ea
Unify item relative path computation in one function
GuillaumeGomez Feb 3, 2024
502806a
Rollup merge of #113026 - jieyouxu:run-make-v2, r=bjorn3
matthiaskrgr Feb 8, 2024
43c6671
Rollup merge of #120549 - lcnr:errs-showcase, r=compiler-errors
matthiaskrgr Feb 8, 2024
9fd0a0b
Rollup merge of #120589 - devnexen:cpuaff_fbsd_upd, r=m-ou-se
matthiaskrgr Feb 8, 2024
e30640e
Rollup merge of #120590 - compiler-errors:dead, r=Nilstrieb
matthiaskrgr Feb 8, 2024
b34415c
Rollup merge of #120596 - GuillaumeGomez:jump-to-def-non-local-link, …
matthiaskrgr Feb 8, 2024
32ca987
Rollup merge of #120693 - nnethercote:invert-diagnostic-lints, r=davi…
matthiaskrgr Feb 8, 2024
66f49d6
Rollup merge of #120704 - amandasystems:silly-region-name-rewrite, r=…
matthiaskrgr Feb 8, 2024
c2529f0
Rollup merge of #120750 - compiler-errors:itctx-by-val, r=cjgillot
matthiaskrgr Feb 8, 2024
3476bcd
Rollup merge of #120765 - nnethercote:reorder-diag-API, r=compiler-er…
matthiaskrgr Feb 8, 2024
f59b48c
Rollup merge of #120772 - m-ou-se:review, r=Nilstrieb
matthiaskrgr Feb 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 11 additions & 22 deletions library/std/src/sys/pal/unix/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ pub fn available_parallelism() -> io::Result<NonZeroUsize> {
target_os = "solaris",
target_os = "illumos",
target_os = "aix",
target_os = "freebsd",
))] {
#[allow(unused_assignments)]
#[allow(unused_mut)]
Expand All @@ -328,9 +329,17 @@ pub fn available_parallelism() -> io::Result<NonZeroUsize> {
#[cfg(any(target_os = "android", target_os = "linux"))]
{
quota = cgroups::quota().max(1);
let mut set: libc::cpu_set_t = unsafe { mem::zeroed() };
}

#[cfg(any(target_os = "android", target_os = "linux", target_os = "freebsd"))]
{
#[cfg(not(target_os = "freebsd"))]
type cpuset = libc::cpu_set_t;
#[cfg(target_os = "freebsd")]
type cpuset = libc::cpuset_t;
let mut set: cpuset = unsafe { mem::zeroed() };
unsafe {
if libc::sched_getaffinity(0, mem::size_of::<libc::cpu_set_t>(), &mut set) == 0 {
if libc::sched_getaffinity(0, mem::size_of::<cpuset>(), &mut set) == 0 {
let count = libc::CPU_COUNT(&set) as usize;
let count = count.min(quota);

Expand All @@ -355,32 +364,12 @@ pub fn available_parallelism() -> io::Result<NonZeroUsize> {
}
}
} else if #[cfg(any(
target_os = "freebsd",
target_os = "dragonfly",
target_os = "openbsd",
target_os = "netbsd",
))] {
use crate::ptr;

#[cfg(target_os = "freebsd")]
{
let mut set: libc::cpuset_t = unsafe { mem::zeroed() };
unsafe {
if libc::cpuset_getaffinity(
libc::CPU_LEVEL_WHICH,
libc::CPU_WHICH_PID,
-1,
mem::size_of::<libc::cpuset_t>(),
&mut set,
) == 0 {
let count = libc::CPU_COUNT(&set) as usize;
if count > 0 {
return Ok(NonZeroUsize::new_unchecked(count));
}
}
}
}

#[cfg(target_os = "netbsd")]
{
unsafe {
Expand Down