Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
2b0c8fff
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,发现更多精彩内容 >>
提交
2b0c8fff
编写于
8月 16, 2021
作者:
L
Léo Lanteri Thauvin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Various pattern cleanups
上级
fde1b76b
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
47 addition
and
68 deletion
+47
-68
compiler/rustc_ast/src/mut_visit.rs
compiler/rustc_ast/src/mut_visit.rs
+2
-5
compiler/rustc_ast/src/visit.rs
compiler/rustc_ast/src/visit.rs
+2
-5
compiler/rustc_expand/src/lib.rs
compiler/rustc_expand/src/lib.rs
+1
-0
compiler/rustc_middle/src/mir/mod.rs
compiler/rustc_middle/src/mir/mod.rs
+3
-6
compiler/rustc_middle/src/mir/visit.rs
compiler/rustc_middle/src/mir/visit.rs
+8
-9
compiler/rustc_middle/src/thir.rs
compiler/rustc_middle/src/thir.rs
+4
-12
compiler/rustc_middle/src/ty/print/pretty.rs
compiler/rustc_middle/src/ty/print/pretty.rs
+20
-18
compiler/rustc_typeck/src/check/expr.rs
compiler/rustc_typeck/src/check/expr.rs
+3
-6
compiler/rustc_typeck/src/expr_use_visitor.rs
compiler/rustc_typeck/src/expr_use_visitor.rs
+4
-7
未找到文件。
compiler/rustc_ast/src/mut_visit.rs
浏览文件 @
2b0c8fff
...
...
@@ -1179,13 +1179,10 @@ fn noop_visit_inline_asm<T: MutVisitor>(asm: &mut InlineAsm, vis: &mut T) {
for
(
op
,
_
)
in
&
mut
asm
.operands
{
match
op
{
InlineAsmOperand
::
In
{
expr
,
..
}
|
InlineAsmOperand
::
Out
{
expr
:
Some
(
expr
),
..
}
|
InlineAsmOperand
::
InOut
{
expr
,
..
}
|
InlineAsmOperand
::
Sym
{
expr
,
..
}
=>
vis
.visit_expr
(
expr
),
InlineAsmOperand
::
Out
{
expr
,
..
}
=>
{
if
let
Some
(
expr
)
=
expr
{
vis
.visit_expr
(
expr
);
}
}
InlineAsmOperand
::
Out
{
expr
:
None
,
..
}
=>
{}
InlineAsmOperand
::
SplitInOut
{
in_expr
,
out_expr
,
..
}
=>
{
vis
.visit_expr
(
in_expr
);
if
let
Some
(
out_expr
)
=
out_expr
{
...
...
compiler/rustc_ast/src/visit.rs
浏览文件 @
2b0c8fff
...
...
@@ -714,13 +714,10 @@ fn walk_inline_asm<'a, V: Visitor<'a>>(visitor: &mut V, asm: &'a InlineAsm) {
for
(
op
,
_
)
in
&
asm
.operands
{
match
op
{
InlineAsmOperand
::
In
{
expr
,
..
}
|
InlineAsmOperand
::
Out
{
expr
:
Some
(
expr
),
..
}
|
InlineAsmOperand
::
InOut
{
expr
,
..
}
|
InlineAsmOperand
::
Sym
{
expr
,
..
}
=>
visitor
.visit_expr
(
expr
),
InlineAsmOperand
::
Out
{
expr
,
..
}
=>
{
if
let
Some
(
expr
)
=
expr
{
visitor
.visit_expr
(
expr
);
}
}
InlineAsmOperand
::
Out
{
expr
:
None
,
..
}
=>
{}
InlineAsmOperand
::
SplitInOut
{
in_expr
,
out_expr
,
..
}
=>
{
visitor
.visit_expr
(
in_expr
);
if
let
Some
(
out_expr
)
=
out_expr
{
...
...
compiler/rustc_expand/src/lib.rs
浏览文件 @
2b0c8fff
#![cfg_attr(bootstrap,
feature(bindings_after_at))]
#![feature(crate_visibility_modifier)]
#![feature(decl_macro)]
#![feature(destructuring_assignment)]
...
...
compiler/rustc_middle/src/mir/mod.rs
浏览文件 @
2b0c8fff
...
...
@@ -1664,13 +1664,10 @@ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
AscribeUserType
(
box
(
ref
place
,
ref
c_ty
),
ref
variance
)
=>
{
write!
(
fmt
,
"AscribeUserType({:?}, {:?}, {:?})"
,
place
,
variance
,
c_ty
)
}
Coverage
(
box
ref
coverage
)
=>
{
if
let
Some
(
rgn
)
=
&
coverage
.code_region
{
write!
(
fmt
,
"Coverage::{:?} for {:?}"
,
coverage
.kind
,
rgn
)
}
else
{
write!
(
fmt
,
"Coverage::{:?}"
,
coverage
.kind
)
}
Coverage
(
box
self
::
Coverage
{
ref
kind
,
code_region
:
Some
(
ref
rgn
)
})
=>
{
write!
(
fmt
,
"Coverage::{:?} for {:?}"
,
kind
,
rgn
)
}
Coverage
(
box
ref
coverage
)
=>
write!
(
fmt
,
"Coverage::{:?}"
,
coverage
.kind
),
CopyNonOverlapping
(
box
crate
::
mir
::
CopyNonOverlapping
{
ref
src
,
ref
dst
,
...
...
compiler/rustc_middle/src/mir/visit.rs
浏览文件 @
2b0c8fff
...
...
@@ -587,14 +587,12 @@ fn super_terminator(&mut self,
InlineAsmOperand
::
In
{
value
,
..
}
=>
{
self
.visit_operand
(
value
,
location
);
}
InlineAsmOperand
::
Out
{
place
,
..
}
=>
{
if
let
Some
(
place
)
=
place
{
self
.visit_place
(
place
,
PlaceContext
::
MutatingUse
(
MutatingUseContext
::
Store
),
location
,
);
}
InlineAsmOperand
::
Out
{
place
:
Some
(
place
),
..
}
=>
{
self
.visit_place
(
place
,
PlaceContext
::
MutatingUse
(
MutatingUseContext
::
Store
),
location
,
);
}
InlineAsmOperand
::
InOut
{
in_value
,
out_place
,
..
}
=>
{
self
.visit_operand
(
in_value
,
location
);
...
...
@@ -610,7 +608,8 @@ fn super_terminator(&mut self,
|
InlineAsmOperand
::
SymFn
{
value
}
=>
{
self
.visit_constant
(
value
,
location
);
}
InlineAsmOperand
::
SymStatic
{
def_id
:
_
}
=>
{}
InlineAsmOperand
::
Out
{
place
:
None
,
..
}
|
InlineAsmOperand
::
SymStatic
{
def_id
:
_
}
=>
{}
}
}
}
...
...
compiler/rustc_middle/src/thir.rs
浏览文件 @
2b0c8fff
...
...
@@ -14,7 +14,7 @@
use
rustc_hir
::
def_id
::
DefId
;
use
rustc_hir
::
RangeEnd
;
use
rustc_index
::
newtype_index
;
use
rustc_index
::
vec
::
{
Idx
,
IndexVec
}
;
use
rustc_index
::
vec
::
IndexVec
;
use
rustc_middle
::
infer
::
canonical
::
Canonical
;
use
rustc_middle
::
middle
::
region
;
use
rustc_middle
::
mir
::{
...
...
@@ -716,17 +716,9 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
PatKind
::
Variant
{
adt_def
,
variant_index
,
..
}
=>
{
Some
(
&
adt_def
.variants
[
variant_index
])
}
_
=>
{
if
let
ty
::
Adt
(
adt
,
_
)
=
self
.ty
.kind
()
{
if
!
adt
.is_enum
()
{
Some
(
&
adt
.variants
[
VariantIdx
::
new
(
0
)])
}
else
{
None
}
}
else
{
None
}
}
_
=>
self
.ty
.ty_adt_def
()
.and_then
(|
adt
|
{
if
!
adt
.is_enum
()
{
Some
(
adt
.non_enum_variant
())
}
else
{
None
}
}),
};
if
let
Some
(
variant
)
=
variant
{
...
...
compiler/rustc_middle/src/ty/print/pretty.rs
浏览文件 @
2b0c8fff
...
...
@@ -927,27 +927,29 @@ fn pretty_print_const(
}
match
ct
.val
{
ty
::
ConstKind
::
Unevaluated
(
ty
::
Unevaluated
{
def
,
substs
,
promoted
})
=>
{
if
let
Some
(
promoted
)
=
promoted
{
p!
(
print_value_path
(
def
.did
,
substs
));
p!
(
write
(
"::{:?}"
,
promoted
));
}
else
{
match
self
.tcx
()
.def_kind
(
def
.did
)
{
DefKind
::
Static
|
DefKind
::
Const
|
DefKind
::
AssocConst
=>
{
p!
(
print_value_path
(
def
.did
,
substs
))
}
_
=>
{
if
def
.is_local
()
{
let
span
=
self
.tcx
()
.def_span
(
def
.did
);
if
let
Ok
(
snip
)
=
self
.tcx
()
.sess
.source_map
()
.span_to_snippet
(
span
)
{
p!
(
write
(
"{}"
,
snip
))
}
else
{
print_underscore!
()
}
ty
::
ConstKind
::
Unevaluated
(
ty
::
Unevaluated
{
def
,
substs
,
promoted
:
Some
(
promoted
),
})
=>
{
p!
(
print_value_path
(
def
.did
,
substs
));
p!
(
write
(
"::{:?}"
,
promoted
));
}
ty
::
ConstKind
::
Unevaluated
(
ty
::
Unevaluated
{
def
,
substs
,
promoted
:
None
})
=>
{
match
self
.tcx
()
.def_kind
(
def
.did
)
{
DefKind
::
Static
|
DefKind
::
Const
|
DefKind
::
AssocConst
=>
{
p!
(
print_value_path
(
def
.did
,
substs
))
}
_
=>
{
if
def
.is_local
()
{
let
span
=
self
.tcx
()
.def_span
(
def
.did
);
if
let
Ok
(
snip
)
=
self
.tcx
()
.sess
.source_map
()
.span_to_snippet
(
span
)
{
p!
(
write
(
"{}"
,
snip
))
}
else
{
print_underscore!
()
}
}
else
{
print_underscore!
()
}
}
}
...
...
compiler/rustc_typeck/src/check/expr.rs
浏览文件 @
2b0c8fff
...
...
@@ -2164,14 +2164,11 @@ fn check_expr_asm(&self, asm: &'tcx hir::InlineAsm<'tcx>) -> Ty<'tcx> {
hir
::
InlineAsmOperand
::
In
{
expr
,
..
}
=>
{
self
.check_expr_asm_operand
(
expr
,
true
);
}
hir
::
InlineAsmOperand
::
Out
{
expr
,
..
}
=>
{
if
let
Some
(
expr
)
=
expr
{
self
.check_expr_asm_operand
(
expr
,
false
);
}
}
hir
::
InlineAsmOperand
::
InOut
{
expr
,
..
}
=>
{
hir
::
InlineAsmOperand
::
Out
{
expr
:
Some
(
expr
),
..
}
|
hir
::
InlineAsmOperand
::
InOut
{
expr
,
..
}
=>
{
self
.check_expr_asm_operand
(
expr
,
false
);
}
hir
::
InlineAsmOperand
::
Out
{
expr
:
None
,
..
}
=>
{}
hir
::
InlineAsmOperand
::
SplitInOut
{
in_expr
,
out_expr
,
..
}
=>
{
self
.check_expr_asm_operand
(
in_expr
,
true
);
if
let
Some
(
out_expr
)
=
out_expr
{
...
...
compiler/rustc_typeck/src/expr_use_visitor.rs
浏览文件 @
2b0c8fff
...
...
@@ -334,12 +334,8 @@ pub fn walk_expr(&mut self, expr: &hir::Expr<'_>) {
match
op
{
hir
::
InlineAsmOperand
::
In
{
expr
,
..
}
|
hir
::
InlineAsmOperand
::
Sym
{
expr
,
..
}
=>
self
.consume_expr
(
expr
),
hir
::
InlineAsmOperand
::
Out
{
expr
,
..
}
=>
{
if
let
Some
(
expr
)
=
expr
{
self
.mutate_expr
(
expr
);
}
}
hir
::
InlineAsmOperand
::
InOut
{
expr
,
..
}
=>
{
hir
::
InlineAsmOperand
::
Out
{
expr
:
Some
(
expr
),
..
}
|
hir
::
InlineAsmOperand
::
InOut
{
expr
,
..
}
=>
{
self
.mutate_expr
(
expr
);
}
hir
::
InlineAsmOperand
::
SplitInOut
{
in_expr
,
out_expr
,
..
}
=>
{
...
...
@@ -348,7 +344,8 @@ pub fn walk_expr(&mut self, expr: &hir::Expr<'_>) {
self
.mutate_expr
(
out_expr
);
}
}
hir
::
InlineAsmOperand
::
Const
{
..
}
=>
{}
hir
::
InlineAsmOperand
::
Out
{
expr
:
None
,
..
}
|
hir
::
InlineAsmOperand
::
Const
{
..
}
=>
{}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录