Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
962e4514
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,发现更多精彩内容 >>
提交
962e4514
编写于
8月 28, 2021
作者:
N
Noah Lev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace all uses of `path.res.def_id()` with `path.def_id()`
上级
82b52e19
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
19 addition
and
19 deletion
+19
-19
src/librustdoc/clean/auto_trait.rs
src/librustdoc/clean/auto_trait.rs
+1
-1
src/librustdoc/clean/inline.rs
src/librustdoc/clean/inline.rs
+4
-4
src/librustdoc/clean/mod.rs
src/librustdoc/clean/mod.rs
+1
-1
src/librustdoc/clean/simplify.rs
src/librustdoc/clean/simplify.rs
+1
-1
src/librustdoc/clean/types.rs
src/librustdoc/clean/types.rs
+2
-2
src/librustdoc/html/format.rs
src/librustdoc/html/format.rs
+3
-3
src/librustdoc/html/render/cache.rs
src/librustdoc/html/render/cache.rs
+1
-1
src/librustdoc/html/render/mod.rs
src/librustdoc/html/render/mod.rs
+1
-1
src/librustdoc/json/conversions.rs
src/librustdoc/json/conversions.rs
+4
-4
src/librustdoc/passes/collect_trait_impls.rs
src/librustdoc/passes/collect_trait_impls.rs
+1
-1
未找到文件。
src/librustdoc/clean/auto_trait.rs
浏览文件 @
962e4514
...
...
@@ -691,7 +691,7 @@ fn unstable_debug_sort<T: Debug>(&self, vec: &mut Vec<T>) {
fn
is_fn_trait
(
&
self
,
path
:
&
Path
)
->
bool
{
let
tcx
=
self
.cx.tcx
;
let
did
=
path
.
res
.
def_id
();
let
did
=
path
.def_id
();
did
==
tcx
.require_lang_item
(
LangItem
::
Fn
,
None
)
||
did
==
tcx
.require_lang_item
(
LangItem
::
FnMut
,
None
)
||
did
==
tcx
.require_lang_item
(
LangItem
::
FnOnce
,
None
)
...
...
src/librustdoc/clean/inline.rs
浏览文件 @
962e4514
...
...
@@ -454,7 +454,7 @@ fn merge_attrs(
// Return if the trait itself or any types of the generic parameters are doc(hidden).
let
mut
stack
:
Vec
<&
Type
>
=
vec!
[
&
for_
];
if
let
Some
(
did
)
=
trait_
.as_ref
()
.map
(|
t
|
t
.
res
.
def_id
())
{
if
let
Some
(
did
)
=
trait_
.as_ref
()
.map
(|
t
|
t
.def_id
())
{
if
tcx
.get_attrs
(
did
)
.lists
(
sym
::
doc
)
.has_word
(
sym
::
hidden
)
{
return
;
}
...
...
@@ -474,7 +474,7 @@ fn merge_attrs(
}
}
if
let
Some
(
did
)
=
trait_
.as_ref
()
.map
(|
t
|
t
.
res
.
def_id
())
{
if
let
Some
(
did
)
=
trait_
.as_ref
()
.map
(|
t
|
t
.def_id
())
{
record_extern_trait
(
cx
,
did
);
}
...
...
@@ -628,7 +628,7 @@ fn filter_non_trait_generics(trait_did: DefId, mut g: clean::Generics) -> clean:
}
if
*
s
==
kw
::
SelfUpper
=>
{
bounds
.retain
(|
bound
|
match
bound
{
clean
::
GenericBound
::
TraitBound
(
clean
::
PolyTrait
{
trait_
,
..
},
_
)
=>
{
trait_
.
res
.
def_id
()
!=
trait_did
trait_
.def_id
()
!=
trait_did
}
_
=>
true
,
});
...
...
@@ -642,7 +642,7 @@ fn filter_non_trait_generics(trait_did: DefId, mut g: clean::Generics) -> clean:
ty
:
clean
::
QPath
{
self_type
:
box
clean
::
Generic
(
ref
s
),
trait_
,
name
:
_
,
..
},
bounds
,
..
}
=>
!
(
bounds
.is_empty
()
||
*
s
==
kw
::
SelfUpper
&&
trait_
.
res
.
def_id
()
==
trait_did
),
}
=>
!
(
bounds
.is_empty
()
||
*
s
==
kw
::
SelfUpper
&&
trait_
.def_id
()
==
trait_did
),
_
=>
true
,
});
g
...
...
src/librustdoc/clean/mod.rs
浏览文件 @
962e4514
...
...
@@ -1100,7 +1100,7 @@ fn clean(&self, cx: &mut DocContext<'_>) -> Item {
if
*
name
!=
my_name
{
return
None
;
}
if
trait_
.
res
.
def_id
()
!=
self
.container
.id
()
{
if
trait_
.def_id
()
!=
self
.container
.id
()
{
return
None
;
}
match
**
self_type
{
...
...
src/librustdoc/clean/simplify.rs
浏览文件 @
962e4514
...
...
@@ -102,7 +102,7 @@
// If this QPath's trait `trait_did` is the same as, or a supertrait
// of, the bound's trait `did` then we can keep going, otherwise
// this is just a plain old equality bound.
if
!
trait_is_same_or_supertrait
(
cx
,
trait_ref
.trait_.
res
.
def_id
(),
trait_did
)
{
if
!
trait_is_same_or_supertrait
(
cx
,
trait_ref
.trait_
.def_id
(),
trait_did
)
{
return
false
;
}
let
last
=
trait_ref
.trait_.segments
.last_mut
()
.expect
(
"segments were empty"
);
...
...
src/librustdoc/clean/types.rs
浏览文件 @
962e4514
...
...
@@ -1499,13 +1499,13 @@ impl Type {
QPath
{
self_type
,
trait_
,
name
,
..
}
=>
(
self_type
,
trait_
,
name
),
_
=>
return
None
,
};
Some
((
&
self_
,
trait_
.
res
.
def_id
(),
*
name
))
Some
((
&
self_
,
trait_
.def_id
(),
*
name
))
}
fn
inner_def_id
(
&
self
,
cache
:
Option
<&
Cache
>
)
->
Option
<
DefId
>
{
let
t
:
PrimitiveType
=
match
*
self
{
ResolvedPath
{
did
,
..
}
=>
return
Some
(
did
),
DynTrait
(
ref
bounds
,
_
)
=>
return
Some
(
bounds
[
0
]
.trait_.
res
.
def_id
()),
DynTrait
(
ref
bounds
,
_
)
=>
return
Some
(
bounds
[
0
]
.trait_
.def_id
()),
Primitive
(
p
)
=>
return
cache
.and_then
(|
c
|
c
.primitive_locations
.get
(
&
p
)
.cloned
()),
BorrowedRef
{
type_
:
box
Generic
(
..
),
..
}
=>
PrimitiveType
::
Reference
,
BorrowedRef
{
ref
type_
,
..
}
=>
return
type_
.inner_def_id
(
cache
),
...
...
src/librustdoc/html/format.rs
浏览文件 @
962e4514
...
...
@@ -914,7 +914,7 @@ fn fmt_type<'cx>(
clean
::
QPath
{
ref
name
,
ref
self_type
,
ref
trait_
,
ref
self_def_id
}
=>
{
let
should_show_cast
=
!
trait_
.segments
.is_empty
()
&&
self_def_id
.zip
(
Some
(
trait_
.
res
.
def_id
()))
.zip
(
Some
(
trait_
.def_id
()))
.map_or
(
!
self_type
.is_self_type
(),
|(
id
,
trait_
)|
id
!=
trait_
);
if
f
.alternate
()
{
if
should_show_cast
{
...
...
@@ -939,7 +939,7 @@ fn fmt_type<'cx>(
// the ugliness comes from inlining across crates where
// everything comes in as a fully resolved QPath (hard to
// look at).
match
href
(
trait_
.
res
.
def_id
(),
cx
)
{
match
href
(
trait_
.def_id
(),
cx
)
{
Ok
((
ref
url
,
_
,
ref
path
))
if
!
f
.alternate
()
=>
{
write!
(
f
,
...
...
@@ -972,7 +972,7 @@ impl clean::Path {
&
'a
self
,
cx
:
&
'a
Context
<
'tcx
>
,
)
->
impl
fmt
::
Display
+
'b
+
Captures
<
'tcx
>
{
display_fn
(
move
|
f
|
resolved_path
(
f
,
self
.
res
.
def_id
(),
self
,
false
,
false
,
cx
))
display_fn
(
move
|
f
|
resolved_path
(
f
,
self
.def_id
(),
self
,
false
,
false
,
cx
))
}
}
...
...
src/librustdoc/html/render/cache.rs
浏览文件 @
962e4514
...
...
@@ -322,7 +322,7 @@ fn insert(res: &mut FxHashSet<(Type, ItemType)>, tcx: TyCtxt<'_>, ty: Type) -> u
if
let
Some
(
bound
)
=
generics
.params
.iter
()
.find
(|
g
|
g
.is_type
()
&&
g
.name
==
arg_s
)
{
for
bound
in
bound
.get_bounds
()
.unwrap_or
(
&
[])
{
if
let
Some
(
path
)
=
bound
.get_trait_path
()
{
let
ty
=
Type
::
ResolvedPath
{
did
:
path
.
res
.
def_id
(),
path
};
let
ty
=
Type
::
ResolvedPath
{
did
:
path
.def_id
(),
path
};
let
adds
=
get_real_types
(
generics
,
&
ty
,
tcx
,
recurse
+
1
,
res
);
nb_added
+=
adds
;
if
adds
==
0
&&
!
ty
.is_full_generic
()
{
...
...
src/librustdoc/html/render/mod.rs
浏览文件 @
962e4514
...
...
@@ -2389,7 +2389,7 @@ fn collect_paths_for_type(first_ty: clean::Type, cache: &Cache) -> Vec<String> {
}
clean
::
Type
::
QPath
{
self_type
,
trait_
,
..
}
=>
{
work
.push_back
(
*
self_type
);
process_path
(
trait_
.
res
.
def_id
());
process_path
(
trait_
.def_id
());
}
_
=>
{}
}
...
...
src/librustdoc/json/conversions.rs
浏览文件 @
962e4514
...
...
@@ -365,7 +365,7 @@ fn from_tcx(bound: clean::GenericBound, tcx: TyCtxt<'_>) -> Self {
TraitBound
(
clean
::
PolyTrait
{
trait_
,
generic_params
},
modifier
)
=>
{
// FIXME: should `trait_` be a clean::Path equivalent in JSON?
let
trait_
=
clean
::
ResolvedPath
{
did
:
trait_
.
res
.
def_id
(),
path
:
trait_
}
.into_tcx
(
tcx
);
clean
::
ResolvedPath
{
did
:
trait_
.def_id
(),
path
:
trait_
}
.into_tcx
(
tcx
);
GenericBound
::
TraitBound
{
trait_
,
generic_params
:
generic_params
.into_iter
()
.map
(|
x
|
x
.into_tcx
(
tcx
))
.collect
(),
...
...
@@ -401,7 +401,7 @@ fn from_tcx(ty: clean::Type, tcx: TyCtxt<'_>) -> Self {
Type
::
ResolvedPath
{
name
:
first_trait
.whole_name
(),
id
:
from_item_id
(
first_trait
.
res
.
def_id
()
.into
()),
id
:
from_item_id
(
first_trait
.def_id
()
.into
()),
args
:
first_trait
.segments
.last
()
...
...
@@ -436,7 +436,7 @@ fn from_tcx(ty: clean::Type, tcx: TyCtxt<'_>) -> Self {
},
QPath
{
name
,
self_type
,
trait_
,
..
}
=>
{
// FIXME: should `trait_` be a clean::Path equivalent in JSON?
let
trait_
=
ResolvedPath
{
did
:
trait_
.
res
.
def_id
(),
path
:
trait_
}
.into_tcx
(
tcx
);
let
trait_
=
ResolvedPath
{
did
:
trait_
.def_id
(),
path
:
trait_
}
.into_tcx
(
tcx
);
Type
::
QualifiedPath
{
name
:
name
.to_string
(),
self_type
:
Box
::
new
((
*
self_type
)
.into_tcx
(
tcx
)),
...
...
@@ -513,7 +513,7 @@ fn from_tcx(impl_: clean::Impl, tcx: TyCtxt<'_>) -> Self {
}
=
impl_
;
// FIXME: should `trait_` be a clean::Path equivalent in JSON?
let
trait_
=
trait_
.map
(|
path
|
{
let
did
=
path
.
res
.
def_id
();
let
did
=
path
.def_id
();
clean
::
ResolvedPath
{
path
,
did
}
.into_tcx
(
tcx
)
});
Impl
{
...
...
src/librustdoc/passes/collect_trait_impls.rs
浏览文件 @
962e4514
...
...
@@ -82,7 +82,7 @@
cleaner
.keep_impl
(
for_
)
||
trait_
.as_ref
()
.map_or
(
false
,
|
t
|
cleaner
.keep_impl_with_def_id
(
t
.
res
.
def_id
()
.into
()))
.map_or
(
false
,
|
t
|
cleaner
.keep_impl_with_def_id
(
t
.def_id
()
.into
()))
||
blanket_impl
.is_some
()
}
else
{
true
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录