Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
19730cc9
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,发现更多精彩内容 >>
提交
19730cc9
编写于
7月 12, 2018
作者:
C
csmoe
提交者:
Oliver Schneider
7月 16, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix tidy
上级
5b0cf56f
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
131 addition
and
42 deletion
+131
-42
src/librustc/hir/intravisit.rs
src/librustc/hir/intravisit.rs
+7
-1
src/librustc/hir/lowering.rs
src/librustc/hir/lowering.rs
+16
-4
src/librustc/middle/liveness.rs
src/librustc/middle/liveness.rs
+28
-10
src/librustc/middle/reachable.rs
src/librustc/middle/reachable.rs
+13
-6
src/librustc/middle/resolve_lifetime.rs
src/librustc/middle/resolve_lifetime.rs
+3
-1
src/librustc_lint/types.rs
src/librustc_lint/types.rs
+6
-1
src/librustc_lint/unused.rs
src/librustc_lint/unused.rs
+16
-3
src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs
...row_check/nll/region_infer/error_reporting/region_name.rs
+8
-2
src/librustc_mir/hair/cx/expr.rs
src/librustc_mir/hair/cx/expr.rs
+3
-1
src/librustc_privacy/lib.rs
src/librustc_privacy/lib.rs
+11
-4
src/librustc_typeck/check/demand.rs
src/librustc_typeck/check/demand.rs
+2
-1
src/librustc_typeck/check/method/suggest.rs
src/librustc_typeck/check/method/suggest.rs
+3
-1
src/librustc_typeck/check/op.rs
src/librustc_typeck/check/op.rs
+7
-4
src/librustc_typeck/check/writeback.rs
src/librustc_typeck/check/writeback.rs
+2
-1
src/librustc_typeck/collect.rs
src/librustc_typeck/collect.rs
+6
-2
未找到文件。
src/librustc/hir/intravisit.rs
浏览文件 @
19730cc9
...
...
@@ -519,7 +519,13 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
// visit_enum_def() takes care of visiting the Item's NodeId
visitor
.visit_enum_def
(
enum_definition
,
type_parameters
,
item
.id
,
item
.span
)
}
ItemKind
::
Impl
(
..
,
ref
type_parameters
,
ref
opt_trait_reference
,
ref
typ
,
ref
impl_item_refs
)
=>
{
ItemKind
::
Impl
(
..
,
ref
type_parameters
,
ref
opt_trait_reference
,
ref
typ
,
ref
impl_item_refs
)
=>
{
visitor
.visit_id
(
item
.id
);
visitor
.visit_generics
(
type_parameters
);
walk_list!
(
visitor
,
visit_trait_ref
,
opt_trait_reference
);
...
...
src/librustc/hir/lowering.rs
浏览文件 @
19730cc9
...
...
@@ -3877,7 +3877,9 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
let
expr
=
opt_expr
.as_ref
()
.map
(|
x
|
self
.lower_expr
(
x
))
.unwrap_or_else
(||
self
.expr
(
e
.span
,
hir
::
ExprKind
::
Tup
(
hir_vec!
[]),
ThinVec
::
new
()));
.unwrap_or_else
(||
self
.expr
(
e
.span
,
hir
::
ExprKind
::
Tup
(
hir_vec!
[]),
ThinVec
::
new
())
);
hir
::
ExprKind
::
Yield
(
P
(
expr
))
}
...
...
@@ -4053,11 +4055,18 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
P
(
self
.expr
(
head_sp
,
hir
::
ExprKind
::
Match
(
next_expr
,
arms
,
hir
::
MatchSource
::
ForLoopDesugar
),
hir
::
ExprKind
::
Match
(
next_expr
,
arms
,
hir
::
MatchSource
::
ForLoopDesugar
),
ThinVec
::
new
(),
))
};
let
match_stmt
=
respan
(
head_sp
,
hir
::
StmtKind
::
Expr
(
match_expr
,
self
.next_id
()
.node_id
));
let
match_stmt
=
respan
(
head_sp
,
hir
::
StmtKind
::
Expr
(
match_expr
,
self
.next_id
()
.node_id
)
);
let
next_expr
=
P
(
self
.expr_ident
(
head_sp
,
next_ident
,
next_pat
.id
));
...
...
@@ -4076,7 +4085,10 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
let
body_block
=
self
.with_loop_scope
(
e
.id
,
|
this
|
this
.lower_block
(
body
,
false
));
let
body_expr
=
P
(
self
.expr_block
(
body_block
,
ThinVec
::
new
()));
let
body_stmt
=
respan
(
body
.span
,
hir
::
StmtKind
::
Expr
(
body_expr
,
self
.next_id
()
.node_id
));
let
body_stmt
=
respan
(
body
.span
,
hir
::
StmtKind
::
Expr
(
body_expr
,
self
.next_id
()
.node_id
)
);
let
loop_block
=
P
(
self
.block_all
(
e
.span
,
...
...
src/librustc/middle/liveness.rs
浏览文件 @
19730cc9
...
...
@@ -486,7 +486,10 @@ fn visit_expr<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, expr: &'tcx Expr) {
}
// live nodes required for interesting control flow:
hir
::
ExprKind
::
If
(
..
)
|
hir
::
ExprKind
::
Match
(
..
)
|
hir
::
ExprKind
::
While
(
..
)
|
hir
::
ExprKind
::
Loop
(
..
)
=>
{
hir
::
ExprKind
::
If
(
..
)
|
hir
::
ExprKind
::
Match
(
..
)
|
hir
::
ExprKind
::
While
(
..
)
|
hir
::
ExprKind
::
Loop
(
..
)
=>
{
ir
.add_live_node_for_node
(
expr
.hir_id
,
ExprNode
(
expr
.span
));
intravisit
::
walk_expr
(
ir
,
expr
);
}
...
...
@@ -496,15 +499,30 @@ fn visit_expr<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, expr: &'tcx Expr) {
}
// otherwise, live nodes are not required:
hir
::
ExprKind
::
Index
(
..
)
|
hir
::
ExprKind
::
Field
(
..
)
|
hir
::
ExprKind
::
Array
(
..
)
|
hir
::
ExprKind
::
Call
(
..
)
|
hir
::
ExprKind
::
MethodCall
(
..
)
|
hir
::
ExprKind
::
Tup
(
..
)
|
hir
::
ExprKind
::
Binary
(
..
)
|
hir
::
ExprKind
::
AddrOf
(
..
)
|
hir
::
ExprKind
::
Cast
(
..
)
|
hir
::
ExprKind
::
Unary
(
..
)
|
hir
::
ExprKind
::
Break
(
..
)
|
hir
::
ExprKind
::
Continue
(
_
)
|
hir
::
ExprKind
::
Lit
(
_
)
|
hir
::
ExprKind
::
Ret
(
..
)
|
hir
::
ExprKind
::
Block
(
..
)
|
hir
::
ExprKind
::
Assign
(
..
)
|
hir
::
ExprKind
::
AssignOp
(
..
)
|
hir
::
ExprKind
::
Struct
(
..
)
|
hir
::
ExprKind
::
Repeat
(
..
)
|
hir
::
ExprKind
::
InlineAsm
(
..
)
|
hir
::
ExprKind
::
Box
(
..
)
|
hir
::
ExprKind
::
Yield
(
..
)
|
hir
::
ExprKind
::
Type
(
..
)
|
hir
::
ExprKind
::
Path
(
hir
::
QPath
::
TypeRelative
(
..
))
=>
{
hir
::
ExprKind
::
Index
(
..
)
|
hir
::
ExprKind
::
Field
(
..
)
|
hir
::
ExprKind
::
Array
(
..
)
|
hir
::
ExprKind
::
Call
(
..
)
|
hir
::
ExprKind
::
MethodCall
(
..
)
|
hir
::
ExprKind
::
Tup
(
..
)
|
hir
::
ExprKind
::
Binary
(
..
)
|
hir
::
ExprKind
::
AddrOf
(
..
)
|
hir
::
ExprKind
::
Cast
(
..
)
|
hir
::
ExprKind
::
Unary
(
..
)
|
hir
::
ExprKind
::
Break
(
..
)
|
hir
::
ExprKind
::
Continue
(
_
)
|
hir
::
ExprKind
::
Lit
(
_
)
|
hir
::
ExprKind
::
Ret
(
..
)
|
hir
::
ExprKind
::
Block
(
..
)
|
hir
::
ExprKind
::
Assign
(
..
)
|
hir
::
ExprKind
::
AssignOp
(
..
)
|
hir
::
ExprKind
::
Struct
(
..
)
|
hir
::
ExprKind
::
Repeat
(
..
)
|
hir
::
ExprKind
::
InlineAsm
(
..
)
|
hir
::
ExprKind
::
Box
(
..
)
|
hir
::
ExprKind
::
Yield
(
..
)
|
hir
::
ExprKind
::
Type
(
..
)
|
hir
::
ExprKind
::
Path
(
hir
::
QPath
::
TypeRelative
(
..
))
=>
{
intravisit
::
walk_expr
(
ir
,
expr
);
}
}
...
...
src/librustc/middle/reachable.rs
浏览文件 @
19730cc9
...
...
@@ -279,13 +279,20 @@ fn propagate_node(&mut self, node: &hir_map::Node<'tcx>,
// These are normal, nothing reachable about these
// inherently and their children are already in the
// worklist, as determined by the privacy pass
hir
::
ItemKind
::
ExternCrate
(
_
)
|
hir
::
ItemKind
::
Use
(
..
)
|
hir
::
ItemKind
::
ExternCrate
(
_
)
|
hir
::
ItemKind
::
Use
(
..
)
|
hir
::
ItemKind
::
Existential
(
..
)
|
hir
::
ItemKind
::
Ty
(
..
)
|
hir
::
ItemKind
::
Static
(
..
)
|
hir
::
ItemKind
::
Mod
(
..
)
|
hir
::
ItemKind
::
ForeignMod
(
..
)
|
hir
::
ItemKind
::
Impl
(
..
)
|
hir
::
ItemKind
::
Trait
(
..
)
|
hir
::
ItemKind
::
TraitAlias
(
..
)
|
hir
::
ItemKind
::
Struct
(
..
)
|
hir
::
ItemKind
::
Enum
(
..
)
|
hir
::
ItemKind
::
Union
(
..
)
|
hir
::
ItemKind
::
GlobalAsm
(
..
)
=>
{}
hir
::
ItemKind
::
Ty
(
..
)
|
hir
::
ItemKind
::
Static
(
..
)
|
hir
::
ItemKind
::
Mod
(
..
)
|
hir
::
ItemKind
::
ForeignMod
(
..
)
|
hir
::
ItemKind
::
Impl
(
..
)
|
hir
::
ItemKind
::
Trait
(
..
)
|
hir
::
ItemKind
::
TraitAlias
(
..
)
|
hir
::
ItemKind
::
Struct
(
..
)
|
hir
::
ItemKind
::
Enum
(
..
)
|
hir
::
ItemKind
::
Union
(
..
)
|
hir
::
ItemKind
::
GlobalAsm
(
..
)
=>
{}
}
}
hir_map
::
NodeTraitItem
(
trait_method
)
=>
{
...
...
src/librustc/middle/resolve_lifetime.rs
浏览文件 @
19730cc9
...
...
@@ -675,7 +675,9 @@ fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
// ^ ^ this gets resolved in the scope of
// the exist_ty generics
let
(
generics
,
bounds
)
=
match
self
.tcx.hir
.expect_item
(
id
)
.node
{
hir
::
ItemKind
::
Existential
(
hir
::
ExistTy
{
ref
generics
,
ref
bounds
,
..
})
=>
(
hir
::
ItemKind
::
Existential
(
hir
::
ExistTy
{
ref
generics
,
ref
bounds
,
..
}
)
=>
(
generics
,
bounds
,
),
...
...
src/librustc_lint/types.rs
浏览文件 @
19730cc9
...
...
@@ -285,7 +285,12 @@ fn check_limits(cx: &LateContext,
fn
is_comparison
(
binop
:
hir
::
BinOp
)
->
bool
{
match
binop
.node
{
hir
::
BinOpKind
::
Eq
|
hir
::
BinOpKind
::
Lt
|
hir
::
BinOpKind
::
Le
|
hir
::
BinOpKind
::
Ne
|
hir
::
BinOpKind
::
Ge
|
hir
::
BinOpKind
::
Gt
=>
true
,
hir
::
BinOpKind
::
Eq
|
hir
::
BinOpKind
::
Lt
|
hir
::
BinOpKind
::
Le
|
hir
::
BinOpKind
::
Ne
|
hir
::
BinOpKind
::
Ge
|
hir
::
BinOpKind
::
Gt
=>
true
,
_
=>
false
,
}
}
...
...
src/librustc_lint/unused.rs
浏览文件 @
19730cc9
...
...
@@ -102,16 +102,29 @@ fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) {
// attribute which does exist on the comparison trait methods
hir
::
ExprKind
::
Binary
(
bin_op
,
..
)
=>
{
match
bin_op
.node
{
hir
::
BinOpKind
::
Eq
|
hir
::
BinOpKind
::
Lt
|
hir
::
BinOpKind
::
Le
|
hir
::
BinOpKind
::
Ne
|
hir
::
BinOpKind
::
Ge
|
hir
::
BinOpKind
::
Gt
=>
{
hir
::
BinOpKind
::
Eq
|
hir
::
BinOpKind
::
Lt
|
hir
::
BinOpKind
::
Le
|
hir
::
BinOpKind
::
Ne
|
hir
::
BinOpKind
::
Ge
|
hir
::
BinOpKind
::
Gt
=>
{
Some
(
"comparison"
)
},
hir
::
BinOpKind
::
Add
|
hir
::
BinOpKind
::
Sub
|
hir
::
BinOpKind
::
Div
|
hir
::
BinOpKind
::
Mul
|
hir
::
BinOpKind
::
Rem
=>
{
hir
::
BinOpKind
::
Add
|
hir
::
BinOpKind
::
Sub
|
hir
::
BinOpKind
::
Div
|
hir
::
BinOpKind
::
Mul
|
hir
::
BinOpKind
::
Rem
=>
{
Some
(
"arithmetic operation"
)
},
hir
::
BinOpKind
::
And
|
hir
::
BinOpKind
::
Or
=>
{
Some
(
"logical operation"
)
},
hir
::
BinOpKind
::
BitXor
|
hir
::
BinOpKind
::
BitAnd
|
hir
::
BinOpKind
::
BitOr
|
hir
::
BinOpKind
::
Shl
|
hir
::
BinOpKind
::
Shr
=>
{
hir
::
BinOpKind
::
BitXor
|
hir
::
BinOpKind
::
BitAnd
|
hir
::
BinOpKind
::
BitOr
|
hir
::
BinOpKind
::
Shl
|
hir
::
BinOpKind
::
Shr
=>
{
Some
(
"bitwise operation"
)
},
}
...
...
src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs
浏览文件 @
19730cc9
...
...
@@ -263,7 +263,10 @@ fn give_name_if_we_can_match_hir_ty(
//
// &
// - let's call the lifetime of this reference `'1`
(
ty
::
TyRef
(
region
,
referent_ty
,
_
),
hir
::
TyKind
::
Rptr
(
_
lifetime
,
referent_hir_ty
))
=>
{
(
ty
::
TyRef
(
region
,
referent_ty
,
_
),
hir
::
TyKind
::
Rptr
(
_
lifetime
,
referent_hir_ty
),
)
=>
{
if
region
.to_region_vid
()
==
needle_fr
{
let
region_name
=
self
.synthesize_region_name
(
counter
);
...
...
@@ -287,7 +290,10 @@ fn give_name_if_we_can_match_hir_ty(
}
// Match up something like `Foo<'1>`
(
ty
::
TyAdt
(
_
adt_def
,
substs
),
hir
::
TyKind
::
Path
(
hir
::
QPath
::
Resolved
(
None
,
path
)))
=>
{
(
ty
::
TyAdt
(
_
adt_def
,
substs
),
hir
::
TyKind
::
Path
(
hir
::
QPath
::
Resolved
(
None
,
path
)),
)
=>
{
if
let
Some
(
last_segment
)
=
path
.segments
.last
()
{
if
let
Some
(
name
)
=
self
.match_adt_and_segment
(
substs
,
...
...
src/librustc_mir/hair/cx/expr.rs
浏览文件 @
19730cc9
...
...
@@ -238,7 +238,9 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
args
:
vec!
[
fun
.to_ref
(),
tupled_args
.to_ref
()],
}
}
else
{
let
adt_data
=
if
let
hir
::
ExprKind
::
Path
(
hir
::
QPath
::
Resolved
(
_
,
ref
path
))
=
fun
.node
{
let
adt_data
=
if
let
hir
::
ExprKind
::
Path
(
hir
::
QPath
::
Resolved
(
_
,
ref
path
))
=
fun
.node
{
// Tuple-like ADTs are represented as ExprKind::Call. We convert them here.
expr_ty
.ty_adt_def
()
.and_then
(|
adt_def
|
{
match
path
.def
{
...
...
src/librustc_privacy/lib.rs
浏览文件 @
19730cc9
...
...
@@ -216,9 +216,15 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
}
}
hir
::
ItemKind
::
Existential
(
..
)
|
hir
::
ItemKind
::
Use
(
..
)
|
hir
::
ItemKind
::
Static
(
..
)
|
hir
::
ItemKind
::
Const
(
..
)
|
hir
::
ItemKind
::
GlobalAsm
(
..
)
|
hir
::
ItemKind
::
Ty
(
..
)
|
hir
::
ItemKind
::
Mod
(
..
)
|
hir
::
ItemKind
::
TraitAlias
(
..
)
|
hir
::
ItemKind
::
Fn
(
..
)
|
hir
::
ItemKind
::
ExternCrate
(
..
)
=>
{}
hir
::
ItemKind
::
Use
(
..
)
|
hir
::
ItemKind
::
Static
(
..
)
|
hir
::
ItemKind
::
Const
(
..
)
|
hir
::
ItemKind
::
GlobalAsm
(
..
)
|
hir
::
ItemKind
::
Ty
(
..
)
|
hir
::
ItemKind
::
Mod
(
..
)
|
hir
::
ItemKind
::
TraitAlias
(
..
)
|
hir
::
ItemKind
::
Fn
(
..
)
|
hir
::
ItemKind
::
ExternCrate
(
..
)
=>
{}
}
// Mark all items in interfaces of reachable items as reachable
...
...
@@ -373,7 +379,8 @@ fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef) {
loop
{
let
module
=
if
module_id
==
ast
::
CRATE_NODE_ID
{
&
self
.tcx.hir
.krate
()
.module
}
else
if
let
hir
::
ItemKind
::
Mod
(
ref
module
)
=
self
.tcx.hir
.expect_item
(
module_id
)
.node
{
}
else
if
let
hir
::
ItemKind
::
Mod
(
ref
module
)
=
self
.tcx.hir
.expect_item
(
module_id
)
.node
{
module
}
else
{
unreachable!
()
...
...
src/librustc_typeck/check/demand.rs
浏览文件 @
19730cc9
...
...
@@ -306,7 +306,8 @@ pub fn check_ref(&self,
if
self
.can_coerce
(
ref_ty
,
expected
)
{
if
let
Ok
(
src
)
=
cm
.span_to_snippet
(
sp
)
{
let
sugg_expr
=
match
expr
.node
{
// parenthesize if needed (Issue #46756)
hir
::
ExprKind
::
Cast
(
_
,
_
)
|
hir
::
ExprKind
::
Binary
(
_
,
_
,
_
)
=>
format!
(
"({})"
,
src
),
hir
::
ExprKind
::
Cast
(
_
,
_
)
|
hir
::
ExprKind
::
Binary
(
_
,
_
,
_
)
=>
format!
(
"({})"
,
src
),
_
=>
src
,
};
if
let
Some
(
sugg
)
=
self
.can_use_as_ref
(
expr
)
{
...
...
src/librustc_typeck/check/method/suggest.rs
浏览文件 @
19730cc9
...
...
@@ -389,7 +389,9 @@ pub fn report_method_error(&self,
if
let
Some
(
expr
)
=
rcvr_expr
{
if
let
Ok
(
expr_string
)
=
tcx
.sess
.codemap
()
.span_to_snippet
(
expr
.span
)
{
report_function!
(
expr
.span
,
expr_string
);
}
else
if
let
hir
::
ExprKind
::
Path
(
hir
::
QPath
::
Resolved
(
_
,
ref
path
))
=
expr
.node
{
}
else
if
let
hir
::
ExprKind
::
Path
(
hir
::
QPath
::
Resolved
(
_
,
ref
path
))
=
expr
.node
{
if
let
Some
(
segment
)
=
path
.segments
.last
()
{
report_function!
(
expr
.span
,
segment
.ident
);
}
...
...
src/librustc_typeck/check/op.rs
浏览文件 @
19730cc9
...
...
@@ -363,10 +363,13 @@ fn check_overloaded_binop(&self,
hir
::
BinOpKind
::
BitOr
=>
Some
(
"std::ops::BitOr"
),
hir
::
BinOpKind
::
Shl
=>
Some
(
"std::ops::Shl"
),
hir
::
BinOpKind
::
Shr
=>
Some
(
"std::ops::Shr"
),
hir
::
BinOpKind
::
Eq
|
hir
::
BinOpKind
::
Ne
=>
Some
(
"std::cmp::PartialEq"
),
hir
::
BinOpKind
::
Lt
|
hir
::
BinOpKind
::
Le
|
hir
::
BinOpKind
::
Gt
|
hir
::
BinOpKind
::
Ge
=>
Some
(
"std::cmp::PartialOrd"
),
_
=>
None
hir
::
BinOpKind
::
Eq
|
hir
::
BinOpKind
::
Ne
=>
Some
(
"std::cmp::PartialEq"
),
hir
::
BinOpKind
::
Lt
|
hir
::
BinOpKind
::
Le
|
hir
::
BinOpKind
::
Gt
|
hir
::
BinOpKind
::
Ge
=>
Some
(
"std::cmp::PartialOrd"
),
_
=>
None
};
if
let
Some
(
missing_trait
)
=
missing_trait
{
if
op
.node
==
hir
::
BinOpKind
::
Add
&&
...
...
src/librustc_typeck/check/writeback.rs
浏览文件 @
19730cc9
...
...
@@ -117,7 +117,8 @@ fn write_ty_to_tables(&mut self, hir_id: hir::HirId, ty: Ty<'gcx>) {
// operating on scalars, we clear the overload.
fn
fix_scalar_builtin_expr
(
&
mut
self
,
e
:
&
hir
::
Expr
)
{
match
e
.node
{
hir
::
ExprKind
::
Unary
(
hir
::
UnNeg
,
ref
inner
)
|
hir
::
ExprKind
::
Unary
(
hir
::
UnNot
,
ref
inner
)
=>
{
hir
::
ExprKind
::
Unary
(
hir
::
UnNeg
,
ref
inner
)
|
hir
::
ExprKind
::
Unary
(
hir
::
UnNot
,
ref
inner
)
=>
{
let
inner_ty
=
self
.fcx
.node_ty
(
inner
.hir_id
);
let
inner_ty
=
self
.fcx
.resolve_type_vars_if_possible
(
&
inner_ty
);
...
...
src/librustc_typeck/collect.rs
浏览文件 @
19730cc9
...
...
@@ -420,7 +420,10 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) {
}
},
hir
::
ItemKind
::
Existential
(
..
)
=>
{}
hir
::
ItemKind
::
Ty
(
..
)
|
hir
::
ItemKind
::
Static
(
..
)
|
hir
::
ItemKind
::
Const
(
..
)
|
hir
::
ItemKind
::
Fn
(
..
)
=>
{
hir
::
ItemKind
::
Ty
(
..
)
|
hir
::
ItemKind
::
Static
(
..
)
|
hir
::
ItemKind
::
Const
(
..
)
|
hir
::
ItemKind
::
Fn
(
..
)
=>
{
tcx
.generics_of
(
def_id
);
tcx
.type_of
(
def_id
);
tcx
.predicates_of
(
def_id
);
...
...
@@ -840,7 +843,8 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
generics
}
ItemKind
::
Trait
(
_
,
_
,
ref
generics
,
..
)
|
ItemKind
::
TraitAlias
(
ref
generics
,
..
)
=>
{
ItemKind
::
Trait
(
_
,
_
,
ref
generics
,
..
)
|
ItemKind
::
TraitAlias
(
ref
generics
,
..
)
=>
{
// Add in the self type parameter.
//
// Something of a hack: use the node id for the trait, also as
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录