Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
4d81e8bb
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,发现更多精彩内容 >>
提交
4d81e8bb
编写于
7月 18, 2017
作者:
N
Nick Cameron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use Config::full_docs to trim documentation
上级
84d93a4e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
44 addition
and
38 deletion
+44
-38
src/librustc_save_analysis/dump_visitor.rs
src/librustc_save_analysis/dump_visitor.rs
+9
-9
src/librustc_save_analysis/lib.rs
src/librustc_save_analysis/lib.rs
+35
-29
未找到文件。
src/librustc_save_analysis/dump_visitor.rs
浏览文件 @
4d81e8bb
...
...
@@ -41,7 +41,7 @@
use
syntax
::
codemap
::
Spanned
;
use
syntax_pos
::
*
;
use
{
escape
,
generated_code
,
SaveContext
,
PathCollector
,
docs_for_attrs
,
lower_attributes
,
Dump
};
use
{
escape
,
generated_code
,
SaveContext
,
PathCollector
,
lower_attributes
,
Dump
};
use
span_utils
::
SpanUtils
;
use
sig
;
...
...
@@ -531,7 +531,7 @@ fn process_assoc_const(&mut self,
parent
:
Some
(::
id_from_def_id
(
parent_id
)),
children
:
vec!
[],
decl_id
:
None
,
docs
:
docs_for_attrs
(
attrs
),
docs
:
self
.save_ctxt
.
docs_for_attrs
(
attrs
),
sig
,
attributes
:
lower_attributes
(
attrs
.to_owned
(),
&
self
.save_ctxt
),
});
...
...
@@ -580,7 +580,7 @@ fn process_struct(&mut self,
parent
:
None
,
children
:
fields
,
decl_id
:
None
,
docs
:
docs_for_attrs
(
&
item
.attrs
),
docs
:
self
.save_ctxt
.
docs_for_attrs
(
&
item
.attrs
),
sig
:
sig
::
item_signature
(
item
,
&
self
.save_ctxt
),
attributes
:
lower_attributes
(
item
.attrs
.clone
(),
&
self
.save_ctxt
),
});
...
...
@@ -637,7 +637,7 @@ fn process_enum(&mut self,
parent
,
children
:
vec!
[],
decl_id
:
None
,
docs
:
docs_for_attrs
(
&
variant
.node.attrs
),
docs
:
self
.save_ctxt
.
docs_for_attrs
(
&
variant
.node.attrs
),
sig
:
sig
::
variant_signature
(
variant
,
&
self
.save_ctxt
),
attributes
:
lower_attributes
(
variant
.node.attrs
.clone
(),
&
self
.save_ctxt
),
...
...
@@ -671,7 +671,7 @@ fn process_enum(&mut self,
parent
,
children
:
vec!
[],
decl_id
:
None
,
docs
:
docs_for_attrs
(
&
variant
.node.attrs
),
docs
:
self
.save_ctxt
.
docs_for_attrs
(
&
variant
.node.attrs
),
sig
:
sig
::
variant_signature
(
variant
,
&
self
.save_ctxt
),
attributes
:
lower_attributes
(
variant
.node.attrs
.clone
(),
&
self
.save_ctxt
),
...
...
@@ -742,7 +742,7 @@ fn process_trait(&mut self,
parent
:
None
,
children
,
decl_id
:
None
,
docs
:
docs_for_attrs
(
&
item
.attrs
),
docs
:
self
.save_ctxt
.
docs_for_attrs
(
&
item
.attrs
),
sig
:
sig
::
item_signature
(
item
,
&
self
.save_ctxt
),
attributes
:
lower_attributes
(
item
.attrs
.clone
(),
&
self
.save_ctxt
),
});
...
...
@@ -1039,7 +1039,7 @@ fn process_trait_item(&mut self, trait_item: &'l ast::TraitItem, trait_id: DefId
parent
:
Some
(::
id_from_def_id
(
trait_id
)),
children
:
vec!
[],
decl_id
:
None
,
docs
:
docs_for_attrs
(
&
trait_item
.attrs
),
docs
:
self
.save_ctxt
.
docs_for_attrs
(
&
trait_item
.attrs
),
sig
:
sig
::
assoc_type_signature
(
trait_item
.id
,
trait_item
.ident
,
Some
(
bounds
),
...
...
@@ -1113,7 +1113,7 @@ fn visit_mod(&mut self, m: &'l ast::Mod, span: Span, attrs: &[ast::Attribute], i
children
,
parent
:
None
,
decl_id
:
None
,
docs
:
docs_for_attrs
(
attrs
),
docs
:
self
.save_ctxt
.
docs_for_attrs
(
attrs
),
sig
:
None
,
attributes
:
lower_attributes
(
attrs
.to_owned
(),
&
self
.save_ctxt
),
});
...
...
@@ -1250,7 +1250,7 @@ fn visit_item(&mut self, item: &'l ast::Item) {
parent
:
None
,
children
:
vec!
[],
decl_id
:
None
,
docs
:
docs_for_attrs
(
&
item
.attrs
),
docs
:
self
.save_ctxt
.
docs_for_attrs
(
&
item
.attrs
),
sig
:
sig
::
item_signature
(
item
,
&
self
.save_ctxt
),
attributes
:
lower_attributes
(
item
.attrs
.clone
(),
&
self
.save_ctxt
),
});
...
...
src/librustc_save_analysis/lib.rs
浏览文件 @
4d81e8bb
...
...
@@ -160,7 +160,7 @@ pub fn get_extern_item_data(&self, item: &ast::ForeignItem) -> Option<Data> {
parent
:
None
,
children
:
vec!
[],
decl_id
:
None
,
docs
:
docs_for_attrs
(
&
item
.attrs
),
docs
:
self
.
docs_for_attrs
(
&
item
.attrs
),
sig
:
sig
::
foreign_item_signature
(
item
,
self
),
attributes
:
lower_attributes
(
item
.attrs
.clone
(),
self
),
}))
...
...
@@ -183,7 +183,7 @@ pub fn get_extern_item_data(&self, item: &ast::ForeignItem) -> Option<Data> {
parent
:
None
,
children
:
vec!
[],
decl_id
:
None
,
docs
:
docs_for_attrs
(
&
item
.attrs
),
docs
:
self
.
docs_for_attrs
(
&
item
.attrs
),
sig
:
sig
::
foreign_item_signature
(
item
,
self
),
attributes
:
lower_attributes
(
item
.attrs
.clone
(),
self
),
}))
...
...
@@ -207,7 +207,7 @@ pub fn get_item_data(&self, item: &ast::Item) -> Option<Data> {
parent
:
None
,
children
:
vec!
[],
decl_id
:
None
,
docs
:
docs_for_attrs
(
&
item
.attrs
),
docs
:
self
.
docs_for_attrs
(
&
item
.attrs
),
sig
:
sig
::
item_signature
(
item
,
self
),
attributes
:
lower_attributes
(
item
.attrs
.clone
(),
self
),
}))
...
...
@@ -236,7 +236,7 @@ pub fn get_item_data(&self, item: &ast::Item) -> Option<Data> {
parent
:
None
,
children
:
vec!
[],
decl_id
:
None
,
docs
:
docs_for_attrs
(
&
item
.attrs
),
docs
:
self
.
docs_for_attrs
(
&
item
.attrs
),
sig
:
sig
::
item_signature
(
item
,
self
),
attributes
:
lower_attributes
(
item
.attrs
.clone
(),
self
),
}))
...
...
@@ -259,7 +259,7 @@ pub fn get_item_data(&self, item: &ast::Item) -> Option<Data> {
parent
:
None
,
children
:
vec!
[],
decl_id
:
None
,
docs
:
docs_for_attrs
(
&
item
.attrs
),
docs
:
self
.
docs_for_attrs
(
&
item
.attrs
),
sig
:
sig
::
item_signature
(
item
,
self
),
attributes
:
lower_attributes
(
item
.attrs
.clone
(),
self
),
}))
...
...
@@ -283,7 +283,7 @@ pub fn get_item_data(&self, item: &ast::Item) -> Option<Data> {
parent
:
None
,
children
:
m
.items
.iter
()
.map
(|
i
|
id_from_node_id
(
i
.id
,
self
))
.collect
(),
decl_id
:
None
,
docs
:
docs_for_attrs
(
&
item
.attrs
),
docs
:
self
.
docs_for_attrs
(
&
item
.attrs
),
sig
:
sig
::
item_signature
(
item
,
self
),
attributes
:
lower_attributes
(
item
.attrs
.clone
(),
self
),
}))
...
...
@@ -311,7 +311,7 @@ pub fn get_item_data(&self, item: &ast::Item) -> Option<Data> {
.map
(|
v
|
id_from_node_id
(
v
.node.data
.id
(),
self
))
.collect
(),
decl_id
:
None
,
docs
:
docs_for_attrs
(
&
item
.attrs
),
docs
:
self
.
docs_for_attrs
(
&
item
.attrs
),
sig
:
sig
::
item_signature
(
item
,
self
),
attributes
:
lower_attributes
(
item
.attrs
.to_owned
(),
self
),
}))
...
...
@@ -372,7 +372,7 @@ pub fn get_field_data(&self,
parent
:
Some
(
id_from_node_id
(
scope
,
self
)),
children
:
vec!
[],
decl_id
:
None
,
docs
:
docs_for_attrs
(
&
field
.attrs
),
docs
:
self
.
docs_for_attrs
(
&
field
.attrs
),
sig
:
sig
::
field_signature
(
field
,
self
),
attributes
:
lower_attributes
(
field
.attrs
.clone
(),
self
),
})
...
...
@@ -417,7 +417,7 @@ pub fn get_method_data(&self,
result
.push_str
(
">"
);
(
result
,
trait_id
,
decl_id
,
docs_for_attrs
(
&
item
.attrs
),
self
.
docs_for_attrs
(
&
item
.attrs
),
item
.attrs
.to_vec
())
}
_
=>
{
...
...
@@ -442,7 +442,7 @@ pub fn get_method_data(&self,
Some
(
Node
::
NodeItem
(
item
))
=>
{
(
format!
(
"::{}"
,
self
.tcx
.item_path_str
(
def_id
)),
Some
(
def_id
),
None
,
docs_for_attrs
(
&
item
.attrs
),
self
.
docs_for_attrs
(
&
item
.attrs
),
item
.attrs
.to_vec
())
}
r
=>
{
...
...
@@ -771,6 +771,31 @@ fn lookup_ref_id(&self, ref_id: NodeId) -> Option<DefId> {
pub
fn
enclosing_scope
(
&
self
,
id
:
NodeId
)
->
NodeId
{
self
.tcx.hir
.get_enclosing_scope
(
id
)
.unwrap_or
(
CRATE_NODE_ID
)
}
fn
docs_for_attrs
(
&
self
,
attrs
:
&
[
Attribute
])
->
String
{
let
mut
result
=
String
::
new
();
for
attr
in
attrs
{
if
attr
.check_name
(
"doc"
)
{
if
let
Some
(
val
)
=
attr
.value_str
()
{
if
attr
.is_sugared_doc
{
result
.push_str
(
&
strip_doc_comment_decoration
(
&
val
.as_str
()));
}
else
{
result
.push_str
(
&
val
.as_str
());
}
result
.push
(
'\n'
);
}
}
}
if
!
self
.config.full_docs
{
if
let
Some
(
index
)
=
result
.find
(
"
\n\n
"
)
{
result
.truncate
(
index
);
}
}
result
}
}
fn
make_signature
(
decl
:
&
ast
::
FnDecl
,
generics
:
&
ast
::
Generics
)
->
String
{
...
...
@@ -847,25 +872,6 @@ fn visit_pat(&mut self, p: &ast::Pat) {
}
}
fn
docs_for_attrs
(
attrs
:
&
[
Attribute
])
->
String
{
let
mut
result
=
String
::
new
();
for
attr
in
attrs
{
if
attr
.check_name
(
"doc"
)
{
if
let
Some
(
val
)
=
attr
.value_str
()
{
if
attr
.is_sugared_doc
{
result
.push_str
(
&
strip_doc_comment_decoration
(
&
val
.as_str
()));
}
else
{
result
.push_str
(
&
val
.as_str
());
}
result
.push
(
'\n'
);
}
}
}
result
}
#[derive(Clone,
Copy,
Debug,
RustcEncodable)]
pub
enum
Format
{
Json
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录