Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
f53c93cf
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,发现更多精彩内容 >>
提交
f53c93cf
编写于
8月 30, 2021
作者:
E
Eduard-Mihai Burtescu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ty::layout: split `LayoutOf` into required and (blanket) provided halves.
上级
1e02262d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
25 addition
and
19 deletion
+25
-19
compiler/rustc_codegen_cranelift/src/common.rs
compiler/rustc_codegen_cranelift/src/common.rs
+3
-3
compiler/rustc_codegen_llvm/src/builder.rs
compiler/rustc_codegen_llvm/src/builder.rs
+2
-2
compiler/rustc_codegen_llvm/src/context.rs
compiler/rustc_codegen_llvm/src/context.rs
+2
-2
compiler/rustc_lint/src/context.rs
compiler/rustc_lint/src/context.rs
+2
-2
compiler/rustc_middle/src/ty/layout.rs
compiler/rustc_middle/src/ty/layout.rs
+10
-4
compiler/rustc_mir/src/interpret/eval_context.rs
compiler/rustc_mir/src/interpret/eval_context.rs
+2
-2
compiler/rustc_mir/src/transform/const_prop.rs
compiler/rustc_mir/src/transform/const_prop.rs
+2
-2
compiler/rustc_passes/src/layout_test.rs
compiler/rustc_passes/src/layout_test.rs
+2
-2
未找到文件。
compiler/rustc_codegen_cranelift/src/common.rs
浏览文件 @
f53c93cf
use
rustc_index
::
vec
::
IndexVec
;
use
rustc_middle
::
ty
::
layout
::
LayoutError
;
use
rustc_middle
::
ty
::
layout
::
{
LayoutError
,
LayoutOfHelpers
}
;
use
rustc_middle
::
ty
::
SymbolName
;
use
rustc_target
::
abi
::
call
::
FnAbi
;
use
rustc_target
::
abi
::{
Integer
,
Primitive
};
...
...
@@ -257,7 +257,7 @@ pub(crate) struct FunctionCx<'m, 'clif, 'tcx: 'm> {
pub
(
crate
)
inline_asm_index
:
u32
,
}
impl
<
'tcx
>
LayoutOf
<
'tcx
>
for
FunctionCx
<
'_
,
'_
,
'tcx
>
{
impl
<
'tcx
>
LayoutOf
Helpers
<
'tcx
>
for
FunctionCx
<
'_
,
'_
,
'tcx
>
{
type
LayoutOfResult
=
TyAndLayout
<
'tcx
>
;
#[inline]
...
...
@@ -365,7 +365,7 @@ pub(crate) fn anonymous_str(&mut self, msg: &str) -> Value {
pub
(
crate
)
struct
RevealAllLayoutCx
<
'tcx
>
(
pub
(
crate
)
TyCtxt
<
'tcx
>
);
impl
<
'tcx
>
LayoutOf
<
'tcx
>
for
RevealAllLayoutCx
<
'tcx
>
{
impl
<
'tcx
>
LayoutOf
Helpers
<
'tcx
>
for
RevealAllLayoutCx
<
'tcx
>
{
type
LayoutOfResult
=
TyAndLayout
<
'tcx
>
;
#[inline]
...
...
compiler/rustc_codegen_llvm/src/builder.rs
浏览文件 @
f53c93cf
...
...
@@ -15,7 +15,7 @@
use
rustc_codegen_ssa
::
MemFlags
;
use
rustc_data_structures
::
small_c_str
::
SmallCStr
;
use
rustc_hir
::
def_id
::
DefId
;
use
rustc_middle
::
ty
::
layout
::{
LayoutError
,
LayoutOf
,
TyAndLayout
};
use
rustc_middle
::
ty
::
layout
::{
LayoutError
,
LayoutOf
Helpers
,
TyAndLayout
};
use
rustc_middle
::
ty
::{
self
,
Ty
,
TyCtxt
};
use
rustc_span
::
Span
;
use
rustc_target
::
abi
::{
self
,
Align
,
Size
};
...
...
@@ -88,7 +88,7 @@ fn target_spec(&self) -> &Target {
}
}
impl
LayoutOf
<
'tcx
>
for
Builder
<
'_
,
'_
,
'tcx
>
{
impl
LayoutOf
Helpers
<
'tcx
>
for
Builder
<
'_
,
'_
,
'tcx
>
{
type
LayoutOfResult
=
TyAndLayout
<
'tcx
>
;
#[inline]
...
...
compiler/rustc_codegen_llvm/src/context.rs
浏览文件 @
f53c93cf
...
...
@@ -15,7 +15,7 @@
use
rustc_data_structures
::
fx
::
FxHashMap
;
use
rustc_data_structures
::
small_c_str
::
SmallCStr
;
use
rustc_middle
::
mir
::
mono
::
CodegenUnit
;
use
rustc_middle
::
ty
::
layout
::{
HasParamEnv
,
LayoutError
,
LayoutOf
,
TyAndLayout
};
use
rustc_middle
::
ty
::
layout
::{
HasParamEnv
,
LayoutError
,
LayoutOf
Helpers
,
TyAndLayout
};
use
rustc_middle
::
ty
::{
self
,
Instance
,
Ty
,
TyCtxt
};
use
rustc_middle
::{
bug
,
span_bug
};
use
rustc_session
::
config
::{
CFGuard
,
CrateType
,
DebugInfo
};
...
...
@@ -835,7 +835,7 @@ fn tcx(&self) -> TyCtxt<'tcx> {
}
}
impl
LayoutOf
<
'tcx
>
for
CodegenCx
<
'll
,
'tcx
>
{
impl
LayoutOf
Helpers
<
'tcx
>
for
CodegenCx
<
'll
,
'tcx
>
{
type
LayoutOfResult
=
TyAndLayout
<
'tcx
>
;
#[inline]
...
...
compiler/rustc_lint/src/context.rs
浏览文件 @
f53c93cf
...
...
@@ -31,7 +31,7 @@
use
rustc_middle
::
lint
::
LintDiagnosticBuilder
;
use
rustc_middle
::
middle
::
privacy
::
AccessLevels
;
use
rustc_middle
::
middle
::
stability
;
use
rustc_middle
::
ty
::
layout
::{
LayoutError
,
LayoutOf
,
TyAndLayout
};
use
rustc_middle
::
ty
::
layout
::{
LayoutError
,
LayoutOf
Helpers
,
TyAndLayout
};
use
rustc_middle
::
ty
::
print
::
with_no_trimmed_paths
;
use
rustc_middle
::
ty
::{
self
,
print
::
Printer
,
subst
::
GenericArg
,
Ty
,
TyCtxt
};
use
rustc_serialize
::
json
::
Json
;
...
...
@@ -1080,7 +1080,7 @@ fn param_env(&self) -> ty::ParamEnv<'tcx> {
}
}
impl
<
'tcx
>
LayoutOf
<
'tcx
>
for
LateContext
<
'tcx
>
{
impl
<
'tcx
>
LayoutOf
Helpers
<
'tcx
>
for
LateContext
<
'tcx
>
{
type
LayoutOfResult
=
Result
<
TyAndLayout
<
'tcx
>
,
LayoutError
<
'tcx
>>
;
#[inline]
...
...
compiler/rustc_middle/src/ty/layout.rs
浏览文件 @
f53c93cf
...
...
@@ -2093,8 +2093,9 @@ fn to_result(self) -> Result<T, Self::Error> {
pub
type
TyAndLayout
<
'tcx
>
=
rustc_target
::
abi
::
TyAndLayout
<
'tcx
,
Ty
<
'tcx
>>
;
/// Trait for contexts that can compute layouts of types.
pub
trait
LayoutOf
<
'tcx
>
:
HasDataLayout
+
HasTyCtxt
<
'tcx
>
+
HasParamEnv
<
'tcx
>
{
/// Trait for contexts that want to be able to compute layouts of types.
/// This automatically gives access to `LayoutOf`, through a blanket `impl`.
pub
trait
LayoutOfHelpers
<
'tcx
>
:
HasDataLayout
+
HasTyCtxt
<
'tcx
>
+
HasParamEnv
<
'tcx
>
{
/// The `TyAndLayout`-wrapping type (or `TyAndLayout` itself), which will be
/// returned from `layout_of` (see also `handle_layout_err`).
type
LayoutOfResult
:
MaybeResult
<
TyAndLayout
<
'tcx
>>
;
...
...
@@ -2119,7 +2120,10 @@ fn handle_layout_err(
span
:
Span
,
ty
:
Ty
<
'tcx
>
,
)
->
<
Self
::
LayoutOfResult
as
MaybeResult
<
TyAndLayout
<
'tcx
>>>
::
Error
;
}
/// Blanket extension trait for contexts that can compute layouts of types.
pub
trait
LayoutOf
<
'tcx
>
:
LayoutOfHelpers
<
'tcx
>
{
/// Computes the layout of a type. Note that this implicitly
/// executes in "reveal all" mode, and will normalize the input type.
#[inline]
...
...
@@ -2143,7 +2147,9 @@ fn spanned_layout_of(&self, ty: Ty<'tcx>, span: Span) -> Self::LayoutOfResult {
}
}
impl
LayoutOf
<
'tcx
>
for
LayoutCx
<
'tcx
,
TyCtxt
<
'tcx
>>
{
impl
<
C
:
LayoutOfHelpers
<
'tcx
>>
LayoutOf
<
'tcx
>
for
C
{}
impl
LayoutOfHelpers
<
'tcx
>
for
LayoutCx
<
'tcx
,
TyCtxt
<
'tcx
>>
{
type
LayoutOfResult
=
Result
<
TyAndLayout
<
'tcx
>
,
LayoutError
<
'tcx
>>
;
#[inline]
...
...
@@ -2152,7 +2158,7 @@ fn handle_layout_err(&self, err: LayoutError<'tcx>, _: Span, _: Ty<'tcx>) -> Lay
}
}
impl
LayoutOf
<
'tcx
>
for
LayoutCx
<
'tcx
,
ty
::
query
::
TyCtxtAt
<
'tcx
>>
{
impl
LayoutOf
Helpers
<
'tcx
>
for
LayoutCx
<
'tcx
,
ty
::
query
::
TyCtxtAt
<
'tcx
>>
{
type
LayoutOfResult
=
Result
<
TyAndLayout
<
'tcx
>
,
LayoutError
<
'tcx
>>
;
#[inline]
...
...
compiler/rustc_mir/src/interpret/eval_context.rs
浏览文件 @
f53c93cf
...
...
@@ -8,7 +8,7 @@
use
rustc_macros
::
HashStable
;
use
rustc_middle
::
ich
::
StableHashingContext
;
use
rustc_middle
::
mir
;
use
rustc_middle
::
ty
::
layout
::{
self
,
LayoutError
,
LayoutOf
,
TyAndLayout
};
use
rustc_middle
::
ty
::
layout
::{
self
,
LayoutError
,
LayoutOf
,
LayoutOfHelpers
,
TyAndLayout
};
use
rustc_middle
::
ty
::{
self
,
query
::
TyCtxtAt
,
subst
::
SubstsRef
,
ParamEnv
,
Ty
,
TyCtxt
,
TypeFoldable
,
};
...
...
@@ -312,7 +312,7 @@ fn param_env(&self) -> ty::ParamEnv<'tcx> {
}
}
impl
<
'mir
,
'tcx
:
'mir
,
M
:
Machine
<
'mir
,
'tcx
>>
LayoutOf
<
'tcx
>
for
InterpCx
<
'mir
,
'tcx
,
M
>
{
impl
<
'mir
,
'tcx
:
'mir
,
M
:
Machine
<
'mir
,
'tcx
>>
LayoutOf
Helpers
<
'tcx
>
for
InterpCx
<
'mir
,
'tcx
,
M
>
{
type
LayoutOfResult
=
InterpResult
<
'tcx
,
TyAndLayout
<
'tcx
>>
;
#[inline]
...
...
compiler/rustc_mir/src/transform/const_prop.rs
浏览文件 @
f53c93cf
...
...
@@ -17,7 +17,7 @@
Location
,
Operand
,
Place
,
Rvalue
,
SourceInfo
,
SourceScope
,
SourceScopeData
,
Statement
,
StatementKind
,
Terminator
,
TerminatorKind
,
UnOp
,
RETURN_PLACE
,
};
use
rustc_middle
::
ty
::
layout
::{
LayoutError
,
LayoutOf
,
TyAndLayout
};
use
rustc_middle
::
ty
::
layout
::{
LayoutError
,
LayoutOf
,
LayoutOfHelpers
,
TyAndLayout
};
use
rustc_middle
::
ty
::
subst
::{
InternalSubsts
,
Subst
};
use
rustc_middle
::
ty
::{
self
,
ConstInt
,
ConstKind
,
Instance
,
ParamEnv
,
ScalarInt
,
Ty
,
TyCtxt
,
TypeFoldable
,
...
...
@@ -330,7 +330,7 @@ struct ConstPropagator<'mir, 'tcx> {
source_info
:
Option
<
SourceInfo
>
,
}
impl
<
'mir
,
'tcx
>
LayoutOf
<
'tcx
>
for
ConstPropagator
<
'mir
,
'tcx
>
{
impl
<
'mir
,
'tcx
>
LayoutOf
Helpers
<
'tcx
>
for
ConstPropagator
<
'mir
,
'tcx
>
{
type
LayoutOfResult
=
Result
<
TyAndLayout
<
'tcx
>
,
LayoutError
<
'tcx
>>
;
#[inline]
...
...
compiler/rustc_passes/src/layout_test.rs
浏览文件 @
f53c93cf
...
...
@@ -3,7 +3,7 @@
use
rustc_hir
::
def_id
::
LocalDefId
;
use
rustc_hir
::
itemlikevisit
::
ItemLikeVisitor
;
use
rustc_hir
::
ItemKind
;
use
rustc_middle
::
ty
::
layout
::{
HasParamEnv
,
HasTyCtxt
,
LayoutError
,
LayoutOf
,
TyAndLayout
};
use
rustc_middle
::
ty
::
layout
::{
HasParamEnv
,
HasTyCtxt
,
LayoutError
,
LayoutOf
Helpers
,
TyAndLayout
};
use
rustc_middle
::
ty
::{
ParamEnv
,
Ty
,
TyCtxt
};
use
rustc_span
::
symbol
::
sym
;
use
rustc_span
::
Span
;
...
...
@@ -114,7 +114,7 @@ struct UnwrapLayoutCx<'tcx> {
param_env
:
ParamEnv
<
'tcx
>
,
}
impl
LayoutOf
<
'tcx
>
for
UnwrapLayoutCx
<
'tcx
>
{
impl
LayoutOf
Helpers
<
'tcx
>
for
UnwrapLayoutCx
<
'tcx
>
{
type
LayoutOfResult
=
TyAndLayout
<
'tcx
>
;
fn
handle_layout_err
(
&
self
,
err
:
LayoutError
<
'tcx
>
,
span
:
Span
,
ty
:
Ty
<
'tcx
>
)
->
!
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录