Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
5a07e33d
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
5a07e33d
编写于
4月 01, 2023
作者:
M
Matthias Krüger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use and_then/flat_map for map().flatten()
上级
ac229c28
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
7 addition
and
10 deletion
+7
-10
compiler/rustc_codegen_llvm/src/common.rs
compiler/rustc_codegen_llvm/src/common.rs
+1
-2
compiler/rustc_middle/src/ty/consts/valtree.rs
compiler/rustc_middle/src/ty/consts/valtree.rs
+1
-1
compiler/rustc_mir_build/src/build/expr/as_constant.rs
compiler/rustc_mir_build/src/build/expr/as_constant.rs
+3
-3
compiler/rustc_session/src/options.rs
compiler/rustc_session/src/options.rs
+1
-1
compiler/rustc_trait_selection/src/traits/outlives_bounds.rs
compiler/rustc_trait_selection/src/traits/outlives_bounds.rs
+1
-3
未找到文件。
compiler/rustc_codegen_llvm/src/common.rs
浏览文件 @
5a07e33d
...
...
@@ -378,8 +378,7 @@ pub(crate) fn get_dllimport<'tcx>(
name
:
&
str
,
)
->
Option
<&
'tcx
DllImport
>
{
tcx
.native_library
(
id
)
.map
(|
lib
|
lib
.dll_imports
.iter
()
.find
(|
di
|
di
.name
.as_str
()
==
name
))
.flatten
()
.and_then
(|
lib
|
lib
.dll_imports
.iter
()
.find
(|
di
|
di
.name
.as_str
()
==
name
))
}
pub
(
crate
)
fn
is_mingw_gnu_toolchain
(
target
:
&
Target
)
->
bool
{
...
...
compiler/rustc_middle/src/ty/consts/valtree.rs
浏览文件 @
5a07e33d
...
...
@@ -79,7 +79,7 @@ pub fn try_to_scalar_int(self) -> Option<ScalarInt> {
}
pub
fn
try_to_target_usize
(
self
,
tcx
:
TyCtxt
<
'tcx
>
)
->
Option
<
u64
>
{
self
.try_to_scalar_int
()
.
map
(|
s
|
s
.try_to_target_usize
(
tcx
)
.ok
())
.flatten
(
)
self
.try_to_scalar_int
()
.
and_then
(|
s
|
s
.try_to_target_usize
(
tcx
)
.ok
()
)
}
/// Get the values inside the ValTree as a slice of bytes. This only works for
...
...
compiler/rustc_mir_build/src/build/expr/as_constant.rs
浏览文件 @
5a07e33d
...
...
@@ -62,21 +62,21 @@ pub fn as_constant_inner<'tcx>(
Constant
{
span
,
user_ty
:
None
,
literal
}
}
ExprKind
::
NonHirLiteral
{
lit
,
ref
user_ty
}
=>
{
let
user_ty
=
user_ty
.as_ref
()
.
map
(
push_cuta
)
.flatten
(
);
let
user_ty
=
user_ty
.as_ref
()
.
and_then
(
push_cuta
);
let
literal
=
ConstantKind
::
Val
(
ConstValue
::
Scalar
(
Scalar
::
Int
(
lit
)),
ty
);
Constant
{
span
,
user_ty
,
literal
}
}
ExprKind
::
ZstLiteral
{
ref
user_ty
}
=>
{
let
user_ty
=
user_ty
.as_ref
()
.
map
(
push_cuta
)
.flatten
(
);
let
user_ty
=
user_ty
.as_ref
()
.
and_then
(
push_cuta
);
let
literal
=
ConstantKind
::
Val
(
ConstValue
::
ZeroSized
,
ty
);
Constant
{
span
,
user_ty
,
literal
}
}
ExprKind
::
NamedConst
{
def_id
,
substs
,
ref
user_ty
}
=>
{
let
user_ty
=
user_ty
.as_ref
()
.
map
(
push_cuta
)
.flatten
(
);
let
user_ty
=
user_ty
.as_ref
()
.
and_then
(
push_cuta
);
let
uneval
=
mir
::
UnevaluatedConst
::
new
(
ty
::
WithOptConstParam
::
unknown
(
def_id
),
substs
);
let
literal
=
ConstantKind
::
Unevaluated
(
uneval
,
ty
);
...
...
compiler/rustc_session/src/options.rs
浏览文件 @
5a07e33d
...
...
@@ -911,7 +911,7 @@ pub(crate) fn parse_instrument_xray(
let
mut
seen_instruction_threshold
=
false
;
let
mut
seen_skip_entry
=
false
;
let
mut
seen_skip_exit
=
false
;
for
option
in
v
.into_iter
()
.
map
(|
v
|
v
.split
(
','
))
.flatten
(
)
{
for
option
in
v
.into_iter
()
.
flat_map
(|
v
|
v
.split
(
','
)
)
{
match
option
{
"always"
if
!
seen_always
&&
!
seen_never
=>
{
options
.always
=
true
;
...
...
compiler/rustc_trait_selection/src/traits/outlives_bounds.rs
浏览文件 @
5a07e33d
...
...
@@ -110,8 +110,6 @@ fn implied_bounds_tys(
body_id
:
LocalDefId
,
tys
:
FxIndexSet
<
Ty
<
'tcx
>>
,
)
->
Bounds
<
'a
,
'tcx
>
{
tys
.into_iter
()
.map
(
move
|
ty
|
self
.implied_outlives_bounds
(
param_env
,
body_id
,
ty
))
.flatten
()
tys
.into_iter
()
.flat_map
(
move
|
ty
|
self
.implied_outlives_bounds
(
param_env
,
body_id
,
ty
))
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录