Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
63553547
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,发现更多精彩内容 >>
提交
63553547
编写于
2月 24, 2018
作者:
V
varkor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename ty::Generics::parameters to params
上级
de1c29c9
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
15 addition
and
15 deletion
+15
-15
src/librustc/ich/impls_ty.rs
src/librustc/ich/impls_ty.rs
+2
-2
src/librustc/ty/mod.rs
src/librustc/ty/mod.rs
+7
-7
src/librustc/ty/subst.rs
src/librustc/ty/subst.rs
+1
-1
src/librustc_typeck/check/method/mod.rs
src/librustc_typeck/check/method/mod.rs
+1
-1
src/librustc_typeck/check/method/probe.rs
src/librustc_typeck/check/method/probe.rs
+1
-1
src/librustc_typeck/collect.rs
src/librustc_typeck/collect.rs
+3
-3
未找到文件。
src/librustc/ich/impls_ty.rs
浏览文件 @
63553547
...
...
@@ -736,7 +736,7 @@ fn hash_stable<W: StableHasherResult>(&self,
let
ty
::
Generics
{
parent
,
ref
parent_count
,
ref
param
eter
s
,
ref
params
,
// Reverse map to each `TypeParameterDef`'s `index` field, from
// `def_id.index` (`def_id.krate` is the same as the item's).
...
...
@@ -747,7 +747,7 @@ fn hash_stable<W: StableHasherResult>(&self,
parent
.hash_stable
(
hcx
,
hasher
);
parent_count
.hash_stable
(
hcx
,
hasher
);
param
eter
s
.hash_stable
(
hcx
,
hasher
);
params
.hash_stable
(
hcx
,
hasher
);
has_self
.hash_stable
(
hcx
,
hasher
);
has_late_bound_regions
.hash_stable
(
hcx
,
hasher
);
}
...
...
src/librustc/ty/mod.rs
浏览文件 @
63553547
...
...
@@ -785,7 +785,7 @@ pub fn index(&self) -> u32 {
pub
struct
Generics
{
pub
parent
:
Option
<
DefId
>
,
pub
parent_count
:
usize
,
pub
param
eter
s
:
Vec
<
GenericParameterDef
>
,
pub
params
:
Vec
<
GenericParameterDef
>
,
/// Reverse map to each `TypeParameterDef`'s `index` field
pub
type_param_to_index
:
FxHashMap
<
DefId
,
u32
>
,
...
...
@@ -796,7 +796,7 @@ pub struct Generics {
impl
<
'a
,
'gcx
,
'tcx
>
Generics
{
pub
fn
own_count
(
&
self
)
->
usize
{
self
.param
eter
s
.len
()
self
.params
.len
()
}
pub
fn
count
(
&
self
)
->
usize
{
...
...
@@ -804,7 +804,7 @@ pub fn count(&self) -> usize {
}
pub
fn
lifetimes
(
&
self
)
->
Vec
<&
RegionParameterDef
>
{
self
.param
eter
s
.iter
()
.filter_map
(|
p
|
{
self
.params
.iter
()
.filter_map
(|
p
|
{
if
let
GenericParameterDef
::
Lifetime
(
lt
)
=
p
{
Some
(
lt
)
}
else
{
...
...
@@ -814,7 +814,7 @@ pub fn lifetimes(&self) -> Vec<&RegionParameterDef> {
}
pub
fn
types
(
&
self
)
->
Vec
<&
TypeParameterDef
>
{
self
.param
eter
s
.iter
()
.filter_map
(|
p
|
{
self
.params
.iter
()
.filter_map
(|
p
|
{
if
let
GenericParameterDef
::
Type
(
ty
)
=
p
{
Some
(
ty
)
}
else
{
...
...
@@ -842,7 +842,7 @@ pub fn region_param(&'tcx self,
{
if
let
Some
(
index
)
=
param
.index
.checked_sub
(
self
.parent_count
as
u32
)
{
// We're currently assuming that lifetimes precede other generic parameters.
match
self
.param
eter
s
[
index
as
usize
-
self
.has_self
as
usize
]
{
match
self
.params
[
index
as
usize
-
self
.has_self
as
usize
]
{
ty
::
GenericParameterDef
::
Lifetime
(
ref
lt
)
=>
lt
,
_
=>
bug!
(
"expected region parameter, but found another generic parameter"
)
}
...
...
@@ -892,13 +892,13 @@ pub fn type_param(&'tcx self,
if
let
Some
(
_
)
=
(
idx
as
usize
)
.checked_sub
(
type_param_offset
)
{
assert
!
(
!
is_separated_self
,
"found a Self after type_param_offset"
);
match
self
.param
eter
s
[
idx
as
usize
]
{
match
self
.params
[
idx
as
usize
]
{
ty
::
GenericParameterDef
::
Type
(
ref
ty
)
=>
ty
,
_
=>
bug!
(
"expected type parameter, but found another generic parameter"
)
}
}
else
{
assert
!
(
is_separated_self
,
"non-Self param before type_param_offset"
);
match
self
.param
eter
s
[
type_param_offset
]
{
match
self
.params
[
type_param_offset
]
{
ty
::
GenericParameterDef
::
Type
(
ref
ty
)
=>
ty
,
_
=>
bug!
(
"expected type parameter, but found another generic parameter"
)
}
...
...
src/librustc/ty/subst.rs
浏览文件 @
63553547
...
...
@@ -252,7 +252,7 @@ fn fill_single<FR, FT>(substs: &mut Vec<Kind<'tcx>>,
substs
.push
(
ty
.into
());
}
for
def
in
&
defs
.param
eter
s
{
for
def
in
&
defs
.params
{
let
param
=
match
def
{
ty
::
GenericParameterDef
::
Lifetime
(
ref
lt
)
=>
{
UnpackedKind
::
Lifetime
(
mk_region
(
lt
,
substs
))
...
...
src/librustc_typeck/check/method/mod.rs
浏览文件 @
63553547
...
...
@@ -288,7 +288,7 @@ pub fn lookup_method_in_trait(&self,
let
method_item
=
self
.associated_item
(
trait_def_id
,
m_name
,
Namespace
::
Value
)
.unwrap
();
let
def_id
=
method_item
.def_id
;
let
generics
=
tcx
.generics_of
(
def_id
);
assert_eq!
(
generics
.param
eter
s
.len
(),
0
);
assert_eq!
(
generics
.params
.len
(),
0
);
debug!
(
"lookup_in_trait_adjusted: method_item={:?}"
,
method_item
);
let
mut
obligations
=
vec!
[];
...
...
src/librustc_typeck/check/method/probe.rs
浏览文件 @
63553547
...
...
@@ -1384,7 +1384,7 @@ fn xform_method_sig(&self,
// in the values from the substitution.
let
xform_fn_sig
=
self
.erase_late_bound_regions
(
&
fn_sig
);
if
generics
.param
eter
s
.is_empty
()
{
if
generics
.params
.is_empty
()
{
xform_fn_sig
.subst
(
self
.tcx
,
substs
)
}
else
{
let
substs
=
Substs
::
for_item
(
self
.tcx
,
method
,
|
def
,
_
|
{
...
...
src/librustc_typeck/collect.rs
浏览文件 @
63553547
...
...
@@ -881,7 +881,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
assert_eq!
(
has_self
,
false
);
parent_has_self
=
generics
.has_self
;
own_start
=
generics
.count
()
as
u32
;
generics
.parent_count
+
generics
.param
eter
s
.len
()
generics
.parent_count
+
generics
.params
.len
()
});
let
early_lifetimes
=
early_bound_lifetimes_from_generics
(
tcx
,
ast_generics
);
...
...
@@ -974,12 +974,12 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
regions
.into_iter
()
.map
(|
lt
|
ty
::
GenericParameterDef
::
Lifetime
(
lt
))
.collect
();
let
types
:
Vec
<
ty
::
GenericParameterDef
>
=
types
.into_iter
()
.map
(|
ty
|
ty
::
GenericParameterDef
::
Type
(
ty
))
.collect
();
let
param
eter
s
=
lifetimes
.into_iter
()
.chain
(
types
.into_iter
())
.collect
();
let
params
=
lifetimes
.into_iter
()
.chain
(
types
.into_iter
())
.collect
();
tcx
.alloc_generics
(
ty
::
Generics
{
parent
:
parent_def_id
,
parent_count
,
param
eter
s
,
params
,
type_param_to_index
,
has_self
:
has_self
||
parent_has_self
,
has_late_bound_regions
:
has_late_bound_regions
(
tcx
,
node
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录