Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
78778fc6
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,发现更多精彩内容 >>
提交
78778fc6
编写于
8月 25, 2021
作者:
E
Eduard-Mihai Burtescu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rustc_target: remove `LayoutOf` bound from `TyAbiInterface`.
上级
8e6d126b
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
81 addition
and
85 deletion
+81
-85
compiler/rustc_middle/src/ty/layout.rs
compiler/rustc_middle/src/ty/layout.rs
+30
-24
compiler/rustc_target/src/abi/call/aarch64.rs
compiler/rustc_target/src/abi/call/aarch64.rs
+5
-5
compiler/rustc_target/src/abi/call/amdgpu.rs
compiler/rustc_target/src/abi/call/amdgpu.rs
+4
-4
compiler/rustc_target/src/abi/call/arm.rs
compiler/rustc_target/src/abi/call/arm.rs
+5
-5
compiler/rustc_target/src/abi/call/mips64.rs
compiler/rustc_target/src/abi/call/mips64.rs
+5
-5
compiler/rustc_target/src/abi/call/mod.rs
compiler/rustc_target/src/abi/call/mod.rs
+2
-3
compiler/rustc_target/src/abi/call/powerpc64.rs
compiler/rustc_target/src/abi/call/powerpc64.rs
+5
-5
compiler/rustc_target/src/abi/call/riscv.rs
compiler/rustc_target/src/abi/call/riscv.rs
+2
-8
compiler/rustc_target/src/abi/call/s390x.rs
compiler/rustc_target/src/abi/call/s390x.rs
+4
-4
compiler/rustc_target/src/abi/call/sparc64.rs
compiler/rustc_target/src/abi/call/sparc64.rs
+5
-5
compiler/rustc_target/src/abi/call/wasm.rs
compiler/rustc_target/src/abi/call/wasm.rs
+5
-5
compiler/rustc_target/src/abi/call/x86.rs
compiler/rustc_target/src/abi/call/x86.rs
+3
-3
compiler/rustc_target/src/abi/call/x86_64.rs
compiler/rustc_target/src/abi/call/x86_64.rs
+4
-4
compiler/rustc_target/src/abi/mod.rs
compiler/rustc_target/src/abi/mod.rs
+2
-5
未找到文件。
compiler/rustc_middle/src/ty/layout.rs
浏览文件 @
78778fc6
...
...
@@ -2090,7 +2090,7 @@ fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyAndLayout {
impl
<
'tcx
,
C
>
TyAbiInterface
<
'tcx
,
C
>
for
Ty
<
'tcx
>
where
C
:
LayoutOf
<
'tcx
,
Ty
=
Ty
<
'tcx
>>
+
HasTyCtxt
<
'tcx
>
+
HasParamEnv
<
'tcx
>
,
C
:
HasTyCtxt
<
'tcx
>
+
HasParamEnv
<
'tcx
>
,
{
fn
ty_and_layout_for_variant
(
this
:
TyAndLayout
<
'tcx
>
,
...
...
@@ -2109,8 +2109,11 @@ fn ty_and_layout_for_variant(
}
Variants
::
Single
{
index
}
=>
{
let
tcx
=
cx
.tcx
();
let
param_env
=
cx
.param_env
();
// Deny calling for_variant more than once for non-Single enums.
if
let
Ok
(
original_layout
)
=
cx
.layout_of
(
this
.ty
)
.to_result
(
)
{
if
let
Ok
(
original_layout
)
=
tcx
.layout_of
(
param_env
.and
(
this
.ty
)
)
{
assert_eq!
(
original_layout
.variants
,
Variants
::
Single
{
index
});
}
...
...
@@ -2120,7 +2123,6 @@ fn ty_and_layout_for_variant(
ty
::
Adt
(
def
,
_
)
=>
def
.variants
[
variant_index
]
.fields
.len
(),
_
=>
bug!
(),
};
let
tcx
=
cx
.tcx
();
tcx
.intern_layout
(
Layout
{
variants
:
Variants
::
Single
{
index
:
variant_index
},
fields
:
match
NonZeroUsize
::
new
(
fields
)
{
...
...
@@ -2300,13 +2302,16 @@ fn ty_and_layout_pointee_info_at(
cx
:
&
C
,
offset
:
Size
,
)
->
Option
<
PointeeInfo
>
{
let
tcx
=
cx
.tcx
();
let
param_env
=
cx
.param_env
();
let
addr_space_of_ty
=
|
ty
:
Ty
<
'tcx
>
|
{
if
ty
.is_fn
()
{
cx
.data_layout
()
.instruction_address_space
}
else
{
AddressSpace
::
DATA
}
};
let
pointee_info
=
match
*
this
.ty
.kind
()
{
ty
::
RawPtr
(
mt
)
if
offset
.bytes
()
==
0
=>
{
cx
.layout_of
(
mt
.ty
)
.to_result
(
)
.ok
()
.map
(|
layout
|
PointeeInfo
{
tcx
.layout_of
(
param_env
.and
(
mt
.ty
)
)
.ok
()
.map
(|
layout
|
PointeeInfo
{
size
:
layout
.size
,
align
:
layout
.align.abi
,
safe
:
None
,
...
...
@@ -2314,18 +2319,15 @@ fn ty_and_layout_pointee_info_at(
})
}
ty
::
FnPtr
(
fn_sig
)
if
offset
.bytes
()
==
0
=>
{
cx
.layout_of
(
cx
.tcx
()
.mk_fn_ptr
(
fn_sig
))
.to_result
()
.ok
()
.map
(|
layout
|
{
PointeeInfo
{
size
:
layout
.size
,
align
:
layout
.align.abi
,
safe
:
None
,
address_space
:
cx
.data_layout
()
.instruction_address_space
,
}
tcx
.layout_of
(
param_env
.and
(
tcx
.mk_fn_ptr
(
fn_sig
)))
.ok
()
.map
(|
layout
|
PointeeInfo
{
size
:
layout
.size
,
align
:
layout
.align.abi
,
safe
:
None
,
address_space
:
cx
.data_layout
()
.instruction_address_space
,
})
}
ty
::
Ref
(
_
,
ty
,
mt
)
if
offset
.bytes
()
==
0
=>
{
let
address_space
=
addr_space_of_ty
(
ty
);
let
tcx
=
cx
.tcx
();
let
kind
=
if
tcx
.sess.opts.optimize
==
OptLevel
::
No
{
// Use conservative pointer kind if not optimizing. This saves us the
// Freeze/Unpin queries, and can save time in the codegen backend (noalias
...
...
@@ -2354,7 +2356,7 @@ fn ty_and_layout_pointee_info_at(
}
};
cx
.layout_of
(
ty
)
.to_result
(
)
.ok
()
.map
(|
layout
|
PointeeInfo
{
tcx
.layout_of
(
param_env
.and
(
ty
)
)
.ok
()
.map
(|
layout
|
PointeeInfo
{
size
:
layout
.size
,
align
:
layout
.align.abi
,
safe
:
Some
(
kind
),
...
...
@@ -3023,16 +3025,15 @@ fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi) {
}
}
fn
make_thin_self_ptr
<
'tcx
,
C
>
(
cx
:
&
C
,
mut
layout
:
TyAndLayout
<
'tcx
>
)
->
TyAndLayout
<
'tcx
>
where
C
:
LayoutOf
<
'tcx
,
Ty
=
Ty
<
'tcx
>
,
TyAndLayout
=
TyAndLayout
<
'tcx
>>
+
HasTyCtxt
<
'tcx
>
+
HasParamEnv
<
'tcx
>
,
{
fn
make_thin_self_ptr
<
'tcx
>
(
cx
:
&
(
impl
HasTyCtxt
<
'tcx
>
+
HasParamEnv
<
'tcx
>
),
layout
:
TyAndLayout
<
'tcx
>
,
)
->
TyAndLayout
<
'tcx
>
{
let
tcx
=
cx
.tcx
();
let
fat_pointer_ty
=
if
layout
.is_unsized
()
{
// unsized `self` is passed as a pointer to `self`
// FIXME (mikeyhew) change this to use &own if it is ever added to the language
cx
.tcx
()
.mk_mut_ptr
(
layout
.ty
)
tcx
.mk_mut_ptr
(
layout
.ty
)
}
else
{
match
layout
.abi
{
Abi
::
ScalarPair
(
..
)
=>
(),
...
...
@@ -3066,8 +3067,13 @@ fn make_thin_self_ptr<'tcx, C>(cx: &C, mut layout: TyAndLayout<'tcx>) -> TyAndLa
// we now have a type like `*mut RcBox<dyn Trait>`
// change its layout to that of `*mut ()`, a thin pointer, but keep the same type
// this is understood as a special case elsewhere in the compiler
let
unit_pointer_ty
=
cx
.tcx
()
.mk_mut_ptr
(
cx
.tcx
()
.mk_unit
());
layout
=
cx
.layout_of
(
unit_pointer_ty
);
layout
.ty
=
fat_pointer_ty
;
layout
let
unit_ptr_ty
=
tcx
.mk_mut_ptr
(
tcx
.mk_unit
());
TyAndLayout
{
ty
:
fat_pointer_ty
,
// NOTE(eddyb) using an empty `ParamEnv`, and `unwrap`-ing the `Result`
// should always work because the type is always `*mut ()`.
..
tcx
.layout_of
(
ty
::
ParamEnv
::
reveal_all
()
.and
(
unit_ptr_ty
))
.unwrap
()
}
}
compiler/rustc_target/src/abi/call/aarch64.rs
浏览文件 @
78778fc6
use
crate
::
abi
::
call
::{
ArgAbi
,
FnAbi
,
Reg
,
RegKind
,
Uniform
};
use
crate
::
abi
::{
HasDataLayout
,
LayoutOf
,
TyAbiInterface
,
TyAndLayout
};
use
crate
::
abi
::{
HasDataLayout
,
TyAbiInterface
};
fn
is_homogeneous_aggregate
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
arg
:
&
mut
ArgAbi
<
'a
,
Ty
>
)
->
Option
<
Uniform
>
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
arg
.layout
.homogeneous_aggregate
(
cx
)
.ok
()
.and_then
(|
ha
|
ha
.unit
())
.and_then
(|
unit
|
{
let
size
=
arg
.layout.size
;
...
...
@@ -27,7 +27,7 @@ fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) -> Opti
fn
classify_ret
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
ret
:
&
mut
ArgAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
ret
.layout
.is_aggregate
()
{
ret
.extend_integer_width_to
(
32
);
...
...
@@ -49,7 +49,7 @@ fn classify_ret<'a, Ty, C>(cx: &C, ret: &mut ArgAbi<'a, Ty>)
fn
classify_arg
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
arg
:
&
mut
ArgAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
arg
.layout
.is_aggregate
()
{
arg
.extend_integer_width_to
(
32
);
...
...
@@ -71,7 +71,7 @@ fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>)
pub
fn
compute_abi_info
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
fn_abi
:
&
mut
FnAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
fn_abi
.ret
.is_ignore
()
{
classify_ret
(
cx
,
&
mut
fn_abi
.ret
);
...
...
compiler/rustc_target/src/abi/call/amdgpu.rs
浏览文件 @
78778fc6
use
crate
::
abi
::
call
::{
ArgAbi
,
FnAbi
};
use
crate
::
abi
::{
HasDataLayout
,
LayoutOf
,
TyAbiInterface
,
TyAndLayout
};
use
crate
::
abi
::{
HasDataLayout
,
TyAbiInterface
};
fn
classify_ret
<
'a
,
Ty
,
C
>
(
_
cx
:
&
C
,
ret
:
&
mut
ArgAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
ret
.extend_integer_width_to
(
32
);
}
...
...
@@ -12,7 +12,7 @@ fn classify_ret<'a, Ty, C>(_cx: &C, ret: &mut ArgAbi<'a, Ty>)
fn
classify_arg
<
'a
,
Ty
,
C
>
(
_
cx
:
&
C
,
arg
:
&
mut
ArgAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
arg
.extend_integer_width_to
(
32
);
}
...
...
@@ -20,7 +20,7 @@ fn classify_arg<'a, Ty, C>(_cx: &C, arg: &mut ArgAbi<'a, Ty>)
pub
fn
compute_abi_info
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
fn_abi
:
&
mut
FnAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
fn_abi
.ret
.is_ignore
()
{
classify_ret
(
cx
,
&
mut
fn_abi
.ret
);
...
...
compiler/rustc_target/src/abi/call/arm.rs
浏览文件 @
78778fc6
use
crate
::
abi
::
call
::{
ArgAbi
,
Conv
,
FnAbi
,
Reg
,
RegKind
,
Uniform
};
use
crate
::
abi
::{
HasDataLayout
,
LayoutOf
,
TyAbiInterface
,
TyAndLayout
};
use
crate
::
abi
::{
HasDataLayout
,
TyAbiInterface
};
use
crate
::
spec
::
HasTargetSpec
;
fn
is_homogeneous_aggregate
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
arg
:
&
mut
ArgAbi
<
'a
,
Ty
>
)
->
Option
<
Uniform
>
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
arg
.layout
.homogeneous_aggregate
(
cx
)
.ok
()
.and_then
(|
ha
|
ha
.unit
())
.and_then
(|
unit
|
{
let
size
=
arg
.layout.size
;
...
...
@@ -28,7 +28,7 @@ fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) -> Opti
fn
classify_ret
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
ret
:
&
mut
ArgAbi
<
'a
,
Ty
>
,
vfp
:
bool
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
ret
.layout
.is_aggregate
()
{
ret
.extend_integer_width_to
(
32
);
...
...
@@ -54,7 +54,7 @@ fn classify_ret<'a, Ty, C>(cx: &C, ret: &mut ArgAbi<'a, Ty>, vfp: bool)
fn
classify_arg
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
arg
:
&
mut
ArgAbi
<
'a
,
Ty
>
,
vfp
:
bool
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
arg
.layout
.is_aggregate
()
{
arg
.extend_integer_width_to
(
32
);
...
...
@@ -76,7 +76,7 @@ fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>, vfp: bool)
pub
fn
compute_abi_info
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
fn_abi
:
&
mut
FnAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
+
HasTargetSpec
,
C
:
HasDataLayout
+
HasTargetSpec
,
{
// If this is a target with a hard-float ABI, and the function is not explicitly
// `extern "aapcs"`, then we must use the VFP registers for homogeneous aggregates.
...
...
compiler/rustc_target/src/abi/call/mips64.rs
浏览文件 @
78778fc6
use
crate
::
abi
::
call
::{
ArgAbi
,
ArgExtension
,
CastTarget
,
FnAbi
,
PassMode
,
Reg
,
RegKind
,
Uniform
};
use
crate
::
abi
::{
self
,
HasDataLayout
,
LayoutOf
,
Size
,
TyAbiInterface
,
TyAndLayout
};
use
crate
::
abi
::{
self
,
HasDataLayout
,
Size
,
TyAbiInterface
};
fn
extend_integer_width_mips
<
Ty
>
(
arg
:
&
mut
ArgAbi
<
'_
,
Ty
>
,
bits
:
u64
)
{
// Always sign extend u32 values on 64-bit mips
...
...
@@ -20,7 +20,7 @@ fn extend_integer_width_mips<Ty>(arg: &mut ArgAbi<'_, Ty>, bits: u64) {
fn
float_reg
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
ret
:
&
ArgAbi
<
'a
,
Ty
>
,
i
:
usize
)
->
Option
<
Reg
>
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
match
ret
.layout
.field
(
cx
,
i
)
.abi
{
abi
::
Abi
::
Scalar
(
ref
scalar
)
=>
match
scalar
.value
{
...
...
@@ -35,7 +35,7 @@ fn float_reg<'a, Ty, C>(cx: &C, ret: &ArgAbi<'a, Ty>, i: usize) -> Option<Reg>
fn
classify_ret
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
ret
:
&
mut
ArgAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
ret
.layout
.is_aggregate
()
{
extend_integer_width_mips
(
ret
,
64
);
...
...
@@ -75,7 +75,7 @@ fn classify_ret<'a, Ty, C>(cx: &C, ret: &mut ArgAbi<'a, Ty>)
fn
classify_arg
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
arg
:
&
mut
ArgAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
arg
.layout
.is_aggregate
()
{
extend_integer_width_mips
(
arg
,
64
);
...
...
@@ -145,7 +145,7 @@ fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>)
pub
fn
compute_abi_info
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
fn_abi
:
&
mut
FnAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
fn_abi
.ret
.is_ignore
()
{
classify_ret
(
cx
,
&
mut
fn_abi
.ret
);
...
...
compiler/rustc_target/src/abi/call/mod.rs
浏览文件 @
78778fc6
use
crate
::
abi
::{
self
,
Abi
,
Align
,
FieldsShape
,
Size
};
use
crate
::
abi
::{
HasDataLayout
,
LayoutOf
,
TyAbiInterface
,
TyAndLayout
};
use
crate
::
abi
::{
HasDataLayout
,
TyAbiInterface
,
TyAndLayout
};
use
crate
::
spec
::{
self
,
HasTargetSpec
};
mod
aarch64
;
...
...
@@ -317,7 +317,6 @@ fn is_aggregate(&self) -> bool {
pub
fn
homogeneous_aggregate
<
C
>
(
&
self
,
cx
:
&
C
)
->
Result
<
HomogeneousAggregate
,
Heterogeneous
>
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
Self
>
,
{
match
self
.abi
{
Abi
::
Uninhabited
=>
Err
(
Heterogeneous
),
...
...
@@ -604,7 +603,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
pub
fn
adjust_for_cabi
<
C
>
(
&
mut
self
,
cx
:
&
C
,
abi
:
spec
::
abi
::
Abi
)
->
Result
<
(),
String
>
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
+
HasTargetSpec
,
C
:
HasDataLayout
+
HasTargetSpec
,
{
if
abi
==
spec
::
abi
::
Abi
::
X86Interrupt
{
if
let
Some
(
arg
)
=
self
.args
.first_mut
()
{
...
...
compiler/rustc_target/src/abi/call/powerpc64.rs
浏览文件 @
78778fc6
...
...
@@ -3,7 +3,7 @@
// need to be fixed when PowerPC vector support is added.
use
crate
::
abi
::
call
::{
ArgAbi
,
FnAbi
,
Reg
,
RegKind
,
Uniform
};
use
crate
::
abi
::{
Endian
,
HasDataLayout
,
LayoutOf
,
TyAbiInterface
,
TyAndLayout
};
use
crate
::
abi
::{
Endian
,
HasDataLayout
,
TyAbiInterface
};
use
crate
::
spec
::
HasTargetSpec
;
#[derive(Debug,
Clone,
Copy,
PartialEq)]
...
...
@@ -20,7 +20,7 @@ fn is_homogeneous_aggregate<'a, Ty, C>(
)
->
Option
<
Uniform
>
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
arg
.layout
.homogeneous_aggregate
(
cx
)
.ok
()
.and_then
(|
ha
|
ha
.unit
())
.and_then
(|
unit
|
{
// ELFv1 only passes one-member aggregates transparently.
...
...
@@ -44,7 +44,7 @@ fn is_homogeneous_aggregate<'a, Ty, C>(
fn
classify_ret
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
ret
:
&
mut
ArgAbi
<
'a
,
Ty
>
,
abi
:
ABI
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
ret
.layout
.is_aggregate
()
{
ret
.extend_integer_width_to
(
64
);
...
...
@@ -87,7 +87,7 @@ fn classify_ret<'a, Ty, C>(cx: &C, ret: &mut ArgAbi<'a, Ty>, abi: ABI)
fn
classify_arg
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
arg
:
&
mut
ArgAbi
<
'a
,
Ty
>
,
abi
:
ABI
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
arg
.layout
.is_aggregate
()
{
arg
.extend_integer_width_to
(
64
);
...
...
@@ -117,7 +117,7 @@ fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>, abi: ABI)
pub
fn
compute_abi_info
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
fn_abi
:
&
mut
FnAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
+
HasTargetSpec
,
C
:
HasDataLayout
+
HasTargetSpec
,
{
let
abi
=
if
cx
.target_spec
()
.env
==
"musl"
{
ELFv2
...
...
compiler/rustc_target/src/abi/call/riscv.rs
浏览文件 @
78778fc6
...
...
@@ -5,9 +5,7 @@
// https://github.com/llvm/llvm-project/blob/8e780252a7284be45cf1ba224cabd884847e8e92/clang/lib/CodeGen/TargetInfo.cpp#L9311-L9773
use
crate
::
abi
::
call
::{
ArgAbi
,
ArgExtension
,
CastTarget
,
FnAbi
,
PassMode
,
Reg
,
RegKind
,
Uniform
};
use
crate
::
abi
::{
self
,
Abi
,
FieldsShape
,
HasDataLayout
,
LayoutOf
,
Size
,
TyAbiInterface
,
TyAndLayout
,
};
use
crate
::
abi
::{
self
,
Abi
,
FieldsShape
,
HasDataLayout
,
Size
,
TyAbiInterface
,
TyAndLayout
};
use
crate
::
spec
::
HasTargetSpec
;
#[derive(Copy,
Clone)]
...
...
@@ -44,7 +42,6 @@ fn should_use_fp_conv_helper<'a, Ty, C>(
)
->
Result
<
(),
CannotUseFpConv
>
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
,
{
match
arg_layout
.abi
{
Abi
::
Scalar
(
ref
scalar
)
=>
match
scalar
.value
{
...
...
@@ -131,7 +128,6 @@ fn should_use_fp_conv<'a, Ty, C>(
)
->
Option
<
FloatConv
>
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
,
{
let
mut
field1_kind
=
RegPassKind
::
Unknown
;
let
mut
field2_kind
=
RegPassKind
::
Unknown
;
...
...
@@ -150,7 +146,6 @@ fn should_use_fp_conv<'a, Ty, C>(
fn
classify_ret
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
arg
:
&
mut
ArgAbi
<
'a
,
Ty
>
,
xlen
:
u64
,
flen
:
u64
)
->
bool
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
,
{
if
let
Some
(
conv
)
=
should_use_fp_conv
(
cx
,
&
arg
.layout
,
xlen
,
flen
)
{
match
conv
{
...
...
@@ -213,7 +208,6 @@ fn classify_arg<'a, Ty, C>(
avail_fprs
:
&
mut
u64
,
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
,
{
if
!
is_vararg
{
match
should_use_fp_conv
(
cx
,
&
arg
.layout
,
xlen
,
flen
)
{
...
...
@@ -321,7 +315,7 @@ fn extend_integer_width<'a, Ty>(arg: &mut ArgAbi<'a, Ty>, xlen: u64) {
pub
fn
compute_abi_info
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
fn_abi
:
&
mut
FnAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
+
HasTargetSpec
,
C
:
HasDataLayout
+
HasTargetSpec
,
{
let
flen
=
match
&
cx
.target_spec
()
.llvm_abiname
[
..
]
{
"ilp32f"
|
"lp64f"
=>
32
,
...
...
compiler/rustc_target/src/abi/call/s390x.rs
浏览文件 @
78778fc6
...
...
@@ -2,7 +2,7 @@
// for a pre-z13 machine or using -mno-vx.
use
crate
::
abi
::
call
::{
ArgAbi
,
FnAbi
,
Reg
};
use
crate
::
abi
::{
self
,
HasDataLayout
,
LayoutOf
,
TyAbiInterface
,
TyAndLayout
};
use
crate
::
abi
::{
self
,
HasDataLayout
,
TyAbiInterface
,
TyAndLayout
};
fn
classify_ret
<
Ty
>
(
ret
:
&
mut
ArgAbi
<
'_
,
Ty
>
)
{
if
!
ret
.layout
.is_aggregate
()
&&
ret
.layout.size
.bits
()
<=
64
{
...
...
@@ -15,7 +15,7 @@ fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
fn
is_single_fp_element
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
layout
:
TyAndLayout
<
'a
,
Ty
>
)
->
bool
where
Ty
:
TyAbiInterface
<
'a
,
C
>
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
match
layout
.abi
{
abi
::
Abi
::
Scalar
(
ref
scalar
)
=>
scalar
.value
.is_float
(),
...
...
@@ -33,7 +33,7 @@ fn is_single_fp_element<'a, Ty, C>(cx: &C, layout: TyAndLayout<'a, Ty>) -> bool
fn
classify_arg
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
arg
:
&
mut
ArgAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
arg
.layout
.is_aggregate
()
&&
arg
.layout.size
.bits
()
<=
64
{
arg
.extend_integer_width_to
(
64
);
...
...
@@ -60,7 +60,7 @@ fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>)
pub
fn
compute_abi_info
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
fn_abi
:
&
mut
FnAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
fn_abi
.ret
.is_ignore
()
{
classify_ret
(
&
mut
fn_abi
.ret
);
...
...
compiler/rustc_target/src/abi/call/sparc64.rs
浏览文件 @
78778fc6
// FIXME: This needs an audit for correctness and completeness.
use
crate
::
abi
::
call
::{
ArgAbi
,
FnAbi
,
Reg
,
RegKind
,
Uniform
};
use
crate
::
abi
::{
HasDataLayout
,
LayoutOf
,
TyAbiInterface
,
TyAndLayout
};
use
crate
::
abi
::{
HasDataLayout
,
TyAbiInterface
};
fn
is_homogeneous_aggregate
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
arg
:
&
mut
ArgAbi
<
'a
,
Ty
>
)
->
Option
<
Uniform
>
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
arg
.layout
.homogeneous_aggregate
(
cx
)
.ok
()
.and_then
(|
ha
|
ha
.unit
())
.and_then
(|
unit
|
{
// Ensure we have at most eight uniquely addressable members.
...
...
@@ -27,7 +27,7 @@ fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) -> Opti
fn
classify_ret
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
ret
:
&
mut
ArgAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
ret
.layout
.is_aggregate
()
{
ret
.extend_integer_width_to
(
64
);
...
...
@@ -53,7 +53,7 @@ fn classify_ret<'a, Ty, C>(cx: &C, ret: &mut ArgAbi<'a, Ty>)
fn
classify_arg
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
arg
:
&
mut
ArgAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
arg
.layout
.is_aggregate
()
{
arg
.extend_integer_width_to
(
64
);
...
...
@@ -77,7 +77,7 @@ fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>)
pub
fn
compute_abi_info
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
fn_abi
:
&
mut
FnAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
fn_abi
.ret
.is_ignore
()
{
classify_ret
(
cx
,
&
mut
fn_abi
.ret
);
...
...
compiler/rustc_target/src/abi/call/wasm.rs
浏览文件 @
78778fc6
use
crate
::
abi
::
call
::{
ArgAbi
,
FnAbi
,
Uniform
};
use
crate
::
abi
::{
HasDataLayout
,
LayoutOf
,
TyAbiInterface
,
TyAndLayout
};
use
crate
::
abi
::{
HasDataLayout
,
TyAbiInterface
};
fn
unwrap_trivial_aggregate
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
val
:
&
mut
ArgAbi
<
'a
,
Ty
>
)
->
bool
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
val
.layout
.is_aggregate
()
{
if
let
Some
(
unit
)
=
val
.layout
.homogeneous_aggregate
(
cx
)
.ok
()
.and_then
(|
ha
|
ha
.unit
())
{
...
...
@@ -21,7 +21,7 @@ fn unwrap_trivial_aggregate<'a, Ty, C>(cx: &C, val: &mut ArgAbi<'a, Ty>) -> bool
fn
classify_ret
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
ret
:
&
mut
ArgAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
ret
.extend_integer_width_to
(
32
);
if
ret
.layout
.is_aggregate
()
&&
!
unwrap_trivial_aggregate
(
cx
,
ret
)
{
...
...
@@ -32,7 +32,7 @@ fn classify_ret<'a, Ty, C>(cx: &C, ret: &mut ArgAbi<'a, Ty>)
fn
classify_arg
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
arg
:
&
mut
ArgAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
arg
.extend_integer_width_to
(
32
);
if
arg
.layout
.is_aggregate
()
&&
!
unwrap_trivial_aggregate
(
cx
,
arg
)
{
...
...
@@ -44,7 +44,7 @@ fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>)
pub
fn
compute_c_abi_info
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
fn_abi
:
&
mut
FnAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
fn_abi
.ret
.is_ignore
()
{
classify_ret
(
cx
,
&
mut
fn_abi
.ret
);
...
...
compiler/rustc_target/src/abi/call/x86.rs
浏览文件 @
78778fc6
use
crate
::
abi
::
call
::{
ArgAttribute
,
FnAbi
,
PassMode
,
Reg
,
RegKind
};
use
crate
::
abi
::{
self
,
HasDataLayout
,
LayoutOf
,
TyAbiInterface
,
TyAndLayout
};
use
crate
::
abi
::{
self
,
HasDataLayout
,
TyAbiInterface
,
TyAndLayout
};
use
crate
::
spec
::
HasTargetSpec
;
#[derive(PartialEq)]
...
...
@@ -11,7 +11,7 @@ pub enum Flavor {
fn
is_single_fp_element
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
layout
:
TyAndLayout
<
'a
,
Ty
>
)
->
bool
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
match
layout
.abi
{
abi
::
Abi
::
Scalar
(
ref
scalar
)
=>
scalar
.value
.is_float
(),
...
...
@@ -29,7 +29,7 @@ fn is_single_fp_element<'a, Ty, C>(cx: &C, layout: TyAndLayout<'a, Ty>) -> bool
pub
fn
compute_abi_info
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
fn_abi
:
&
mut
FnAbi
<
'a
,
Ty
>
,
flavor
:
Flavor
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
+
HasTargetSpec
,
C
:
HasDataLayout
+
HasTargetSpec
,
{
if
!
fn_abi
.ret
.is_ignore
()
{
if
fn_abi
.ret.layout
.is_aggregate
()
{
...
...
compiler/rustc_target/src/abi/call/x86_64.rs
浏览文件 @
78778fc6
...
...
@@ -2,7 +2,7 @@
// https://github.com/jckarter/clay/blob/master/compiler/src/externals.cpp
use
crate
::
abi
::
call
::{
ArgAbi
,
CastTarget
,
FnAbi
,
Reg
,
RegKind
};
use
crate
::
abi
::{
self
,
Abi
,
HasDataLayout
,
LayoutOf
,
Size
,
TyAbiInterface
,
TyAndLayout
};
use
crate
::
abi
::{
self
,
Abi
,
HasDataLayout
,
Size
,
TyAbiInterface
,
TyAndLayout
};
/// Classification of "eightbyte" components.
// N.B., the order of the variants is from general to specific,
...
...
@@ -27,7 +27,7 @@ fn classify_arg<'a, Ty, C>(
)
->
Result
<
[
Option
<
Class
>
;
MAX_EIGHTBYTES
],
Memory
>
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
fn
classify
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
...
...
@@ -37,7 +37,7 @@ fn classify<'a, Ty, C>(
)
->
Result
<
(),
Memory
>
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
if
!
off
.is_aligned
(
layout
.align.abi
)
{
if
!
layout
.is_zst
()
{
...
...
@@ -173,7 +173,7 @@ fn cast_target(cls: &[Option<Class>], size: Size) -> CastTarget {
pub
fn
compute_abi_info
<
'a
,
Ty
,
C
>
(
cx
:
&
C
,
fn_abi
:
&
mut
FnAbi
<
'a
,
Ty
>
)
where
Ty
:
TyAbiInterface
<
'a
,
C
>
+
Copy
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
,
TyAndLayout
=
TyAndLayout
<
'a
,
Ty
>>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
let
mut
int_regs
=
MAX_INT_REGS
;
let
mut
sse_regs
=
MAX_SSE_REGS
;
...
...
compiler/rustc_target/src/abi/mod.rs
浏览文件 @
78778fc6
...
...
@@ -1238,7 +1238,7 @@ pub struct PointeeInfo {
/// Trait that needs to be implemented by the higher-level type representation
/// (e.g. `rustc_middle::ty::Ty`), to provide `rustc_target::abi` functionality.
pub
trait
TyAbiInterface
<
'a
,
C
:
LayoutOf
<
'a
,
Ty
=
Self
>
>
:
Sized
{
pub
trait
TyAbiInterface
<
'a
,
C
>
:
Sized
{
fn
ty_and_layout_for_variant
(
this
:
TyAndLayout
<
'a
,
Self
>
,
cx
:
&
C
,
...
...
@@ -1256,7 +1256,6 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
pub
fn
for_variant
<
C
>
(
self
,
cx
:
&
C
,
variant_index
:
VariantIdx
)
->
Self
where
Ty
:
TyAbiInterface
<
'a
,
C
>
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
>
,
{
Ty
::
ty_and_layout_for_variant
(
self
,
cx
,
variant_index
)
}
...
...
@@ -1264,7 +1263,6 @@ pub fn for_variant<C>(self, cx: &C, variant_index: VariantIdx) -> Self
pub
fn
field
<
C
>
(
self
,
cx
:
&
C
,
i
:
usize
)
->
Self
where
Ty
:
TyAbiInterface
<
'a
,
C
>
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
>
,
{
Ty
::
ty_and_layout_field
(
self
,
cx
,
i
)
}
...
...
@@ -1272,7 +1270,6 @@ pub fn field<C>(self, cx: &C, i: usize) -> Self
pub
fn
pointee_info_at
<
C
>
(
self
,
cx
:
&
C
,
offset
:
Size
)
->
Option
<
PointeeInfo
>
where
Ty
:
TyAbiInterface
<
'a
,
C
>
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
>
,
{
Ty
::
ty_and_layout_pointee_info_at
(
self
,
cx
,
offset
)
}
...
...
@@ -1306,7 +1303,7 @@ pub fn might_permit_raw_init<C>(self, cx: &C, zero: bool) -> bool
where
Self
:
Copy
,
Ty
:
TyAbiInterface
<
'a
,
C
>
,
C
:
LayoutOf
<
'a
,
Ty
=
Ty
>
+
HasDataLayout
,
C
:
HasDataLayout
,
{
let
scalar_allows_raw_init
=
move
|
s
:
&
Scalar
|
->
bool
{
if
zero
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录