Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
67560976
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,发现更多精彩内容 >>
提交
67560976
编写于
11月 27, 2019
作者:
M
Mark Mansi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix imports
上级
07a04862
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
33 addition
and
27 deletion
+33
-27
src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs
src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs
+20
-17
src/librustc_mir/borrow_check/diagnostics/mod.rs
src/librustc_mir/borrow_check/diagnostics/mod.rs
+6
-0
src/librustc_mir/borrow_check/diagnostics/move_errors.rs
src/librustc_mir/borrow_check/diagnostics/move_errors.rs
+1
-1
src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs
...ibrustc_mir/borrow_check/diagnostics/mutability_errors.rs
+3
-3
src/librustc_mir/borrow_check/mod.rs
src/librustc_mir/borrow_check/mod.rs
+2
-5
src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs
src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs
+1
-1
未找到文件。
src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs
浏览文件 @
67560976
...
...
@@ -14,18 +14,21 @@
use
syntax_pos
::
Span
;
use
syntax
::
source_map
::
DesugaringKind
;
use
super
::
nll
::
explain_borrow
::
BorrowExplanation
;
use
super
::
nll
::
region_infer
::{
RegionName
,
RegionNameSource
};
use
super
::
prefixes
::
IsPrefixOf
;
use
super
::
WriteKind
;
use
super
::
borrow_set
::
BorrowData
;
use
super
::
MirBorrowckCtxt
;
use
super
::{
InitializationRequiringAction
,
PrefixSet
};
use
super
::
error_reporting
::{
IncludingDowncast
,
UseSpans
};
use
crate
::
dataflow
::
drop_flag_effects
;
use
crate
::
dataflow
::
indexes
::{
MovePathIndex
,
MoveOutIndex
};
use
crate
::
util
::
borrowck_errors
;
use
crate
::
borrow_check
::{
nll
::
explain_borrow
::
BorrowExplanation
,
nll
::
region_infer
::{
RegionName
,
RegionNameSource
},
prefixes
::
IsPrefixOf
,
WriteKind
,
borrow_set
::
BorrowData
,
MirBorrowckCtxt
,
InitializationRequiringAction
,
PrefixSet
};
use
super
::{
IncludingDowncast
,
UseSpans
};
#[derive(Debug)]
struct
MoveSite
{
/// Index of the "move out" that we found. The `MoveData` can
...
...
@@ -46,7 +49,7 @@ enum StorageDeadOrDrop<'tcx> {
}
impl
<
'cx
,
'tcx
>
MirBorrowckCtxt
<
'cx
,
'tcx
>
{
pub
(
super
)
fn
report_use_of_moved_or_uninitialized
(
pub
(
in
crate
::
borrow_check
)
fn
report_use_of_moved_or_uninitialized
(
&
mut
self
,
location
:
Location
,
desired_action
:
InitializationRequiringAction
,
...
...
@@ -269,7 +272,7 @@ pub(super) fn report_use_of_moved_or_uninitialized(
}
}
pub
(
super
)
fn
report_move_out_while_borrowed
(
pub
(
in
crate
::
borrow_check
)
fn
report_move_out_while_borrowed
(
&
mut
self
,
location
:
Location
,
(
place
,
span
):
(
&
Place
<
'tcx
>
,
Span
),
...
...
@@ -326,7 +329,7 @@ pub(super) fn report_move_out_while_borrowed(
err
.buffer
(
&
mut
self
.errors_buffer
);
}
pub
(
super
)
fn
report_use_while_mutably_borrowed
(
pub
(
in
crate
::
borrow_check
)
fn
report_use_while_mutably_borrowed
(
&
mut
self
,
location
:
Location
,
(
place
,
_
span
):
(
&
Place
<
'tcx
>
,
Span
),
...
...
@@ -368,7 +371,7 @@ pub(super) fn report_use_while_mutably_borrowed(
err
}
pub
(
super
)
fn
report_conflicting_borrow
(
pub
(
in
crate
::
borrow_check
)
fn
report_conflicting_borrow
(
&
mut
self
,
location
:
Location
,
(
place
,
span
):
(
&
Place
<
'tcx
>
,
Span
),
...
...
@@ -614,7 +617,7 @@ pub(super) fn report_conflicting_borrow(
///
/// > cannot borrow `a.u` (via `a.u.z.c`) as immutable because it is also borrowed as
/// > mutable (via `a.u.s.b`) [E0502]
pub
(
super
)
fn
describe_place_for_conflicting_borrow
(
pub
(
in
crate
::
borrow_check
)
fn
describe_place_for_conflicting_borrow
(
&
self
,
first_borrowed_place
:
&
Place
<
'tcx
>
,
second_borrowed_place
:
&
Place
<
'tcx
>
,
...
...
@@ -722,7 +725,7 @@ pub(super) fn describe_place_for_conflicting_borrow(
/// short a lifetime. (But sometimes it is more useful to report
/// it as a more direct conflict between the execution of a
/// `Drop::drop` with an aliasing borrow.)
pub
(
super
)
fn
report_borrowed_value_does_not_live_long_enough
(
pub
(
in
crate
::
borrow_check
)
fn
report_borrowed_value_does_not_live_long_enough
(
&
mut
self
,
location
:
Location
,
borrow
:
&
BorrowData
<
'tcx
>
,
...
...
@@ -1478,7 +1481,7 @@ fn get_moved_indexes(&mut self, location: Location, mpi: MovePathIndex) -> Vec<M
result
}
pub
(
super
)
fn
report_illegal_mutation_of_borrowed
(
pub
(
in
crate
::
borrow_check
)
fn
report_illegal_mutation_of_borrowed
(
&
mut
self
,
location
:
Location
,
(
place
,
span
):
(
&
Place
<
'tcx
>
,
Span
),
...
...
@@ -1537,7 +1540,7 @@ pub(super) fn report_illegal_mutation_of_borrowed(
/// assigned; `err_place` is a place providing a reason why
/// `place` is not mutable (e.g., the non-`mut` local `x` in an
/// assignment to `x.f`).
pub
(
super
)
fn
report_illegal_reassignment
(
pub
(
in
crate
::
borrow_check
)
fn
report_illegal_reassignment
(
&
mut
self
,
_
location
:
Location
,
(
place
,
span
):
(
&
Place
<
'tcx
>
,
Span
),
...
...
@@ -2080,7 +2083,7 @@ enum AnnotatedBorrowFnSignature<'tcx> {
impl
<
'tcx
>
AnnotatedBorrowFnSignature
<
'tcx
>
{
/// Annotate the provided diagnostic with information about borrow from the fn signature that
/// helps explain.
pub
(
super
)
fn
emit
(
pub
(
in
crate
::
borrow_check
)
fn
emit
(
&
self
,
cx
:
&
mut
MirBorrowckCtxt
<
'_
,
'tcx
>
,
diag
:
&
mut
DiagnosticBuilder
<
'_
>
,
...
...
src/librustc_mir/borrow_check/diagnostics/mod.rs
浏览文件 @
67560976
//! Borrow checker diagnostics.
use
rustc
::
hir
;
use
rustc
::
hir
::
def
::
Namespace
;
use
rustc
::
hir
::
def_id
::
DefId
;
...
...
@@ -17,6 +19,10 @@
use
super
::
MirBorrowckCtxt
;
use
crate
::
dataflow
::
move_paths
::{
InitLocation
,
LookupResult
};
crate
mod
conflict_errors
;
crate
mod
move_errors
;
crate
mod
mutability_errors
;
pub
(
super
)
struct
IncludingDowncast
(
pub
(
super
)
bool
);
impl
<
'cx
,
'tcx
>
MirBorrowckCtxt
<
'cx
,
'tcx
>
{
...
...
src/librustc_mir/borrow_check/diagnostics/move_errors.rs
浏览文件 @
67560976
...
...
@@ -5,7 +5,7 @@
use
crate
::
borrow_check
::
MirBorrowckCtxt
;
use
crate
::
borrow_check
::
prefixes
::
PrefixSet
;
use
crate
::
borrow_check
::
error_reporting
::
UseSpans
;
use
crate
::
borrow_check
::
diagnostics
::
UseSpans
;
use
crate
::
dataflow
::
move_paths
::{
IllegalMoveOrigin
,
IllegalMoveOriginKind
,
LookupResult
,
MoveError
,
MovePathIndex
,
...
...
src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs
浏览文件 @
67560976
...
...
@@ -8,18 +8,18 @@
use
syntax_pos
::
symbol
::
kw
;
use
crate
::
borrow_check
::
MirBorrowckCtxt
;
use
crate
::
borrow_check
::
error_reporting
::
BorrowedContentSource
;
use
crate
::
borrow_check
::
diagnostics
::
BorrowedContentSource
;
use
crate
::
util
::
collect_writes
::
FindAssignments
;
use
rustc_errors
::
Applicability
;
#[derive(Copy,
Clone,
Debug,
Eq,
PartialEq)]
pub
(
super
)
enum
AccessKind
{
pub
(
crate
)
enum
AccessKind
{
MutableBorrow
,
Mutate
,
}
impl
<
'a
,
'tcx
>
MirBorrowckCtxt
<
'a
,
'tcx
>
{
pub
(
super
)
fn
report_mutability_error
(
pub
(
crate
)
fn
report_mutability_error
(
&
mut
self
,
access_place
:
&
Place
<
'tcx
>
,
span
:
Span
,
...
...
src/librustc_mir/borrow_check/mod.rs
浏览文件 @
67560976
...
...
@@ -46,17 +46,14 @@
use
self
::
location
::
LocationTable
;
use
self
::
prefixes
::
PrefixSet
;
use
self
::
MutateMode
::{
JustWrite
,
WriteAndRead
};
use
self
::
mutability_errors
::
AccessKind
;
use
self
::
diagnostics
::
mutability_errors
::
AccessKind
;
use
self
::
path_utils
::
*
;
crate
mod
borrow_set
;
mod
error_reporting
;
mod
diagnostics
;
mod
flows
;
mod
location
;
mod
conflict_errors
;
mod
move_errors
;
mod
mutability_errors
;
mod
path_utils
;
crate
mod
place_ext
;
crate
mod
places_conflict
;
...
...
src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs
浏览文件 @
67560976
use
std
::
collections
::
VecDeque
;
use
crate
::
borrow_check
::
borrow_set
::
BorrowData
;
use
crate
::
borrow_check
::
error_reporting
::
UseSpans
;
use
crate
::
borrow_check
::
diagnostics
::
UseSpans
;
use
crate
::
borrow_check
::
nll
::
region_infer
::{
Cause
,
RegionName
};
use
crate
::
borrow_check
::
nll
::
ConstraintDescription
;
use
crate
::
borrow_check
::{
MirBorrowckCtxt
,
WriteKind
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录