Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
e3afba5b
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,发现更多精彩内容 >>
提交
e3afba5b
编写于
10月 15, 2017
作者:
I
Igor Matuszewski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Emit crate disambiguators in save-analysis data
上级
f7b080b3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
13 deletion
+15
-13
src/librustc_save_analysis/Cargo.toml
src/librustc_save_analysis/Cargo.toml
+1
-1
src/librustc_save_analysis/dump_visitor.rs
src/librustc_save_analysis/dump_visitor.rs
+6
-3
src/librustc_save_analysis/lib.rs
src/librustc_save_analysis/lib.rs
+8
-9
未找到文件。
src/librustc_save_analysis/Cargo.toml
浏览文件 @
e3afba5b
...
@@ -15,7 +15,7 @@ rustc_data_structures = { path = "../librustc_data_structures" }
...
@@ -15,7 +15,7 @@ rustc_data_structures = { path = "../librustc_data_structures" }
rustc_typeck
=
{
path
=
"../librustc_typeck"
}
rustc_typeck
=
{
path
=
"../librustc_typeck"
}
syntax
=
{
path
=
"../libsyntax"
}
syntax
=
{
path
=
"../libsyntax"
}
syntax_pos
=
{
path
=
"../libsyntax_pos"
}
syntax_pos
=
{
path
=
"../libsyntax_pos"
}
rls-data
=
"0.11"
rls-data
=
{
git
=
"https://github.com/Xanewok/rls-data"
,
branch
=
"crate-source"
}
rls-span
=
"0.4"
rls-span
=
"0.4"
# FIXME(#40527) should move rustc serialize out of tree
# FIXME(#40527) should move rustc serialize out of tree
rustc-serialize
=
"0.3"
rustc-serialize
=
"0.3"
src/librustc_save_analysis/dump_visitor.rs
浏览文件 @
e3afba5b
...
@@ -46,8 +46,8 @@
...
@@ -46,8 +46,8 @@
use
span_utils
::
SpanUtils
;
use
span_utils
::
SpanUtils
;
use
sig
;
use
sig
;
use
rls_data
::{
CratePreludeData
,
Import
,
ImportKind
,
SpanData
,
Ref
,
RefKind
,
use
rls_data
::{
CratePreludeData
,
GlobalCrateId
,
Import
,
ImportKind
,
SpanData
,
Def
,
DefKind
,
Relation
,
RelationKind
};
Ref
,
RefKind
,
Def
,
DefKind
,
Relation
,
RelationKind
};
macro_rules!
down_cast_data
{
macro_rules!
down_cast_data
{
(
$id:ident
,
$kind:ident
,
$sp:expr
)
=>
{
(
$id:ident
,
$kind:ident
,
$sp:expr
)
=>
{
...
@@ -131,7 +131,10 @@ pub fn dump_crate_info(&mut self, name: &str, krate: &ast::Crate) {
...
@@ -131,7 +131,10 @@ pub fn dump_crate_info(&mut self, name: &str, krate: &ast::Crate) {
});
});
let
data
=
CratePreludeData
{
let
data
=
CratePreludeData
{
crate_name
:
name
.into
(),
crate_id
:
GlobalCrateId
{
name
:
name
.into
(),
disambiguator
:
self
.tcx.sess
.local_crate_disambiguator
()
.to_string
(),
},
crate_root
:
crate_root
.unwrap_or
(
"<no source>"
.to_owned
()),
crate_root
:
crate_root
.unwrap_or
(
"<no source>"
.to_owned
()),
external_crates
:
self
.save_ctxt
.get_external_crates
(),
external_crates
:
self
.save_ctxt
.get_external_crates
(),
span
:
self
.span_from_span
(
krate
.span
),
span
:
self
.span_from_span
(
krate
.span
),
...
...
src/librustc_save_analysis/lib.rs
浏览文件 @
e3afba5b
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
use
span_utils
::
SpanUtils
;
use
span_utils
::
SpanUtils
;
use
rls_data
::{
Ref
,
RefKind
,
SpanData
,
MacroRef
,
Def
,
DefKind
,
Relation
,
RelationKind
,
use
rls_data
::{
Ref
,
RefKind
,
SpanData
,
MacroRef
,
Def
,
DefKind
,
Relation
,
RelationKind
,
ExternalCrateData
};
ExternalCrateData
,
GlobalCrateId
};
use
rls_data
::
config
::
Config
;
use
rls_data
::
config
::
Config
;
...
@@ -82,10 +82,6 @@ pub enum Data {
...
@@ -82,10 +82,6 @@ pub enum Data {
RelationData
(
Relation
),
RelationData
(
Relation
),
}
}
macro_rules!
option_try
(
(
$e:expr
)
=>
(
match
$e
{
Some
(
e
)
=>
e
,
None
=>
return
None
})
);
impl
<
'l
,
'tcx
:
'l
>
SaveContext
<
'l
,
'tcx
>
{
impl
<
'l
,
'tcx
:
'l
>
SaveContext
<
'l
,
'tcx
>
{
fn
span_from_span
(
&
self
,
span
:
Span
)
->
SpanData
{
fn
span_from_span
(
&
self
,
span
:
Span
)
->
SpanData
{
use
rls_span
::{
Row
,
Column
};
use
rls_span
::{
Row
,
Column
};
...
@@ -119,9 +115,12 @@ pub fn get_external_crates(&self) -> Vec<ExternalCrateData> {
...
@@ -119,9 +115,12 @@ pub fn get_external_crates(&self) -> Vec<ExternalCrateData> {
};
};
let
lo_loc
=
self
.span_utils.sess
.codemap
()
.lookup_char_pos
(
span
.lo
());
let
lo_loc
=
self
.span_utils.sess
.codemap
()
.lookup_char_pos
(
span
.lo
());
result
.push
(
ExternalCrateData
{
result
.push
(
ExternalCrateData
{
name
:
self
.tcx
.crate_name
(
n
)
.to_string
(),
num
:
n
.as_u32
(),
file_name
:
SpanUtils
::
make_path_string
(
&
lo_loc
.file.name
),
file_name
:
SpanUtils
::
make_path_string
(
&
lo_loc
.file.name
),
num
:
n
.as_u32
(),
id
:
GlobalCrateId
{
name
:
self
.tcx
.crate_name
(
n
)
.to_string
(),
disambiguator
:
self
.tcx
.crate_disambiguator
(
n
)
.to_string
(),
},
});
});
}
}
...
@@ -725,8 +724,8 @@ pub fn get_macro_use_data(&self, span: Span) -> Option<MacroRef> {
...
@@ -725,8 +724,8 @@ pub fn get_macro_use_data(&self, span: Span) -> Option<MacroRef> {
// macro uses.
// macro uses.
let
callsite
=
span
.source_callsite
();
let
callsite
=
span
.source_callsite
();
let
callsite_span
=
self
.span_from_span
(
callsite
);
let
callsite_span
=
self
.span_from_span
(
callsite
);
let
callee
=
option_try!
(
span
.source_callee
())
;
let
callee
=
span
.source_callee
()
?
;
let
callee_span
=
option_try!
(
callee
.span
)
;
let
callee_span
=
callee
.span
?
;
// Ignore attribute macros, their spans are usually mangled
// Ignore attribute macros, their spans are usually mangled
if
let
MacroAttribute
(
_
)
=
callee
.format
{
if
let
MacroAttribute
(
_
)
=
callee
.format
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录