Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
9eb6f32d
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,发现更多精彩内容 >>
提交
9eb6f32d
编写于
4月 01, 2019
作者:
M
Matthew Jasper
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use normal newtype_index macro for MIR dataflow
上级
a89c03a3
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
30 addition
and
76 deletion
+30
-76
src/librustc_mir/borrow_check/error_reporting.rs
src/librustc_mir/borrow_check/error_reporting.rs
+1
-2
src/librustc_mir/borrow_check/flows.rs
src/librustc_mir/borrow_check/flows.rs
+1
-1
src/librustc_mir/borrow_check/nll/facts.rs
src/librustc_mir/borrow_check/nll/facts.rs
+0
-12
src/librustc_mir/borrow_check/nll/invalidation.rs
src/librustc_mir/borrow_check/nll/invalidation.rs
+1
-1
src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs
...ibrustc_mir/borrow_check/nll/type_check/liveness/trace.rs
+1
-1
src/librustc_mir/dataflow/impls/borrows.rs
src/librustc_mir/dataflow/impls/borrows.rs
+6
-1
src/librustc_mir/dataflow/mod.rs
src/librustc_mir/dataflow/mod.rs
+6
-1
src/librustc_mir/dataflow/move_paths/mod.rs
src/librustc_mir/dataflow/move_paths/mod.rs
+14
-57
未找到文件。
src/librustc_mir/borrow_check/error_reporting.rs
浏览文件 @
9eb6f32d
...
...
@@ -25,8 +25,7 @@
use
super
::{
Context
,
MirBorrowckCtxt
};
use
super
::{
InitializationRequiringAction
,
PrefixSet
};
use
crate
::
dataflow
::
drop_flag_effects
;
use
crate
::
dataflow
::
move_paths
::
indexes
::
MoveOutIndex
;
use
crate
::
dataflow
::
move_paths
::
MovePathIndex
;
use
crate
::
dataflow
::
indexes
::{
MovePathIndex
,
MoveOutIndex
};
use
crate
::
util
::
borrowck_errors
::{
BorrowckErrors
,
Origin
};
#[derive(Debug)]
...
...
src/librustc_mir/borrow_check/flows.rs
浏览文件 @
9eb6f32d
...
...
@@ -11,7 +11,7 @@
use
polonius_engine
::
Output
;
use
crate
::
dataflow
::
move_paths
::
indexes
::
BorrowIndex
;
use
crate
::
dataflow
::
indexes
::
BorrowIndex
;
use
crate
::
dataflow
::
move_paths
::
HasMoveData
;
use
crate
::
dataflow
::
Borrows
;
use
crate
::
dataflow
::
EverInitializedPlaces
;
...
...
src/librustc_mir/borrow_check/nll/facts.rs
浏览文件 @
9eb6f32d
...
...
@@ -72,18 +72,6 @@ fn index(self) -> usize {
}
}
impl
From
<
usize
>
for
BorrowIndex
{
fn
from
(
i
:
usize
)
->
BorrowIndex
{
BorrowIndex
::
new
(
i
)
}
}
impl
From
<
BorrowIndex
>
for
usize
{
fn
from
(
vid
:
BorrowIndex
)
->
usize
{
Idx
::
index
(
vid
)
}
}
impl
Atom
for
LocationIndex
{
fn
index
(
self
)
->
usize
{
Idx
::
index
(
self
)
...
...
src/librustc_mir/borrow_check/nll/invalidation.rs
浏览文件 @
9eb6f32d
...
...
@@ -9,7 +9,7 @@
use
crate
::
borrow_check
::{
ReadKind
,
WriteKind
};
use
crate
::
borrow_check
::
nll
::
facts
::
AllFacts
;
use
crate
::
borrow_check
::
path_utils
::
*
;
use
crate
::
dataflow
::
move_paths
::
indexes
::
BorrowIndex
;
use
crate
::
dataflow
::
indexes
::
BorrowIndex
;
use
rustc
::
ty
::
TyCtxt
;
use
rustc
::
mir
::
visit
::
Visitor
;
use
rustc
::
mir
::{
BasicBlock
,
Location
,
Mir
,
Place
,
PlaceBase
,
Rvalue
};
...
...
src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs
浏览文件 @
9eb6f32d
...
...
@@ -3,7 +3,7 @@
use
crate
::
borrow_check
::
nll
::
type_check
::
liveness
::
local_use_map
::
LocalUseMap
;
use
crate
::
borrow_check
::
nll
::
type_check
::
NormalizeLocation
;
use
crate
::
borrow_check
::
nll
::
type_check
::
TypeChecker
;
use
crate
::
dataflow
::
move_paths
::
indexes
::
MovePathIndex
;
use
crate
::
dataflow
::
indexes
::
MovePathIndex
;
use
crate
::
dataflow
::
move_paths
::
MoveData
;
use
crate
::
dataflow
::{
FlowAtLocation
,
FlowsAtLocation
,
MaybeInitializedPlaces
};
use
rustc
::
infer
::
canonical
::
QueryRegionConstraint
;
...
...
src/librustc_mir/dataflow/impls/borrows.rs
浏览文件 @
9eb6f32d
...
...
@@ -10,13 +10,18 @@
use
rustc_data_structures
::
indexed_vec
::{
Idx
,
IndexVec
};
use
crate
::
dataflow
::{
BitDenotation
,
BlockSets
,
InitialFlow
};
pub
use
crate
::
dataflow
::
indexes
::
BorrowIndex
;
use
crate
::
borrow_check
::
nll
::
region_infer
::
RegionInferenceContext
;
use
crate
::
borrow_check
::
nll
::
ToRegionVid
;
use
crate
::
borrow_check
::
places_conflict
;
use
std
::
rc
::
Rc
;
newtype_index!
{
pub
struct
BorrowIndex
{
DEBUG_FORMAT
=
"bw{}"
}
}
/// `Borrows` stores the data used in the analyses that track the flow
/// of borrows.
///
...
...
src/librustc_mir/dataflow/mod.rs
浏览文件 @
9eb6f32d
...
...
@@ -33,7 +33,12 @@
mod
impls
;
pub
mod
move_paths
;
pub
(
crate
)
use
self
::
move_paths
::
indexes
;
pub
(
crate
)
mod
indexes
{
pub
(
crate
)
use
super
::{
move_paths
::{
MovePathIndex
,
MoveOutIndex
,
InitIndex
},
impls
::
borrows
::
BorrowIndex
,
};
}
pub
(
crate
)
struct
DataflowBuilder
<
'a
,
'tcx
:
'a
,
BD
>
where
...
...
src/librustc_mir/dataflow/move_paths/mod.rs
浏览文件 @
9eb6f32d
use
rustc
::
ty
::{
self
,
TyCtxt
};
use
rustc
::
mir
::
*
;
use
rustc
::
util
::
nodemap
::
FxHashMap
;
use
rustc_data_structures
::
indexed_vec
::{
IndexVec
};
use
rustc_data_structures
::
indexed_vec
::{
I
dx
,
I
ndexVec
};
use
smallvec
::
SmallVec
;
use
syntax_pos
::{
Span
};
...
...
@@ -12,66 +12,23 @@
mod
abs_domain
;
// This submodule holds some newtype'd Index wrappers that are using
// NonZero to ensure that Option<Index> occupies only a single word.
// They are in a submodule to impose privacy restrictions; namely, to
// ensure that other code does not accidentally access `index.0`
// (which is likely to yield a subtle off-by-one error).
pub
(
crate
)
mod
indexes
{
use
std
::
fmt
;
use
std
::
num
::
NonZeroUsize
;
use
rustc_data_structures
::
indexed_vec
::
Idx
;
macro_rules!
new_index
{
(
$
(
#[
$
attrs:meta]
)
*
$Index:ident
,
$debug_name:expr
)
=>
{
#[derive(Copy,
Clone,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord)]
pub
struct
$Index
(
NonZeroUsize
);
impl
Idx
for
$Index
{
fn
new
(
idx
:
usize
)
->
Self
{
$Index
(
NonZeroUsize
::
new
(
idx
+
1
)
.unwrap
())
}
fn
index
(
self
)
->
usize
{
self
.0
.get
()
-
1
}
}
impl
fmt
::
Debug
for
$Index
{
fn
fmt
(
&
self
,
fmt
:
&
mut
fmt
::
Formatter
<
'_
>
)
->
fmt
::
Result
{
write!
(
fmt
,
"{}{}"
,
$debug_name
,
self
.index
())
}
}
}
newtype_index!
{
pub
struct
MovePathIndex
{
DEBUG_FORMAT
=
"mp{}"
}
}
new_index!
(
/// Index into MovePathData.move_paths
MovePathIndex
,
"mp"
);
new_index!
(
/// Index into MoveData.moves.
MoveOutIndex
,
"mo"
);
new_index!
(
/// Index into MoveData.inits.
InitIndex
,
"in"
);
new_index!
(
/// Index into Borrows.locations
BorrowIndex
,
"bw"
);
newtype_index!
{
pub
struct
MoveOutIndex
{
DEBUG_FORMAT
=
"mo{}"
}
}
pub
use
self
::
indexes
::
MovePathIndex
;
pub
use
self
::
indexes
::
MoveOutIndex
;
pub
use
self
::
indexes
::
InitIndex
;
newtype_index!
{
pub
struct
InitIndex
{
DEBUG_FORMAT
=
"in{}"
}
}
impl
MoveOutIndex
{
pub
fn
move_path_index
(
&
self
,
move_data
:
&
MoveData
<
'_
>
)
->
MovePathIndex
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录