Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
87d1fb74
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,发现更多精彩内容 >>
提交
87d1fb74
编写于
8月 25, 2021
作者:
E
Eduard-Mihai Burtescu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rustc_target: require `TyAbiInterface` in `LayoutOf`.
上级
8486571a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
47 addition
and
5 deletion
+47
-5
compiler/rustc_lint/src/context.rs
compiler/rustc_lint/src/context.rs
+22
-1
compiler/rustc_middle/src/ty/layout.rs
compiler/rustc_middle/src/ty/layout.rs
+14
-0
compiler/rustc_mir/src/transform/const_prop.rs
compiler/rustc_mir/src/transform/const_prop.rs
+9
-2
compiler/rustc_target/src/abi/mod.rs
compiler/rustc_target/src/abi/mod.rs
+2
-2
未找到文件。
compiler/rustc_lint/src/context.rs
浏览文件 @
87d1fb74
...
...
@@ -41,7 +41,7 @@
use
rustc_session
::
SessionLintStore
;
use
rustc_span
::
lev_distance
::
find_best_match_for_name
;
use
rustc_span
::{
symbol
::
Symbol
,
MultiSpan
,
Span
,
DUMMY_SP
};
use
rustc_target
::
abi
::
LayoutOf
;
use
rustc_target
::
abi
::
{
self
,
LayoutOf
}
;
use
tracing
::
debug
;
use
std
::
cell
::
Cell
;
...
...
@@ -1059,6 +1059,27 @@ fn path_generic_args(
}
}
impl
<
'tcx
>
abi
::
HasDataLayout
for
LateContext
<
'tcx
>
{
#[inline]
fn
data_layout
(
&
self
)
->
&
abi
::
TargetDataLayout
{
&
self
.tcx.data_layout
}
}
impl
<
'tcx
>
ty
::
layout
::
HasTyCtxt
<
'tcx
>
for
LateContext
<
'tcx
>
{
#[inline]
fn
tcx
(
&
self
)
->
TyCtxt
<
'tcx
>
{
self
.tcx
}
}
impl
<
'tcx
>
ty
::
layout
::
HasParamEnv
<
'tcx
>
for
LateContext
<
'tcx
>
{
#[inline]
fn
param_env
(
&
self
)
->
ty
::
ParamEnv
<
'tcx
>
{
self
.param_env
}
}
impl
<
'tcx
>
LayoutOf
<
'tcx
>
for
LateContext
<
'tcx
>
{
type
Ty
=
Ty
<
'tcx
>
;
type
TyAndLayout
=
Result
<
TyAndLayout
<
'tcx
>
,
LayoutError
<
'tcx
>>
;
...
...
compiler/rustc_middle/src/ty/layout.rs
浏览文件 @
87d1fb74
...
...
@@ -2034,6 +2034,20 @@ fn tcx(&self) -> TyCtxt<'tcx> {
}
}
impl
<
'tcx
>
HasDataLayout
for
ty
::
query
::
TyCtxtAt
<
'tcx
>
{
#[inline]
fn
data_layout
(
&
self
)
->
&
TargetDataLayout
{
&
self
.data_layout
}
}
impl
<
'tcx
>
HasTyCtxt
<
'tcx
>
for
ty
::
query
::
TyCtxtAt
<
'tcx
>
{
#[inline]
fn
tcx
(
&
self
)
->
TyCtxt
<
'tcx
>
{
**
self
}
}
impl
<
'tcx
,
C
>
HasParamEnv
<
'tcx
>
for
LayoutCx
<
'tcx
,
C
>
{
fn
param_env
(
&
self
)
->
ty
::
ParamEnv
<
'tcx
>
{
self
.param_env
...
...
compiler/rustc_mir/src/transform/const_prop.rs
浏览文件 @
87d1fb74
...
...
@@ -17,7 +17,7 @@
Location
,
Operand
,
Place
,
Rvalue
,
SourceInfo
,
SourceScope
,
SourceScopeData
,
Statement
,
StatementKind
,
Terminator
,
TerminatorKind
,
UnOp
,
RETURN_PLACE
,
};
use
rustc_middle
::
ty
::
layout
::{
HasTyCtxt
,
LayoutError
,
TyAndLayout
};
use
rustc_middle
::
ty
::
layout
::{
LayoutError
,
TyAndLayout
};
use
rustc_middle
::
ty
::
subst
::{
InternalSubsts
,
Subst
};
use
rustc_middle
::
ty
::{
self
,
ConstInt
,
ConstKind
,
Instance
,
ParamEnv
,
ScalarInt
,
Ty
,
TyCtxt
,
TypeFoldable
,
...
...
@@ -346,13 +346,20 @@ fn data_layout(&self) -> &TargetDataLayout {
}
}
impl
<
'mir
,
'tcx
>
HasTyCtxt
<
'tcx
>
for
ConstPropagator
<
'mir
,
'tcx
>
{
impl
<
'mir
,
'tcx
>
ty
::
layout
::
HasTyCtxt
<
'tcx
>
for
ConstPropagator
<
'mir
,
'tcx
>
{
#[inline]
fn
tcx
(
&
self
)
->
TyCtxt
<
'tcx
>
{
self
.tcx
}
}
impl
<
'mir
,
'tcx
>
ty
::
layout
::
HasParamEnv
<
'tcx
>
for
ConstPropagator
<
'mir
,
'tcx
>
{
#[inline]
fn
param_env
(
&
self
)
->
ty
::
ParamEnv
<
'tcx
>
{
self
.param_env
}
}
impl
<
'mir
,
'tcx
>
ConstPropagator
<
'mir
,
'tcx
>
{
fn
new
(
body
:
&
Body
<
'tcx
>
,
...
...
compiler/rustc_target/src/abi/mod.rs
浏览文件 @
87d1fb74
...
...
@@ -1174,8 +1174,8 @@ fn deref(&self) -> &&'a Layout {
}
/// Trait for context types that can compute layouts of things.
pub
trait
LayoutOf
<
'a
>
{
type
Ty
;
pub
trait
LayoutOf
<
'a
>
:
Sized
{
type
Ty
:
TyAbiInterface
<
'a
,
Self
>
;
type
TyAndLayout
:
MaybeResult
<
TyAndLayout
<
'a
,
Self
::
Ty
>>
;
fn
layout_of
(
&
self
,
ty
:
Self
::
Ty
)
->
Self
::
TyAndLayout
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录