Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
5f979e9a
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,发现更多精彩内容 >>
提交
5f979e9a
编写于
2月 03, 2020
作者:
M
Matthias Krüger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bootstrap: fix clippy warnings
上级
bdd946df
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
41 addition
and
58 deletion
+41
-58
src/bootstrap/bin/rustc.rs
src/bootstrap/bin/rustc.rs
+3
-3
src/bootstrap/bin/rustdoc.rs
src/bootstrap/bin/rustdoc.rs
+1
-1
src/bootstrap/builder.rs
src/bootstrap/builder.rs
+8
-16
src/bootstrap/builder/tests.rs
src/bootstrap/builder/tests.rs
+0
-1
src/bootstrap/compile.rs
src/bootstrap/compile.rs
+10
-10
src/bootstrap/config.rs
src/bootstrap/config.rs
+3
-4
src/bootstrap/dist.rs
src/bootstrap/dist.rs
+2
-2
src/bootstrap/doc.rs
src/bootstrap/doc.rs
+1
-1
src/bootstrap/flags.rs
src/bootstrap/flags.rs
+1
-1
src/bootstrap/install.rs
src/bootstrap/install.rs
+2
-3
src/bootstrap/lib.rs
src/bootstrap/lib.rs
+3
-3
src/bootstrap/metadata.rs
src/bootstrap/metadata.rs
+0
-1
src/bootstrap/native.rs
src/bootstrap/native.rs
+1
-3
src/bootstrap/test.rs
src/bootstrap/test.rs
+3
-6
src/bootstrap/tool.rs
src/bootstrap/tool.rs
+1
-1
src/bootstrap/toolstate.rs
src/bootstrap/toolstate.rs
+1
-1
src/bootstrap/util.rs
src/bootstrap/util.rs
+1
-1
未找到文件。
src/bootstrap/bin/rustc.rs
浏览文件 @
5f979e9a
...
...
@@ -47,7 +47,7 @@ fn main() {
};
let
stage
=
env
::
var
(
"RUSTC_STAGE"
)
.expect
(
"RUSTC_STAGE was not set"
);
let
sysroot
=
env
::
var_os
(
"RUSTC_SYSROOT"
)
.expect
(
"RUSTC_SYSROOT was not set"
);
let
on_fail
=
env
::
var_os
(
"RUSTC_ON_FAIL"
)
.map
(
|
of
|
Command
::
new
(
of
)
);
let
on_fail
=
env
::
var_os
(
"RUSTC_ON_FAIL"
)
.map
(
Command
::
new
);
let
rustc
=
env
::
var_os
(
rustc
)
.unwrap_or_else
(||
panic!
(
"{:?} was not set"
,
rustc
));
let
libdir
=
env
::
var_os
(
libdir
)
.unwrap_or_else
(||
panic!
(
"{:?} was not set"
,
libdir
));
...
...
@@ -64,7 +64,7 @@ fn main() {
if
let
Some
(
crate_name
)
=
crate_name
{
if
let
Some
(
target
)
=
env
::
var_os
(
"RUSTC_TIME"
)
{
if
target
==
"all"
||
target
.into_string
()
.unwrap
()
.split
(
","
)
.any
(|
c
|
c
.trim
()
==
crate_name
)
||
target
.into_string
()
.unwrap
()
.split
(
','
)
.any
(|
c
|
c
.trim
()
==
crate_name
)
{
cmd
.arg
(
"-Ztime"
);
}
...
...
@@ -189,7 +189,7 @@ fn main() {
crate_name
,
is_test
,
dur
.as_secs
(),
dur
.subsec_
nanos
()
/
1_000_000
dur
.subsec_
millis
()
);
match
status
.code
()
{
...
...
src/bootstrap/bin/rustdoc.rs
浏览文件 @
5f979e9a
...
...
@@ -61,7 +61,7 @@ fn main() {
}
// Needed to be able to run all rustdoc tests.
if
let
Some
(
_
)
=
env
::
var_os
(
"RUSTDOC_GENERATE_REDIRECT_PAGES"
)
{
if
env
::
var_os
(
"RUSTDOC_GENERATE_REDIRECT_PAGES"
)
.is_some
(
)
{
// This "unstable-options" can be removed when `--generate-redirect-pages` is stabilized
if
!
has_unstable
{
cmd
.arg
(
"-Z"
)
.arg
(
"unstable-options"
);
...
...
src/bootstrap/builder.rs
浏览文件 @
5f979e9a
...
...
@@ -510,7 +510,7 @@ pub fn new(build: &Build) -> Builder<'_> {
Subcommand
::
Format
{
..
}
|
Subcommand
::
Clean
{
..
}
=>
panic!
(),
};
let
builder
=
Builder
{
Builder
{
build
,
top_stage
:
build
.config.stage
.unwrap_or
(
2
),
kind
,
...
...
@@ -518,9 +518,7 @@ pub fn new(build: &Build) -> Builder<'_> {
stack
:
RefCell
::
new
(
Vec
::
new
()),
time_spent_on_dependencies
:
Cell
::
new
(
Duration
::
new
(
0
,
0
)),
paths
:
paths
.to_owned
(),
};
builder
}
}
pub
fn
execute_cli
(
&
self
)
{
...
...
@@ -753,13 +751,12 @@ pub fn cargo(
cargo
.env
(
"RUST_CHECK"
,
"1"
);
}
let
stage
;
if
compiler
.stage
==
0
&&
self
.local_rebuild
{
let
stage
=
if
compiler
.stage
==
0
&&
self
.local_rebuild
{
// Assume the local-rebuild rustc already has stage1 features.
stage
=
1
;
1
}
else
{
stage
=
compiler
.stage
;
}
compiler
.stage
}
;
let
mut
rustflags
=
Rustflags
::
new
(
&
target
);
if
stage
!=
0
{
...
...
@@ -1252,12 +1249,7 @@ pub fn ensure<S: Step>(&'a self, step: S) -> S::Output {
};
if
self
.config.print_step_timings
&&
dur
>
Duration
::
from_millis
(
100
)
{
println!
(
"[TIMING] {:?} -- {}.{:03}"
,
step
,
dur
.as_secs
(),
dur
.subsec_nanos
()
/
1_000_000
);
println!
(
"[TIMING] {:?} -- {}.{:03}"
,
step
,
dur
.as_secs
(),
dur
.subsec_millis
());
}
{
...
...
@@ -1302,7 +1294,7 @@ fn env(&mut self, env: &str) {
fn
arg
(
&
mut
self
,
arg
:
&
str
)
->
&
mut
Self
{
assert_eq!
(
arg
.split_whitespace
()
.count
(),
1
);
if
self
.0
.len
()
>
0
{
if
!
self
.0
.is_empty
()
{
self
.0
.push_str
(
" "
);
}
self
.0
.push_str
(
arg
);
...
...
src/bootstrap/builder/tests.rs
浏览文件 @
5f979e9a
...
...
@@ -19,7 +19,6 @@ fn configure(host: &[&str], target: &[&str]) -> Config {
config
.out
=
dir
;
config
.build
=
INTERNER
.intern_str
(
"A"
);
config
.hosts
=
vec!
[
config
.build
]
.clone
()
.into_iter
()
.chain
(
host
.iter
()
.map
(|
s
|
INTERNER
.intern_str
(
s
)))
.collect
::
<
Vec
<
_
>>
();
...
...
src/bootstrap/compile.rs
浏览文件 @
5f979e9a
...
...
@@ -18,7 +18,6 @@
use
build_helper
::{
output
,
t
,
up_to_date
};
use
filetime
::
FileTime
;
use
serde
::
Deserialize
;
use
serde_json
;
use
crate
::
builder
::
Cargo
;
use
crate
::
dist
;
...
...
@@ -149,7 +148,8 @@ fn copy_third_party_objects(
// which is provided by std for this target.
if
target
==
"x86_64-fortanix-unknown-sgx"
{
let
src_path_env
=
"X86_FORTANIX_SGX_LIBS"
;
let
src
=
env
::
var
(
src_path_env
)
.expect
(
&
format!
(
"{} not found in env"
,
src_path_env
));
let
src
=
env
::
var
(
src_path_env
)
.unwrap_or_else
(|
_
|
panic!
(
"{} not found in env"
,
src_path_env
));
copy_and_stamp
(
Path
::
new
(
&
src
),
"libunwind.a"
);
}
...
...
@@ -361,7 +361,7 @@ fn run(self, builder: &Builder<'_>) -> Vec<PathBuf> {
);
}
let
target
=
sysroot_dir
.join
(
file
.to_string
()
+
".o"
);
let
target
=
sysroot_dir
.join
(
(
*
file
)
.to_string
()
+
".o"
);
builder
.copy
(
dst_file
,
&
target
);
target_deps
.push
(
target
);
}
...
...
@@ -515,7 +515,7 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: Interne
.env
(
"CFG_VERSION"
,
builder
.rust_version
())
.env
(
"CFG_PREFIX"
,
builder
.config.prefix
.clone
()
.unwrap_or_default
());
let
libdir_relative
=
builder
.config
.libdir_relative
()
.unwrap_or
(
Path
::
new
(
"lib"
));
let
libdir_relative
=
builder
.config
.libdir_relative
()
.unwrap_or
_else
(||
Path
::
new
(
"lib"
));
cargo
.env
(
"CFG_LIBDIR_RELATIVE"
,
libdir_relative
);
if
let
Some
(
ref
ver_date
)
=
builder
.rust_info
.commit_date
()
{
...
...
@@ -843,11 +843,11 @@ pub fn run_cargo(
};
for
filename
in
filenames
{
// Skip files like executables
if
!
filename
.ends_with
(
".rlib"
)
&&
!
filename
.ends_with
(
".lib"
)
&&
!
filename
.ends_with
(
".a"
)
&&
!
is_dylib
(
&
filename
)
&&
!
(
is_check
&&
filename
.ends_with
(
".rmeta"
))
if
!
(
filename
.ends_with
(
".rlib"
)
||
filename
.ends_with
(
".lib"
)
||
filename
.ends_with
(
".a"
)
||
is_dylib
(
&
filename
)
||
(
is_check
&&
filename
.ends_with
(
".rmeta"
)
))
{
continue
;
}
...
...
@@ -905,7 +905,7 @@ pub fn run_cargo(
for
(
prefix
,
extension
,
expected_len
)
in
toplevel
{
let
candidates
=
contents
.iter
()
.filter
(|
&&
(
_
,
ref
filename
,
ref
meta
)|
{
filename
.starts_with
(
&
prefix
[
..
])
&&
filename
[
prefix
.len
()
..
]
.starts_with
(
"-"
)
&&
filename
[
prefix
.len
()
..
]
.starts_with
(
'-'
)
&&
filename
.ends_with
(
&
extension
[
..
])
&&
meta
.len
()
==
expected_len
});
...
...
src/bootstrap/config.rs
浏览文件 @
5f979e9a
...
...
@@ -16,7 +16,6 @@
pub
use
crate
::
flags
::
Subcommand
;
use
build_helper
::
t
;
use
serde
::
Deserialize
;
use
toml
;
/// Global configuration for the entire build and/or bootstrap.
///
...
...
@@ -440,7 +439,7 @@ pub fn parse(args: &[String]) -> Config {
}
}
})
.unwrap_or_else
(
||
TomlConfig
::
default
()
);
.unwrap_or_else
(
TomlConfig
::
default
);
let
build
=
toml
.build
.clone
()
.unwrap_or_default
();
// set by bootstrap.py
...
...
@@ -539,7 +538,7 @@ pub fn parse(args: &[String]) -> Config {
config
.llvm_ldflags
=
llvm
.ldflags
.clone
();
set
(
&
mut
config
.llvm_use_libcxx
,
llvm
.use_libcxx
);
config
.llvm_use_linker
=
llvm
.use_linker
.clone
();
config
.llvm_allow_old_toolchain
=
llvm
.allow_old_toolchain
.clone
()
;
config
.llvm_allow_old_toolchain
=
llvm
.allow_old_toolchain
;
}
if
let
Some
(
ref
rust
)
=
toml
.rust
{
...
...
@@ -606,7 +605,7 @@ pub fn parse(args: &[String]) -> Config {
target
.ar
=
cfg
.ar
.clone
()
.map
(
PathBuf
::
from
);
target
.ranlib
=
cfg
.ranlib
.clone
()
.map
(
PathBuf
::
from
);
target
.linker
=
cfg
.linker
.clone
()
.map
(
PathBuf
::
from
);
target
.crt_static
=
cfg
.crt_static
.clone
()
;
target
.crt_static
=
cfg
.crt_static
;
target
.musl_root
=
cfg
.musl_root
.clone
()
.map
(
PathBuf
::
from
);
target
.wasi_root
=
cfg
.wasi_root
.clone
()
.map
(
PathBuf
::
from
);
target
.qemu_rootfs
=
cfg
.qemu_rootfs
.clone
()
.map
(
PathBuf
::
from
);
...
...
src/bootstrap/dist.rs
浏览文件 @
5f979e9a
...
...
@@ -827,7 +827,7 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
assert
!
(
builder
.config.extended
);
let
name
=
pkgname
(
builder
,
"rust-analysis"
);
if
&
compiler
.host
!=
builder
.config.build
{
if
compiler
.host
!=
builder
.config.build
{
return
distdir
(
builder
)
.join
(
format!
(
"{}-{}.tar.gz"
,
name
,
target
));
}
...
...
@@ -876,7 +876,7 @@ fn filter_fn(exclude_dirs: &[&str], dir: &str, path: &Path) -> bool {
Some
(
path
)
=>
path
,
None
=>
return
false
,
};
if
spath
.ends_with
(
"~"
)
||
spath
.ends_with
(
".pyc"
)
{
if
spath
.ends_with
(
'~'
)
||
spath
.ends_with
(
".pyc"
)
{
return
false
;
}
...
...
src/bootstrap/doc.rs
浏览文件 @
5f979e9a
...
...
@@ -560,7 +560,7 @@ fn run(self, builder: &Builder<'_>) {
builder
.ensure
(
Rustc
{
stage
,
target
});
// Build rustdoc.
builder
.ensure
(
tool
::
Rustdoc
{
compiler
:
compiler
});
builder
.ensure
(
tool
::
Rustdoc
{
compiler
});
// Symlink compiler docs to the output directory of rustdoc documentation.
let
out_dir
=
builder
.stage_out
(
compiler
,
Mode
::
ToolRustc
)
.join
(
target
)
.join
(
"doc"
);
...
...
src/bootstrap/flags.rs
浏览文件 @
5f979e9a
...
...
@@ -571,7 +571,7 @@ fn split(s: &[String]) -> Vec<String> {
}
fn
parse_deny_warnings
(
matches
:
&
getopts
::
Matches
)
->
Option
<
bool
>
{
match
matches
.opt_str
(
"warnings"
)
.as_
ref
()
.map
(|
v
|
v
.as_str
()
)
{
match
matches
.opt_str
(
"warnings"
)
.as_
deref
(
)
{
Some
(
"deny"
)
=>
Some
(
true
),
Some
(
"warn"
)
=>
Some
(
false
),
Some
(
value
)
=>
{
...
...
src/bootstrap/install.rs
浏览文件 @
5f979e9a
...
...
@@ -126,9 +126,8 @@ fn add_destdir(path: &Path, destdir: &Option<PathBuf>) -> PathBuf {
None
=>
return
path
.to_path_buf
(),
};
for
part
in
path
.components
()
{
match
part
{
Component
::
Normal
(
s
)
=>
ret
.push
(
s
),
_
=>
{}
if
let
Component
::
Normal
(
s
)
=
part
{
ret
.push
(
s
)
}
}
ret
...
...
src/bootstrap/lib.rs
浏览文件 @
5f979e9a
...
...
@@ -444,7 +444,7 @@ pub fn build(&mut self) {
builder
.execute_cli
();
}
else
{
let
builder
=
builder
::
Builder
::
new
(
&
self
);
let
_
=
builder
.execute_cli
();
builder
.execute_cli
();
}
// Check for postponed failures from `test --no-fail-fast`.
...
...
@@ -839,7 +839,7 @@ fn musl_root(&self, target: Interned<String>) -> Option<&Path> {
.target_config
.get
(
&
target
)
.and_then
(|
t
|
t
.musl_root
.as_ref
())
.or
(
self
.config.musl_root
.as_ref
())
.or
_else
(||
self
.config.musl_root
.as_ref
())
.map
(|
p
|
&**
p
)
}
...
...
@@ -1026,7 +1026,7 @@ fn lldb_vers(&self) -> String {
}
fn
llvm_link_tools_dynamically
(
&
self
,
target
:
Interned
<
String
>
)
->
bool
{
(
target
.contains
(
"linux-gnu"
)
||
target
.contains
(
"apple-darwin"
)
)
target
.contains
(
"linux-gnu"
)
||
target
.contains
(
"apple-darwin"
)
}
/// Returns the `version` string associated with this compiler for Rust
...
...
src/bootstrap/metadata.rs
浏览文件 @
5f979e9a
...
...
@@ -5,7 +5,6 @@
use
build_helper
::
output
;
use
serde
::
Deserialize
;
use
serde_json
;
use
crate
::
cache
::
INTERNER
;
use
crate
::{
Build
,
Crate
};
...
...
src/bootstrap/native.rs
浏览文件 @
5f979e9a
...
...
@@ -15,8 +15,6 @@
use
std
::
process
::
Command
;
use
build_helper
::{
output
,
t
};
use
cc
;
use
cmake
;
use
crate
::
builder
::{
Builder
,
RunConfig
,
ShouldRun
,
Step
};
use
crate
::
cache
::
Interned
;
...
...
@@ -205,7 +203,7 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
cfg
.define
(
"LLVM_ENABLE_LIBXML2"
,
"OFF"
);
}
if
enabled_llvm_projects
.len
()
>
0
{
if
!
enabled_llvm_projects
.is_empty
()
{
enabled_llvm_projects
.sort
();
enabled_llvm_projects
.dedup
();
cfg
.define
(
"LLVM_ENABLE_PROJECTS"
,
enabled_llvm_projects
.join
(
";"
));
...
...
src/bootstrap/test.rs
浏览文件 @
5f979e9a
...
...
@@ -1424,13 +1424,10 @@ fn run(self, builder: &Builder<'_>) {
}
fn
markdown_test
(
builder
:
&
Builder
<
'_
>
,
compiler
:
Compiler
,
markdown
:
&
Path
)
->
bool
{
match
fs
::
read_to_string
(
markdown
)
{
Ok
(
contents
)
=>
{
if
!
contents
.contains
(
"```"
)
{
return
true
;
}
if
let
Ok
(
contents
)
=
fs
::
read_to_string
(
markdown
)
{
if
!
contents
.contains
(
"```"
)
{
return
true
;
}
Err
(
_
)
=>
{}
}
builder
.info
(
&
format!
(
"doc tests for: {}"
,
markdown
.display
()));
...
...
src/bootstrap/tool.rs
浏览文件 @
5f979e9a
...
...
@@ -234,7 +234,7 @@ pub fn prepare_tool_cargo(
cargo
.env
(
"RUSTC_EXTERNAL_TOOL"
,
"1"
);
}
let
mut
features
=
extra_features
.
iter
()
.cloned
()
.collect
::
<
Vec
<
_
>>
();
let
mut
features
=
extra_features
.
to_vec
();
if
builder
.build.config.cargo_native_static
{
if
path
.ends_with
(
"cargo"
)
||
path
.ends_with
(
"rls"
)
...
...
src/bootstrap/toolstate.rs
浏览文件 @
5f979e9a
...
...
@@ -124,7 +124,7 @@ fn check_changed_files(toolstates: &HashMap<Box<str>, ToolState>) {
let
output
=
t!
(
String
::
from_utf8
(
output
.stdout
));
for
(
tool
,
submodule
)
in
STABLE_TOOLS
.iter
()
.chain
(
NIGHTLY_TOOLS
.iter
())
{
let
changed
=
output
.lines
()
.any
(|
l
|
l
.starts_with
(
"M"
)
&&
l
.ends_with
(
submodule
));
let
changed
=
output
.lines
()
.any
(|
l
|
l
.starts_with
(
'M'
)
&&
l
.ends_with
(
submodule
));
eprintln!
(
"Verifying status of {}..."
,
tool
);
if
!
changed
{
continue
;
...
...
src/bootstrap/util.rs
浏览文件 @
5f979e9a
...
...
@@ -98,7 +98,7 @@ impl Drop for TimeIt {
fn
drop
(
&
mut
self
)
{
let
time
=
self
.1
.elapsed
();
if
!
self
.0
{
println!
(
"
\t
finished in {}.{:03}"
,
time
.as_secs
(),
time
.subsec_
nanos
()
/
1_000_000
);
println!
(
"
\t
finished in {}.{:03}"
,
time
.as_secs
(),
time
.subsec_
millis
()
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录