Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
1ae4b258
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
1ae4b258
编写于
6月 09, 2022
作者:
D
David Tolnay
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Remove num_cpus dependency from bootstrap, build-manifest and rustc_session"
This reverts commit
2d854f9c
.
上级
fde0f119
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
11 addition
and
7 deletion
+11
-7
Cargo.lock
Cargo.lock
+3
-0
compiler/rustc_session/Cargo.toml
compiler/rustc_session/Cargo.toml
+1
-0
compiler/rustc_session/src/options.rs
compiler/rustc_session/src/options.rs
+1
-1
src/bootstrap/Cargo.toml
src/bootstrap/Cargo.toml
+1
-0
src/bootstrap/config.rs
src/bootstrap/config.rs
+1
-1
src/bootstrap/flags.rs
src/bootstrap/flags.rs
+1
-1
src/bootstrap/lib.rs
src/bootstrap/lib.rs
+1
-3
src/tools/build-manifest/Cargo.toml
src/tools/build-manifest/Cargo.toml
+1
-0
src/tools/build-manifest/src/main.rs
src/tools/build-manifest/src/main.rs
+1
-1
未找到文件。
Cargo.lock
浏览文件 @
1ae4b258
...
...
@@ -219,6 +219,7 @@ dependencies = [
"hex 0.4.2",
"ignore",
"libc",
"num_cpus",
"once_cell",
"opener",
"pretty_assertions 0.7.2",
...
...
@@ -250,6 +251,7 @@ dependencies = [
"anyhow",
"flate2",
"hex 0.4.2",
"num_cpus",
"rayon",
"serde",
"serde_json",
...
...
@@ -4419,6 +4421,7 @@ name = "rustc_session"
version = "0.0.0"
dependencies = [
"getopts",
"num_cpus",
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
...
...
compiler/rustc_session/Cargo.toml
浏览文件 @
1ae4b258
...
...
@@ -15,5 +15,6 @@ rustc_serialize = { path = "../rustc_serialize" }
rustc_data_structures
=
{
path
=
"../rustc_data_structures"
}
rustc_span
=
{
path
=
"../rustc_span"
}
rustc_fs_util
=
{
path
=
"../rustc_fs_util"
}
num_cpus
=
"1.0"
rustc_ast
=
{
path
=
"../rustc_ast"
}
rustc_lint_defs
=
{
path
=
"../rustc_lint_defs"
}
compiler/rustc_session/src/options.rs
浏览文件 @
1ae4b258
...
...
@@ -578,7 +578,7 @@ pub(crate) fn parse_opt_comma_list(slot: &mut Option<Vec<String>>, v: Option<&st
pub
(
crate
)
fn
parse_threads
(
slot
:
&
mut
usize
,
v
:
Option
<&
str
>
)
->
bool
{
match
v
.and_then
(|
s
|
s
.parse
()
.ok
())
{
Some
(
0
)
=>
{
*
slot
=
std
::
thread
::
available_parallelism
()
.map_or
(
1
,
std
::
num
::
NonZeroUsize
::
get
);
*
slot
=
::
num_cpus
::
get
(
);
true
}
Some
(
i
)
=>
{
...
...
src/bootstrap/Cargo.toml
浏览文件 @
1ae4b258
...
...
@@ -37,6 +37,7 @@ test = false
[dependencies]
cmake
=
"0.1.38"
filetime
=
"0.2"
num_cpus
=
"1.0"
getopts
=
"0.2.19"
cc
=
"1.0.69"
libc
=
"0.2"
...
...
src/bootstrap/config.rs
浏览文件 @
1ae4b258
...
...
@@ -1418,7 +1418,7 @@ fn set<T>(field: &mut T, val: Option<T>) {
fn
threads_from_config
(
v
:
u32
)
->
u32
{
match
v
{
0
=>
std
::
thread
::
available_parallelism
()
.map_or
(
1
,
std
::
num
::
NonZeroUsize
::
get
)
as
u32
,
0
=>
num_cpus
::
get
(
)
as
u32
,
n
=>
n
,
}
}
...
...
src/bootstrap/flags.rs
浏览文件 @
1ae4b258
...
...
@@ -210,7 +210,7 @@ pub fn parse(args: &[String]) -> Flags {
let
j_msg
=
format!
(
"number of jobs to run in parallel;
\
defaults to {} (this host's logical CPU count)"
,
std
::
thread
::
available_parallelism
()
.map_or
(
1
,
std
::
num
::
NonZeroUsize
::
get
)
num_cpus
::
get
(
)
);
opts
.optopt
(
"j"
,
"jobs"
,
&
j_msg
,
"JOBS"
);
opts
.optflag
(
"h"
,
"help"
,
"print this help message"
);
...
...
src/bootstrap/lib.rs
浏览文件 @
1ae4b258
...
...
@@ -1032,9 +1032,7 @@ fn info(&self, msg: &str) {
/// Returns the number of parallel jobs that have been configured for this
/// build.
fn
jobs
(
&
self
)
->
u32
{
self
.config.jobs
.unwrap_or_else
(||
{
std
::
thread
::
available_parallelism
()
.map_or
(
1
,
std
::
num
::
NonZeroUsize
::
get
)
as
u32
})
self
.config.jobs
.unwrap_or_else
(||
num_cpus
::
get
()
as
u32
)
}
fn
debuginfo_map_to
(
&
self
,
which
:
GitRepo
)
->
Option
<
String
>
{
...
...
src/tools/build-manifest/Cargo.toml
浏览文件 @
1ae4b258
...
...
@@ -13,3 +13,4 @@ tar = "0.4.29"
sha2
=
"0.10.1"
rayon
=
"1.5.1"
hex
=
"0.4.2"
num_cpus
=
"1.13.0"
src/tools/build-manifest/src/main.rs
浏览文件 @
1ae4b258
...
...
@@ -210,7 +210,7 @@ fn main() {
let
num_threads
=
if
let
Some
(
num
)
=
env
::
var_os
(
"BUILD_MANIFEST_NUM_THREADS"
)
{
num
.to_str
()
.unwrap
()
.parse
()
.expect
(
"invalid number for BUILD_MANIFEST_NUM_THREADS"
)
}
else
{
std
::
thread
::
available_parallelism
()
.map_or
(
1
,
std
::
num
::
NonZeroUsize
::
get
)
num_cpus
::
get
(
)
};
rayon
::
ThreadPoolBuilder
::
new
()
.num_threads
(
num_threads
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录