Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
89c20b78
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,发现更多精彩内容 >>
提交
89c20b78
编写于
10月 17, 2018
作者:
L
ljedrz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
resolve: improve/remove allocations
上级
da40916b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
8 addition
and
19 deletion
+8
-19
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+5
-15
src/librustc_resolve/macros.rs
src/librustc_resolve/macros.rs
+3
-4
未找到文件。
src/librustc_resolve/lib.rs
浏览文件 @
89c20b78
...
...
@@ -3021,10 +3021,7 @@ fn smart_resolve_path_fragment(&mut self,
let
mut
err
=
this
.session
.struct_span_err_with_code
(
base_span
,
&
base_msg
,
code
);
// Emit help message for fake-self from other languages like `this`(javascript)
let
fake_self
:
Vec
<
Ident
>
=
[
"this"
,
"my"
]
.iter
()
.map
(
|
s
|
Ident
::
from_str
(
*
s
)
)
.collect
();
if
fake_self
.contains
(
&
item_str
)
if
[
"this"
,
"my"
]
.contains
(
&&*
item_str
.as_str
())
&&
this
.self_value_is_available
(
path
[
0
]
.span
,
span
)
{
err
.span_suggestion_with_applicability
(
span
,
...
...
@@ -4377,10 +4374,9 @@ fn lookup_import_candidates_from_module<FilterFn>(&mut self,
where
FilterFn
:
Fn
(
Def
)
->
bool
{
let
mut
candidates
=
Vec
::
new
();
let
mut
worklist
=
Vec
::
new
();
let
mut
seen_modules
=
FxHashSet
();
let
not_local_module
=
crate_name
!=
keywords
::
Crate
.ident
();
worklist
.push
((
start_module
,
Vec
::
<
ast
::
PathSegment
>
::
new
(),
not_local_module
))
;
let
mut
worklist
=
vec!
[(
start_module
,
Vec
::
<
ast
::
PathSegment
>
::
new
(),
not_local_module
)]
;
while
let
Some
((
in_module
,
path_segments
,
...
...
@@ -4467,13 +4463,8 @@ fn lookup_import_candidates<FilterFn>(&mut self,
->
Vec
<
ImportSuggestion
>
where
FilterFn
:
Fn
(
Def
)
->
bool
{
let
mut
suggestions
=
vec!
[];
suggestions
.extend
(
self
.lookup_import_candidates_from_module
(
lookup_name
,
namespace
,
self
.graph_root
,
keywords
::
Crate
.ident
(),
&
filter_fn
)
);
let
mut
suggestions
=
self
.lookup_import_candidates_from_module
(
lookup_name
,
namespace
,
self
.graph_root
,
keywords
::
Crate
.ident
(),
&
filter_fn
);
if
self
.session
.rust_2018
()
{
let
extern_prelude_names
=
self
.extern_prelude
.clone
();
...
...
@@ -4502,9 +4493,8 @@ fn find_module(&mut self,
->
Option
<
(
Module
<
'a
>
,
ImportSuggestion
)
>
{
let
mut
result
=
None
;
let
mut
worklist
=
Vec
::
new
();
let
mut
seen_modules
=
FxHashSet
();
worklist
.push
((
self
.graph_root
,
Vec
::
new
()))
;
let
mut
worklist
=
vec!
[(
self
.graph_root
,
Vec
::
new
())]
;
while
let
Some
((
in_module
,
path_segments
))
=
worklist
.pop
()
{
// abort if the module is already found
...
...
src/librustc_resolve/macros.rs
浏览文件 @
89c20b78
...
...
@@ -203,9 +203,7 @@ fn visit_ast_fragment_with_placeholders(&mut self, mark: Mark, fragment: &AstFra
self
.current_module
=
invocation
.module
.get
();
self
.current_module.unresolved_invocations
.borrow_mut
()
.remove
(
&
mark
);
self
.current_module.unresolved_invocations
.borrow_mut
()
.extend
(
derives
);
for
&
derive
in
derives
{
self
.invocations
.insert
(
derive
,
invocation
);
}
self
.invocations
.extend
(
derives
.iter
()
.map
(|
&
derive
|
(
derive
,
invocation
)));
let
mut
visitor
=
BuildReducedGraphVisitor
{
resolver
:
self
,
current_legacy_scope
:
invocation
.parent_legacy_scope
.get
(),
...
...
@@ -277,11 +275,12 @@ fn find_legacy_attr_invoc(&mut self, attrs: &mut Vec<ast::Attribute>, allow_deri
if
traits
.is_empty
()
{
attrs
.remove
(
i
);
}
else
{
let
mut
tokens
=
Vec
::
new
(
);
let
mut
tokens
=
Vec
::
with_capacity
(
traits
.len
()
-
1
);
for
(
j
,
path
)
in
traits
.iter
()
.enumerate
()
{
if
j
>
0
{
tokens
.push
(
TokenTree
::
Token
(
attrs
[
i
]
.span
,
Token
::
Comma
)
.into
());
}
tokens
.reserve
((
path
.segments
.len
()
*
2
)
.saturating_sub
(
1
));
for
(
k
,
segment
)
in
path
.segments
.iter
()
.enumerate
()
{
if
k
>
0
{
tokens
.push
(
TokenTree
::
Token
(
path
.span
,
Token
::
ModSep
)
.into
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录