Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
e9e3d570
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,发现更多精彩内容 >>
提交
e9e3d570
编写于
2月 25, 2018
作者:
V
varkor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename ty::GenericParameterDef to GenericParam
上级
63553547
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
17 addition
and
17 deletion
+17
-17
src/librustc/ich/impls_ty.rs
src/librustc/ich/impls_ty.rs
+1
-1
src/librustc/ty/mod.rs
src/librustc/ty/mod.rs
+10
-10
src/librustc/ty/subst.rs
src/librustc/ty/subst.rs
+2
-2
src/librustc_typeck/collect.rs
src/librustc_typeck/collect.rs
+4
-4
未找到文件。
src/librustc/ich/impls_ty.rs
浏览文件 @
e9e3d570
...
...
@@ -753,7 +753,7 @@ fn hash_stable<W: StableHasherResult>(&self,
}
}
impl_stable_hash_for!
(
enum
ty
::
GenericParam
eterDef
{
impl_stable_hash_for!
(
enum
ty
::
GenericParam
{
Lifetime
(
lt
),
Type
(
ty
)
});
...
...
src/librustc/ty/mod.rs
浏览文件 @
e9e3d570
...
...
@@ -758,16 +758,16 @@ pub fn to_bound_region(&self) -> ty::BoundRegion {
}
#[derive(Clone,
Debug,
RustcEncodable,
RustcDecodable)]
pub
enum
GenericParam
eterDef
{
pub
enum
GenericParam
{
Lifetime
(
RegionParameterDef
),
Type
(
TypeParameterDef
),
}
impl
GenericParam
eterDef
{
impl
GenericParam
{
pub
fn
index
(
&
self
)
->
u32
{
match
self
{
GenericParam
eterDef
::
Lifetime
(
lt
)
=>
lt
.index
,
GenericParam
eterDef
::
Type
(
ty
)
=>
ty
.index
,
GenericParam
::
Lifetime
(
lt
)
=>
lt
.index
,
GenericParam
::
Type
(
ty
)
=>
ty
.index
,
}
}
}
...
...
@@ -785,7 +785,7 @@ pub fn index(&self) -> u32 {
pub
struct
Generics
{
pub
parent
:
Option
<
DefId
>
,
pub
parent_count
:
usize
,
pub
params
:
Vec
<
GenericParam
eterDef
>
,
pub
params
:
Vec
<
GenericParam
>
,
/// Reverse map to each `TypeParameterDef`'s `index` field
pub
type_param_to_index
:
FxHashMap
<
DefId
,
u32
>
,
...
...
@@ -805,7 +805,7 @@ pub fn count(&self) -> usize {
pub
fn
lifetimes
(
&
self
)
->
Vec
<&
RegionParameterDef
>
{
self
.params
.iter
()
.filter_map
(|
p
|
{
if
let
GenericParam
eterDef
::
Lifetime
(
lt
)
=
p
{
if
let
GenericParam
::
Lifetime
(
lt
)
=
p
{
Some
(
lt
)
}
else
{
None
...
...
@@ -815,7 +815,7 @@ pub fn lifetimes(&self) -> Vec<&RegionParameterDef> {
pub
fn
types
(
&
self
)
->
Vec
<&
TypeParameterDef
>
{
self
.params
.iter
()
.filter_map
(|
p
|
{
if
let
GenericParam
eterDef
::
Type
(
ty
)
=
p
{
if
let
GenericParam
::
Type
(
ty
)
=
p
{
Some
(
ty
)
}
else
{
None
...
...
@@ -843,7 +843,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
.params
[
index
as
usize
-
self
.has_self
as
usize
]
{
ty
::
GenericParam
eterDef
::
Lifetime
(
ref
lt
)
=>
lt
,
ty
::
GenericParam
::
Lifetime
(
ref
lt
)
=>
lt
,
_
=>
bug!
(
"expected region parameter, but found another generic parameter"
)
}
}
else
{
...
...
@@ -893,13 +893,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
.params
[
idx
as
usize
]
{
ty
::
GenericParam
eterDef
::
Type
(
ref
ty
)
=>
ty
,
ty
::
GenericParam
::
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
.params
[
type_param_offset
]
{
ty
::
GenericParam
eterDef
::
Type
(
ref
ty
)
=>
ty
,
ty
::
GenericParam
::
Type
(
ref
ty
)
=>
ty
,
_
=>
bug!
(
"expected type parameter, but found another generic parameter"
)
}
}
...
...
src/librustc/ty/subst.rs
浏览文件 @
e9e3d570
...
...
@@ -254,10 +254,10 @@ fn fill_single<FR, FT>(substs: &mut Vec<Kind<'tcx>>,
for
def
in
&
defs
.params
{
let
param
=
match
def
{
ty
::
GenericParam
eterDef
::
Lifetime
(
ref
lt
)
=>
{
ty
::
GenericParam
::
Lifetime
(
ref
lt
)
=>
{
UnpackedKind
::
Lifetime
(
mk_region
(
lt
,
substs
))
}
ty
::
GenericParam
eterDef
::
Type
(
ref
ty
)
=>
{
ty
::
GenericParam
::
Type
(
ref
ty
)
=>
{
if
skip_self
{
skip_self
=
false
;
continue
...
...
src/librustc_typeck/collect.rs
浏览文件 @
e9e3d570
...
...
@@ -970,10 +970,10 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
.map
(|
param
|
(
param
.def_id
,
param
.index
))
.collect
();
let
lifetimes
:
Vec
<
ty
::
GenericParam
eterDef
>
=
regions
.into_iter
()
.map
(|
lt
|
ty
::
GenericParam
eterDef
::
Lifetime
(
lt
))
.collect
();
let
types
:
Vec
<
ty
::
GenericParam
eterDef
>
=
types
.into_iter
()
.map
(|
ty
|
ty
::
GenericParam
eterDef
::
Type
(
ty
))
.collect
();
let
lifetimes
:
Vec
<
ty
::
GenericParam
>
=
regions
.into_iter
()
.map
(|
lt
|
ty
::
GenericParam
::
Lifetime
(
lt
))
.collect
();
let
types
:
Vec
<
ty
::
GenericParam
>
=
types
.into_iter
()
.map
(|
ty
|
ty
::
GenericParam
::
Type
(
ty
))
.collect
();
let
params
=
lifetimes
.into_iter
()
.chain
(
types
.into_iter
())
.collect
();
tcx
.alloc_generics
(
ty
::
Generics
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录