Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
2a58fa06
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,发现更多精彩内容 >>
提交
2a58fa06
编写于
11月 22, 2020
作者:
J
Joshua Nelson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Get rid of doctree::Trait
上级
a3a5d2cd
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
15 addition
and
48 deletion
+15
-48
src/librustdoc/clean/mod.rs
src/librustdoc/clean/mod.rs
+14
-21
src/librustdoc/doctree.rs
src/librustdoc/doctree.rs
+0
-13
src/librustdoc/visit_ast.rs
src/librustdoc/visit_ast.rs
+1
-14
未找到文件。
src/librustdoc/clean/mod.rs
浏览文件 @
2a58fa06
...
...
@@ -234,7 +234,6 @@ fn clean(&self, cx: &DocContext<'_>) -> Item {
items
.extend
(
self
.foreigns
.iter
()
.map
(|
x
|
x
.clean
(
cx
)));
items
.extend
(
self
.mods
.iter
()
.map
(|
x
|
x
.clean
(
cx
)));
items
.extend
(
self
.items
.iter
()
.map
(|
x
|
x
.clean
(
cx
))
.flatten
());
items
.extend
(
self
.traits
.iter
()
.map
(|
x
|
x
.clean
(
cx
)));
items
.extend
(
self
.macros
.iter
()
.map
(|
x
|
x
.clean
(
cx
)));
// determine if we should display the inner contents or
...
...
@@ -1022,26 +1021,6 @@ fn clean(&self, cx: &DocContext<'_>) -> FnRetTy {
}
}
impl
Clean
<
Item
>
for
doctree
::
Trait
<
'_
>
{
fn
clean
(
&
self
,
cx
:
&
DocContext
<
'_
>
)
->
Item
{
let
attrs
=
self
.attrs
.clean
(
cx
);
let
is_spotlight
=
attrs
.has_doc_flag
(
sym
::
spotlight
);
Item
::
from_hir_id_and_parts
(
self
.id
,
Some
(
self
.name
),
TraitItem
(
Trait
{
unsafety
:
self
.unsafety
,
items
:
self
.items
.iter
()
.map
(|
ti
|
ti
.clean
(
cx
))
.collect
(),
generics
:
self
.generics
.clean
(
cx
),
bounds
:
self
.bounds
.clean
(
cx
),
is_spotlight
,
is_auto
:
self
.is_auto
.clean
(
cx
),
}),
cx
,
)
}
}
impl
Clean
<
bool
>
for
hir
::
IsAuto
{
fn
clean
(
&
self
,
_
:
&
DocContext
<
'_
>
)
->
bool
{
match
*
self
{
...
...
@@ -2011,6 +1990,20 @@ fn clean(&self, cx: &DocContext<'_>) -> Vec<Item> {
ItemKind
::
Fn
(
ref
sig
,
ref
generics
,
body_id
)
=>
{
clean_fn_or_proc_macro
(
item
,
sig
,
generics
,
body_id
,
&
mut
name
,
cx
)
}
hir
::
ItemKind
::
Trait
(
is_auto
,
unsafety
,
ref
generics
,
ref
bounds
,
ref
item_ids
)
=>
{
let
items
=
item_ids
.iter
()
.map
(|
ti
|
cx
.tcx
.hir
()
.trait_item
(
ti
.id
)
.clean
(
cx
))
.collect
();
let
attrs
=
item
.attrs
.clean
(
cx
);
let
is_spotlight
=
attrs
.has_doc_flag
(
sym
::
spotlight
);
TraitItem
(
Trait
{
unsafety
,
items
,
generics
:
generics
.clean
(
cx
),
bounds
:
bounds
.clean
(
cx
),
is_spotlight
,
is_auto
:
is_auto
.clean
(
cx
),
})
}
_
=>
unreachable!
(
"not yet converted"
),
};
...
...
src/librustdoc/doctree.rs
浏览文件 @
2a58fa06
...
...
@@ -20,7 +20,6 @@
crate
id
:
hir
::
HirId
,
// (item, renamed)
crate
items
:
Vec
<
(
&
'hir
hir
::
Item
<
'hir
>
,
Option
<
Ident
>
)
>
,
crate
traits
:
Vec
<
Trait
<
'hir
>>
,
crate
foreigns
:
Vec
<
(
&
'hir
hir
::
ForeignItem
<
'hir
>
,
Option
<
Ident
>
)
>
,
crate
macros
:
Vec
<
Macro
>
,
crate
is_crate
:
bool
,
...
...
@@ -38,7 +37,6 @@ impl Module<'hir> {
imports
:
Vec
::
new
(),
mods
:
Vec
::
new
(),
items
:
Vec
::
new
(),
traits
:
Vec
::
new
(),
foreigns
:
Vec
::
new
(),
macros
:
Vec
::
new
(),
is_crate
:
false
,
...
...
@@ -62,17 +60,6 @@ impl Module<'hir> {
crate
def
:
&
'hir
hir
::
VariantData
<
'hir
>
,
}
crate
struct
Trait
<
'hir
>
{
crate
is_auto
:
hir
::
IsAuto
,
crate
unsafety
:
hir
::
Unsafety
,
crate
name
:
Symbol
,
crate
items
:
Vec
<&
'hir
hir
::
TraitItem
<
'hir
>>
,
crate
generics
:
&
'hir
hir
::
Generics
<
'hir
>
,
crate
bounds
:
&
'hir
[
hir
::
GenericBound
<
'hir
>
],
crate
attrs
:
&
'hir
[
ast
::
Attribute
],
crate
id
:
hir
::
HirId
,
}
// For Macro we store the DefId instead of the NodeId, since we also create
// these imported macro_rules (which only have a DUMMY_NODE_ID).
crate
struct
Macro
{
...
...
src/librustdoc/visit_ast.rs
浏览文件 @
2a58fa06
...
...
@@ -319,6 +319,7 @@ fn visit_item(
|
hir
::
ItemKind
::
TyAlias
(
..
)
|
hir
::
ItemKind
::
OpaqueTy
(
..
)
|
hir
::
ItemKind
::
Static
(
..
)
|
hir
::
ItemKind
::
Trait
(
..
)
|
hir
::
ItemKind
::
TraitAlias
(
..
)
=>
om
.items
.push
((
item
,
renamed
)),
hir
::
ItemKind
::
Const
(
..
)
=>
{
// Underscore constants do not correspond to a nameable item and
...
...
@@ -327,20 +328,6 @@ fn visit_item(
om
.items
.push
((
item
,
renamed
));
}
}
hir
::
ItemKind
::
Trait
(
is_auto
,
unsafety
,
ref
generics
,
ref
bounds
,
ref
item_ids
)
=>
{
let
items
=
item_ids
.iter
()
.map
(|
ti
|
self
.cx.tcx
.hir
()
.trait_item
(
ti
.id
))
.collect
();
let
t
=
Trait
{
is_auto
,
unsafety
,
name
:
ident
.name
,
items
,
generics
,
bounds
,
id
:
item
.hir_id
,
attrs
:
&
item
.attrs
,
};
om
.traits
.push
(
t
);
}
hir
::
ItemKind
::
Impl
{
ref
of_trait
,
..
}
=>
{
// Don't duplicate impls when inlining or if it's implementing a trait, we'll pick
// them up regardless of where they're located.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录