Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
3382771d
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,发现更多精彩内容 >>
未验证
提交
3382771d
编写于
1月 23, 2021
作者:
J
Jonas Schievink
提交者:
GitHub
1月 23, 2021
浏览文件
操作
浏览文件
下载
差异文件
Rollup merge of #81072 - RalfJung:place-ref-ty, r=oli-obk
PlaceRef::ty: use method call syntax
上级
7635462f
1b09dc25
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
10 addition
and
8 deletion
+10
-8
compiler/rustc_codegen_ssa/src/mir/analyze.rs
compiler/rustc_codegen_ssa/src/mir/analyze.rs
+1
-1
compiler/rustc_codegen_ssa/src/mir/place.rs
compiler/rustc_codegen_ssa/src/mir/place.rs
+1
-1
compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs
...rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs
+3
-1
compiler/rustc_mir/src/borrow_check/mod.rs
compiler/rustc_mir/src/borrow_check/mod.rs
+4
-4
compiler/rustc_mir/src/borrow_check/prefixes.rs
compiler/rustc_mir/src/borrow_check/prefixes.rs
+1
-1
未找到文件。
compiler/rustc_codegen_ssa/src/mir/analyze.rs
浏览文件 @
3382771d
...
...
@@ -119,7 +119,7 @@ fn process_place(
)
);
if
is_consume
{
let
base_ty
=
mir
::
PlaceRef
::
ty
(
&
place_base
,
self
.fx.mir
,
cx
.tcx
());
let
base_ty
=
place_base
.ty
(
self
.fx.mir
,
cx
.tcx
());
let
base_ty
=
self
.fx
.monomorphize
(
base_ty
);
// ZSTs don't require any actual memory access.
...
...
compiler/rustc_codegen_ssa/src/mir/place.rs
浏览文件 @
3382771d
...
...
@@ -506,7 +506,7 @@ pub fn codegen_place(
pub
fn
monomorphized_place_ty
(
&
self
,
place_ref
:
mir
::
PlaceRef
<
'tcx
>
)
->
Ty
<
'tcx
>
{
let
tcx
=
self
.cx
.tcx
();
let
place_ty
=
mir
::
PlaceRef
::
ty
(
&
place_ref
,
self
.mir
,
tcx
);
let
place_ty
=
place_ref
.ty
(
self
.mir
,
tcx
);
self
.monomorphize
(
place_ty
.ty
)
}
}
...
...
compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs
浏览文件 @
3382771d
...
...
@@ -289,7 +289,7 @@ pub(in crate::borrow_check) fn report_use_of_moved_or_uninitialized(
);
}
let
ty
=
PlaceRef
::
ty
(
&
used_place
,
self
.body
,
self
.infcx.tcx
)
.ty
;
let
ty
=
used_place
.ty
(
self
.body
,
self
.infcx.tcx
)
.ty
;
let
needs_note
=
match
ty
.kind
()
{
ty
::
Closure
(
id
,
_
)
=>
{
let
tables
=
self
.infcx.tcx
.typeck
(
id
.expect_local
());
...
...
@@ -728,6 +728,8 @@ pub(in crate::borrow_check) fn describe_place_for_conflicting_borrow(
// Define a small closure that we can use to check if the type of a place
// is a union.
let
union_ty
=
|
place_base
|
{
// Need to use fn call syntax `PlaceRef::ty` to determine the type of `place_base`;
// using a type annotation in the closure argument instead leads to a lifetime error.
let
ty
=
PlaceRef
::
ty
(
&
place_base
,
self
.body
,
self
.infcx.tcx
)
.ty
;
ty
.ty_adt_def
()
.filter
(|
adt
|
adt
.is_union
())
.map
(|
_
|
ty
)
};
...
...
compiler/rustc_mir/src/borrow_check/mod.rs
浏览文件 @
3382771d
...
...
@@ -1743,7 +1743,7 @@ fn check_if_path_or_subpath_is_moved(
if
let
Some
((
place_base
,
ProjectionElem
::
Subslice
{
from
,
to
,
from_end
:
false
}))
=
place_span
.0
.last_projection
()
{
let
place_ty
=
PlaceRef
::
ty
(
&
place_base
,
self
.body
(),
self
.infcx.tcx
);
let
place_ty
=
place_base
.ty
(
self
.body
(),
self
.infcx.tcx
);
if
let
ty
::
Array
(
..
)
=
place_ty
.ty
.kind
()
{
self
.check_if_subslice_element_is_moved
(
location
,
...
...
@@ -1854,7 +1854,7 @@ fn check_if_assigned_path_is_moved(
// assigning to `P.f` requires `P` itself
// be already initialized
let
tcx
=
self
.infcx.tcx
;
let
base_ty
=
PlaceRef
::
ty
(
&
place_base
,
self
.body
(),
tcx
)
.ty
;
let
base_ty
=
place_base
.ty
(
self
.body
(),
tcx
)
.ty
;
match
base_ty
.kind
()
{
ty
::
Adt
(
def
,
_
)
if
def
.has_dtor
(
tcx
)
=>
{
self
.check_if_path_or_subpath_is_moved
(
...
...
@@ -1951,7 +1951,7 @@ fn check_parent_of_field<'cx, 'tcx>(
// no move out from an earlier location) then this is an attempt at initialization
// of the union - we should error in that case.
let
tcx
=
this
.infcx.tcx
;
if
let
ty
::
Adt
(
def
,
_
)
=
PlaceRef
::
ty
(
&
base
,
this
.body
(),
tcx
)
.ty
.kind
()
{
if
let
ty
::
Adt
(
def
,
_
)
=
base
.ty
(
this
.body
(),
tcx
)
.ty
.kind
()
{
if
def
.is_union
()
{
if
this
.move_data.path_map
[
mpi
]
.iter
()
.any
(|
moi
|
{
this
.move_data.moves
[
*
moi
]
.source
.is_predecessor_of
(
location
,
this
.body
)
...
...
@@ -2173,7 +2173,7 @@ fn is_mutable(
Some
((
place_base
,
elem
))
=>
{
match
elem
{
ProjectionElem
::
Deref
=>
{
let
base_ty
=
PlaceRef
::
ty
(
&
place_base
,
self
.body
(),
self
.infcx.tcx
)
.ty
;
let
base_ty
=
place_base
.ty
(
self
.body
(),
self
.infcx.tcx
)
.ty
;
// Check the kind of deref to decide
match
base_ty
.kind
()
{
...
...
compiler/rustc_mir/src/borrow_check/prefixes.rs
浏览文件 @
3382771d
...
...
@@ -117,7 +117,7 @@ fn next(&mut self) -> Option<Self::Item> {
// derefs, except we stop at the deref of a shared
// reference.
let
ty
=
PlaceRef
::
ty
(
&
cursor_base
,
self
.body
,
self
.tcx
)
.ty
;
let
ty
=
cursor_base
.ty
(
self
.body
,
self
.tcx
)
.ty
;
match
ty
.kind
()
{
ty
::
RawPtr
(
_
)
|
ty
::
Ref
(
_
/*rgn*/
,
_
/*ty*/
,
hir
::
Mutability
::
Not
)
=>
{
// don't continue traversing over derefs of raw pointers or shared
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录