Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
c6545485
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,发现更多精彩内容 >>
提交
c6545485
编写于
5月 26, 2018
作者:
V
varkor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove AngleBracketedArgs impl
上级
e1d888c7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
39 addition
and
40 deletion
+39
-40
src/librustc/hir/lowering.rs
src/librustc/hir/lowering.rs
+5
-1
src/librustc_driver/pretty.rs
src/librustc_driver/pretty.rs
+11
-5
src/librustc_passes/ast_validation.rs
src/librustc_passes/ast_validation.rs
+10
-7
src/librustc_save_analysis/dump_visitor.rs
src/librustc_save_analysis/dump_visitor.rs
+13
-5
src/libsyntax/ast.rs
src/libsyntax/ast.rs
+0
-22
未找到文件。
src/librustc/hir/lowering.rs
浏览文件 @
c6545485
...
...
@@ -1754,12 +1754,16 @@ fn lower_angle_bracketed_parameter_data(
itctx
:
ImplTraitContext
,
)
->
(
hir
::
GenericArgs
,
bool
)
{
let
&
AngleBracketedArgs
{
ref
args
,
ref
bindings
,
..
}
=
data
;
let
has_types
=
args
.iter
()
.any
(|
arg
|
match
arg
{
GenericArgAST
::
Type
(
_
)
=>
true
,
_
=>
false
,
});
(
hir
::
GenericArgs
{
args
:
args
.iter
()
.map
(|
a
|
self
.lower_generic_arg
(
a
,
itctx
))
.collect
(),
bindings
:
bindings
.iter
()
.map
(|
b
|
self
.lower_ty_binding
(
b
,
itctx
))
.collect
(),
parenthesized
:
false
,
},
data
.types
()
.count
()
==
0
&&
param_mode
==
ParamMode
::
Optional
)
has_types
&&
param_mode
==
ParamMode
::
Optional
)
}
fn
lower_parenthesized_parameter_data
(
...
...
src/librustc_driver/pretty.rs
浏览文件 @
c6545485
...
...
@@ -679,12 +679,18 @@ fn involves_impl_trait(ty: &ast::Ty) -> bool {
ast
::
TyKind
::
Path
(
_
,
ref
path
)
=>
path
.segments
.iter
()
.any
(|
seg
|
{
match
seg
.args
.as_ref
()
.map
(|
generic_arg
|
&**
generic_arg
)
{
None
=>
false
,
Some
(
&
ast
::
GenericArgs
::
AngleBracketed
(
ref
data
))
=>
any_involves_impl_trait
(
data
.types
()
.into_iter
())
||
any_involves_impl_trait
(
data
.bindings
.iter
()
.map
(|
b
|
&
b
.ty
)),
Some
(
&
ast
::
GenericArgs
::
Parenthesized
(
ref
data
))
=>
Some
(
&
ast
::
GenericArgs
::
AngleBracketed
(
ref
data
))
=>
{
let
types
=
data
.args
.iter
()
.filter_map
(|
arg
|
match
arg
{
ast
::
GenericArgAST
::
Type
(
ty
)
=>
Some
(
ty
),
_
=>
None
,
});
any_involves_impl_trait
(
types
.into_iter
())
||
any_involves_impl_trait
(
data
.bindings
.iter
()
.map
(|
b
|
&
b
.ty
))
},
Some
(
&
ast
::
GenericArgs
::
Parenthesized
(
ref
data
))
=>
{
any_involves_impl_trait
(
data
.inputs
.iter
())
||
any_involves_impl_trait
(
data
.output
.iter
()),
any_involves_impl_trait
(
data
.output
.iter
())
}
}
}),
_
=>
false
,
...
...
src/librustc_passes/ast_validation.rs
浏览文件 @
c6545485
...
...
@@ -515,21 +515,24 @@ fn visit_ty(&mut self, t: &'a Ty) {
}
fn
visit_generic_args
(
&
mut
self
,
_
:
Span
,
generic_args
:
&
'a
GenericArgs
)
{
match
*
generic_args
{
GenericArgs
::
AngleBracketed
(
ref
generic_args
)
=>
{
for
type_
in
generic_args
.types
()
{
self
.visit_ty
(
type_
);
GenericArgs
::
AngleBracketed
(
ref
data
)
=>
{
for
arg
in
&
data
.args
{
match
arg
{
GenericArgAST
::
Type
(
ty
)
=>
self
.visit_ty
(
ty
),
_
=>
{}
}
}
for
type_binding
in
&
generic_args
.bindings
{
for
type_binding
in
&
data
.bindings
{
// Type bindings such as `Item=impl Debug` in `Iterator<Item=Debug>`
// are allowed to contain nested `impl Trait`.
self
.with_impl_trait
(
None
,
|
this
|
visit
::
walk_ty
(
this
,
&
type_binding
.ty
));
}
}
GenericArgs
::
Parenthesized
(
ref
generic_args
)
=>
{
for
type_
in
&
generic_args
.inputs
{
GenericArgs
::
Parenthesized
(
ref
data
)
=>
{
for
type_
in
&
data
.inputs
{
self
.visit_ty
(
type_
);
}
if
let
Some
(
ref
type_
)
=
generic_args
.output
{
if
let
Some
(
ref
type_
)
=
data
.output
{
// `-> Foo` syntax is essentially an associated type binding,
// so it is also allowed to contain nested `impl Trait`.
self
.with_impl_trait
(
None
,
|
this
|
visit
::
walk_ty
(
this
,
type_
));
...
...
src/librustc_save_analysis/dump_visitor.rs
浏览文件 @
c6545485
...
...
@@ -825,9 +825,14 @@ fn process_path(&mut self, id: NodeId, path: &'l ast::Path) {
for
seg
in
&
path
.segments
{
if
let
Some
(
ref
generic_args
)
=
seg
.args
{
match
**
generic_args
{
ast
::
GenericArgs
::
AngleBracketed
(
ref
data
)
=>
for
t
in
data
.types
()
{
self
.visit_ty
(
t
);
},
ast
::
GenericArgs
::
AngleBracketed
(
ref
data
)
=>
{
for
arg
in
&
data
.args
{
match
arg
{
ast
::
GenericArgAST
::
Type
(
ty
)
=>
self
.visit_ty
(
ty
),
_
=>
{}
}
}
}
ast
::
GenericArgs
::
Parenthesized
(
ref
data
)
=>
{
for
t
in
&
data
.inputs
{
self
.visit_ty
(
t
);
...
...
@@ -910,8 +915,11 @@ fn process_method_call(
// Explicit types in the turbo-fish.
if
let
Some
(
ref
generic_args
)
=
seg
.args
{
if
let
ast
::
GenericArgs
::
AngleBracketed
(
ref
data
)
=
**
generic_args
{
for
t
in
data
.types
()
{
self
.visit_ty
(
t
);
for
arg
in
&
data
.args
{
match
arg
{
ast
::
GenericArgAST
::
Type
(
ty
)
=>
self
.visit_ty
(
ty
),
_
=>
{}
}
}
}
}
...
...
src/libsyntax/ast.rs
浏览文件 @
c6545485
...
...
@@ -178,28 +178,6 @@ pub struct AngleBracketedArgs {
pub
bindings
:
Vec
<
TypeBinding
>
,
}
impl
AngleBracketedArgs
{
pub
fn
lifetimes
(
&
self
)
->
impl
DoubleEndedIterator
<
Item
=
&
Lifetime
>
{
self
.args
.iter
()
.filter_map
(|
arg
|
{
if
let
GenericArgAST
::
Lifetime
(
lt
)
=
arg
{
Some
(
lt
)
}
else
{
None
}
})
}
pub
fn
types
(
&
self
)
->
impl
DoubleEndedIterator
<
Item
=
&
P
<
Ty
>>
{
self
.args
.iter
()
.filter_map
(|
arg
|
{
if
let
GenericArgAST
::
Type
(
ty
)
=
arg
{
Some
(
ty
)
}
else
{
None
}
})
}
}
impl
Into
<
Option
<
P
<
GenericArgs
>>>
for
AngleBracketedArgs
{
fn
into
(
self
)
->
Option
<
P
<
GenericArgs
>>
{
Some
(
P
(
GenericArgs
::
AngleBracketed
(
self
)))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录