Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
b79f7fbd
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
b79f7fbd
编写于
6月 19, 2020
作者:
B
Bastian Kauschke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rustdoc
上级
9852b42b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
31 deletion
+36
-31
src/librustdoc/clean/auto_trait.rs
src/librustdoc/clean/auto_trait.rs
+5
-5
src/librustdoc/clean/mod.rs
src/librustdoc/clean/mod.rs
+28
-20
src/librustdoc/clean/simplify.rs
src/librustdoc/clean/simplify.rs
+3
-6
未找到文件。
src/librustdoc/clean/auto_trait.rs
浏览文件 @
b79f7fbd
...
...
@@ -315,12 +315,12 @@ fn extract_for_generics(
tcx
:
TyCtxt
<
'tcx
>
,
pred
:
ty
::
Predicate
<
'tcx
>
,
)
->
FxHashSet
<
GenericParamDef
>
{
let
regions
=
match
pred
.kind
()
{
ty
::
PredicateKind
::
Trait
(
poly_trait_pred
,
_
)
=>
{
tcx
.collect_referenced_late_bound_regions
(
&
poly_trait_pred
)
let
regions
=
match
pred
.
ignore_qualifiers
()
.skip_binder
()
.
kind
()
{
&
ty
::
PredicateKind
::
Trait
(
poly_trait_pred
,
_
)
=>
{
tcx
.collect_referenced_late_bound_regions
(
&
ty
::
Binder
::
bind
(
poly_trait_pred
)
)
}
ty
::
PredicateKind
::
Projection
(
poly_proj_pred
)
=>
{
tcx
.collect_referenced_late_bound_regions
(
&
poly_proj_pred
)
&
ty
::
PredicateKind
::
Projection
(
poly_proj_pred
)
=>
{
tcx
.collect_referenced_late_bound_regions
(
&
ty
::
Binder
::
bind
(
poly_proj_pred
)
)
}
_
=>
return
FxHashSet
::
default
(),
};
...
...
src/librustdoc/clean/mod.rs
浏览文件 @
b79f7fbd
...
...
@@ -480,13 +480,14 @@ fn clean(&self, cx: &DocContext<'_>) -> WherePredicate {
impl
<
'a
>
Clean
<
Option
<
WherePredicate
>>
for
ty
::
Predicate
<
'a
>
{
fn
clean
(
&
self
,
cx
:
&
DocContext
<
'_
>
)
->
Option
<
WherePredicate
>
{
match
self
.kind
()
{
ty
::
PredicateKind
::
Trait
(
ref
pred
,
_
)
=>
Some
(
pred
.clean
(
cx
)),
ty
::
PredicateKind
::
Subtype
(
ref
pred
)
=>
Some
(
pred
.clean
(
cx
)),
ty
::
PredicateKind
::
RegionOutlives
(
ref
pred
)
=>
pred
.clean
(
cx
),
ty
::
PredicateKind
::
TypeOutlives
(
ref
pred
)
=>
pred
.clean
(
cx
),
ty
::
PredicateKind
::
Projection
(
ref
pred
)
=>
Some
(
pred
.clean
(
cx
)),
match
self
.ignore_qualifiers
()
.skip_binder
()
.kind
()
{
&
ty
::
PredicateKind
::
Trait
(
pred
,
_
)
=>
Some
(
ty
::
Binder
::
bind
(
pred
)
.clean
(
cx
)),
&
ty
::
PredicateKind
::
Subtype
(
pred
)
=>
Some
(
ty
::
Binder
::
bind
(
pred
)
.clean
(
cx
)),
&
ty
::
PredicateKind
::
RegionOutlives
(
pred
)
=>
ty
::
Binder
::
bind
(
pred
)
.clean
(
cx
),
&
ty
::
PredicateKind
::
TypeOutlives
(
pred
)
=>
ty
::
Binder
::
bind
(
pred
)
.clean
(
cx
),
&
ty
::
PredicateKind
::
Projection
(
pred
)
=>
Some
(
ty
::
Binder
::
bind
(
pred
)
.clean
(
cx
)),
ty
::
PredicateKind
::
ForAll
(
_
)
=>
panic!
(
"unexpected predicate: {:?}"
,
self
),
ty
::
PredicateKind
::
WellFormed
(
..
)
|
ty
::
PredicateKind
::
ObjectSafe
(
..
)
|
ty
::
PredicateKind
::
ClosureKind
(
..
)
...
...
@@ -754,19 +755,24 @@ fn clean(&self, cx: &DocContext<'_>) -> Generics {
.flat_map
(|(
p
,
_
)|
{
let
mut
projection
=
None
;
let
param_idx
=
(||
{
if
let
Some
(
trait_ref
)
=
p
.to_opt_poly_trait_ref
()
{
if
let
ty
::
Param
(
param
)
=
trait_ref
.skip_binder
()
.self_ty
()
.kind
{
return
Some
(
param
.index
);
match
p
.ignore_qualifiers
()
.skip_binder
()
.kind
()
{
&
ty
::
PredicateKind
::
Trait
(
pred
,
_
constness
)
=>
{
if
let
ty
::
Param
(
param
)
=
pred
.self_ty
()
.kind
{
return
Some
(
param
.index
);
}
}
}
else
if
let
Some
(
outlives
)
=
p
.to_opt_type_outlives
()
{
if
let
ty
::
Param
(
param
)
=
outlives
.skip_binder
()
.0
.kind
{
return
Some
(
param
.index
);
&
ty
::
PredicateKind
::
TypeOutlives
(
ty
::
OutlivesPredicate
(
ty
,
_
reg
))
=>
{
if
let
ty
::
Param
(
param
)
=
ty
.kind
{
return
Some
(
param
.index
);
}
}
}
else
if
let
ty
::
PredicateKind
::
Projection
(
p
)
=
p
.kind
()
{
if
let
ty
::
Param
(
param
)
=
p
.skip_binder
()
.projection_ty
.self_ty
()
.kind
{
projection
=
Some
(
p
);
return
Some
(
param
.index
);
&
ty
::
PredicateKind
::
Projection
(
p
)
=>
{
if
let
ty
::
Param
(
param
)
=
p
.projection_ty
.self_ty
()
.kind
{
projection
=
Some
(
ty
::
Binder
::
bind
(
p
));
return
Some
(
param
.index
);
}
}
_
=>
(),
}
None
...
...
@@ -1657,7 +1663,7 @@ fn clean(&self, cx: &DocContext<'_>) -> Type {
.filter_map
(|
predicate
|
{
let
trait_ref
=
if
let
Some
(
tr
)
=
predicate
.to_opt_poly_trait_ref
()
{
tr
}
else
if
let
ty
::
PredicateKind
::
TypeOutlives
(
pred
)
=
predicate
.kind
()
{
}
else
if
let
Some
(
pred
)
=
predicate
.to_opt_type_outlives
()
{
// these should turn up at the end
if
let
Some
(
r
)
=
pred
.skip_binder
()
.1
.clean
(
cx
)
{
regions
.push
(
GenericBound
::
Outlives
(
r
));
...
...
@@ -1678,8 +1684,10 @@ fn clean(&self, cx: &DocContext<'_>) -> Type {
.predicates
.iter
()
.filter_map
(|
pred
|
{
if
let
ty
::
PredicateKind
::
Projection
(
proj
)
=
pred
.kind
()
{
let
proj
=
proj
.skip_binder
();
if
let
ty
::
PredicateKind
::
Projection
(
proj
)
=
pred
.ignore_qualifiers
()
.skip_binder
()
.kind
()
{
let
proj
=
proj
;
if
proj
.projection_ty
.trait_ref
(
cx
.tcx
)
==
trait_ref
.skip_binder
()
{
...
...
src/librustdoc/clean/simplify.rs
浏览文件 @
b79f7fbd
...
...
@@ -141,12 +141,9 @@ fn trait_is_same_or_supertrait(cx: &DocContext<'_>, child: DefId, trait_: DefId)
.predicates
.iter
()
.filter_map
(|(
pred
,
_
)|
{
if
let
ty
::
PredicateKind
::
Trait
(
ref
pred
,
_
)
=
pred
.kind
()
{
if
pred
.skip_binder
()
.trait_ref
.self_ty
()
==
self_ty
{
Some
(
pred
.def_id
())
}
else
{
None
}
if
let
ty
::
PredicateKind
::
Trait
(
pred
,
_
)
=
pred
.ignore_qualifiers
()
.skip_binder
()
.kind
()
{
if
pred
.trait_ref
.self_ty
()
==
self_ty
{
Some
(
pred
.def_id
())
}
else
{
None
}
}
else
{
None
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录