Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
6c539724
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,发现更多精彩内容 >>
提交
6c539724
编写于
5月 29, 2018
作者:
E
Eduard-Mihai Burtescu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rustc: turn mir::LocalDecl's visibility_source_info into a SourceScope.
上级
3da186b6
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
44 addition
and
55 deletion
+44
-55
src/librustc/ich/impls_mir.rs
src/librustc/ich/impls_mir.rs
+1
-1
src/librustc/mir/mod.rs
src/librustc/mir/mod.rs
+10
-19
src/librustc/mir/visit.rs
src/librustc/mir/visit.rs
+2
-2
src/librustc_codegen_llvm/debuginfo/create_scope_map.rs
src/librustc_codegen_llvm/debuginfo/create_scope_map.rs
+1
-1
src/librustc_codegen_llvm/mir/mod.rs
src/librustc_codegen_llvm/mir/mod.rs
+5
-2
src/librustc_mir/borrow_check/error_reporting.rs
src/librustc_mir/borrow_check/error_reporting.rs
+1
-1
src/librustc_mir/borrow_check/mod.rs
src/librustc_mir/borrow_check/mod.rs
+3
-3
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/nll/type_check/mod.rs
src/librustc_mir/borrow_check/nll/type_check/mod.rs
+1
-1
src/librustc_mir/build/expr/into.rs
src/librustc_mir/build/expr/into.rs
+1
-1
src/librustc_mir/build/matches/mod.rs
src/librustc_mir/build/matches/mod.rs
+7
-10
src/librustc_mir/build/mod.rs
src/librustc_mir/build/mod.rs
+1
-1
src/librustc_mir/dataflow/move_paths/builder.rs
src/librustc_mir/dataflow/move_paths/builder.rs
+1
-1
src/librustc_mir/shim.rs
src/librustc_mir/shim.rs
+1
-1
src/librustc_mir/transform/generator.rs
src/librustc_mir/transform/generator.rs
+3
-3
src/librustc_mir/transform/inline.rs
src/librustc_mir/transform/inline.rs
+1
-3
src/librustc_mir/transform/promote_consts.rs
src/librustc_mir/transform/promote_consts.rs
+2
-2
src/librustc_mir/transform/qualify_consts.rs
src/librustc_mir/transform/qualify_consts.rs
+2
-2
未找到文件。
src/librustc/ich/impls_mir.rs
浏览文件 @
6c539724
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
ty
,
ty
,
name
,
name
,
syntactic_source_info
,
syntactic_source_info
,
visibility_s
ource_info
,
visibility_s
cope
,
internal
,
internal
,
is_user_variable
is_user_variable
});
});
...
...
src/librustc/mir/mod.rs
浏览文件 @
6c539724
...
@@ -558,7 +558,7 @@ pub struct LocalDecl<'tcx> {
...
@@ -558,7 +558,7 @@ pub struct LocalDecl<'tcx> {
/// To allow both uses to work, we need to have more than a single scope
/// To allow both uses to work, we need to have more than a single scope
/// for a local. We have the `syntactic_source_info.scope` represent the
/// for a local. We have the `syntactic_source_info.scope` represent the
/// "syntactic" lint scope (with a variable being under its let
/// "syntactic" lint scope (with a variable being under its let
/// block) while the `visibility_s
ource_info.s
cope` represents the "local variable"
/// block) while the `visibility_scope` represents the "local variable"
/// scope (where the "rest" of a block is under all prior let-statements).
/// scope (where the "rest" of a block is under all prior let-statements).
///
///
/// The end result looks like this:
/// The end result looks like this:
...
@@ -577,18 +577,18 @@ pub struct LocalDecl<'tcx> {
...
@@ -577,18 +577,18 @@ pub struct LocalDecl<'tcx> {
/// │ │
/// │ │
/// │ │ │{ let y: u32 }
/// │ │ │{ let y: u32 }
/// │ │ │
/// │ │ │
/// │ │ │← y.visibility_s
ource_info.s
cope
/// │ │ │← y.visibility_scope
/// │ │ │← `y + 2`
/// │ │ │← `y + 2`
/// │
/// │
/// │ │{ let x: u32 }
/// │ │{ let x: u32 }
/// │ │← x.visibility_s
ource_info.s
cope
/// │ │← x.visibility_scope
/// │ │← `drop(x)` // this accesses `x: u32`
/// │ │← `drop(x)` // this accesses `x: u32`
/// ```
/// ```
pub
syntactic_source_info
:
SourceInfo
,
pub
syntactic_source_info
:
SourceInfo
,
/// Source
info of the local. The `SourceScope` is the *visibility* one,
/// Source
scope within which the local is visible (for debuginfo)
///
not the the *syntactic* one
(see `syntactic_source_info` for more details).
/// (see `syntactic_source_info` for more details).
pub
visibility_s
ource_info
:
SourceInfo
,
pub
visibility_s
cope
:
SourceScope
,
}
}
impl
<
'tcx
>
LocalDecl
<
'tcx
>
{
impl
<
'tcx
>
LocalDecl
<
'tcx
>
{
...
@@ -603,10 +603,7 @@ pub fn new_temp(ty: Ty<'tcx>, span: Span) -> Self {
...
@@ -603,10 +603,7 @@ pub fn new_temp(ty: Ty<'tcx>, span: Span) -> Self {
span
,
span
,
scope
:
OUTERMOST_SOURCE_SCOPE
scope
:
OUTERMOST_SOURCE_SCOPE
},
},
visibility_source_info
:
SourceInfo
{
visibility_scope
:
OUTERMOST_SOURCE_SCOPE
,
span
,
scope
:
OUTERMOST_SOURCE_SCOPE
},
internal
:
false
,
internal
:
false
,
is_user_variable
:
false
is_user_variable
:
false
}
}
...
@@ -623,10 +620,7 @@ pub fn new_internal(ty: Ty<'tcx>, span: Span) -> Self {
...
@@ -623,10 +620,7 @@ pub fn new_internal(ty: Ty<'tcx>, span: Span) -> Self {
span
,
span
,
scope
:
OUTERMOST_SOURCE_SCOPE
scope
:
OUTERMOST_SOURCE_SCOPE
},
},
visibility_source_info
:
SourceInfo
{
visibility_scope
:
OUTERMOST_SOURCE_SCOPE
,
span
,
scope
:
OUTERMOST_SOURCE_SCOPE
},
internal
:
true
,
internal
:
true
,
is_user_variable
:
false
is_user_variable
:
false
}
}
...
@@ -644,10 +638,7 @@ pub fn new_return_place(return_ty: Ty, span: Span) -> LocalDecl {
...
@@ -644,10 +638,7 @@ pub fn new_return_place(return_ty: Ty, span: Span) -> LocalDecl {
span
,
span
,
scope
:
OUTERMOST_SOURCE_SCOPE
scope
:
OUTERMOST_SOURCE_SCOPE
},
},
visibility_source_info
:
SourceInfo
{
visibility_scope
:
OUTERMOST_SOURCE_SCOPE
,
span
,
scope
:
OUTERMOST_SOURCE_SCOPE
},
internal
:
false
,
internal
:
false
,
name
:
None
,
// FIXME maybe we do want some name here?
name
:
None
,
// FIXME maybe we do want some name here?
is_user_variable
:
false
is_user_variable
:
false
...
@@ -2201,7 +2192,7 @@ impl<'tcx> TypeFoldable<'tcx> for LocalDecl<'tcx> {
...
@@ -2201,7 +2192,7 @@ impl<'tcx> TypeFoldable<'tcx> for LocalDecl<'tcx> {
ty
,
ty
,
name
,
name
,
syntactic_source_info
,
syntactic_source_info
,
visibility_s
ource_info
,
visibility_s
cope
,
}
}
}
}
...
...
src/librustc/mir/visit.rs
浏览文件 @
6c539724
...
@@ -715,7 +715,7 @@ fn super_local_decl(&mut self,
...
@@ -715,7 +715,7 @@ fn super_local_decl(&mut self,
ref
$
(
$mutability
)
*
ty
,
ref
$
(
$mutability
)
*
ty
,
name
:
_
,
name
:
_
,
ref
$
(
$mutability
)
*
syntactic_source_info
,
ref
$
(
$mutability
)
*
syntactic_source_info
,
ref
$
(
$mutability
)
*
visibility_s
ource_info
,
ref
$
(
$mutability
)
*
visibility_s
cope
,
internal
:
_
,
internal
:
_
,
is_user_variable
:
_
,
is_user_variable
:
_
,
}
=
*
local_decl
;
}
=
*
local_decl
;
...
@@ -725,7 +725,7 @@ fn super_local_decl(&mut self,
...
@@ -725,7 +725,7 @@ fn super_local_decl(&mut self,
source_info
:
*
syntactic_source_info
,
source_info
:
*
syntactic_source_info
,
});
});
self
.visit_source_info
(
syntactic_source_info
);
self
.visit_source_info
(
syntactic_source_info
);
self
.visit_source_
info
(
visibility_source_info
);
self
.visit_source_
scope
(
visibility_scope
);
}
}
fn
super_source_scope
(
&
mut
self
,
fn
super_source_scope
(
&
mut
self
,
...
...
src/librustc_codegen_llvm/debuginfo/create_scope_map.rs
浏览文件 @
6c539724
...
@@ -65,7 +65,7 @@ pub fn create_mir_scopes(cx: &CodegenCx, mir: &Mir, debug_context: &FunctionDebu
...
@@ -65,7 +65,7 @@ pub fn create_mir_scopes(cx: &CodegenCx, mir: &Mir, debug_context: &FunctionDebu
let
mut
has_variables
=
BitVector
::
new
(
mir
.source_scopes
.len
());
let
mut
has_variables
=
BitVector
::
new
(
mir
.source_scopes
.len
());
for
var
in
mir
.vars_iter
()
{
for
var
in
mir
.vars_iter
()
{
let
decl
=
&
mir
.local_decls
[
var
];
let
decl
=
&
mir
.local_decls
[
var
];
has_variables
.insert
(
decl
.visibility_s
ource_info.s
cope
.index
());
has_variables
.insert
(
decl
.visibility_scope
.index
());
}
}
// Instantiate all scopes.
// Instantiate all scopes.
...
...
src/librustc_codegen_llvm/mir/mod.rs
浏览文件 @
6c539724
...
@@ -265,7 +265,7 @@ pub fn codegen_mir<'a, 'tcx: 'a>(
...
@@ -265,7 +265,7 @@ pub fn codegen_mir<'a, 'tcx: 'a>(
if
let
Some
(
name
)
=
decl
.name
{
if
let
Some
(
name
)
=
decl
.name
{
// User variable
// User variable
let
debug_scope
=
fx
.scopes
[
decl
.visibility_s
ource_info.s
cope
];
let
debug_scope
=
fx
.scopes
[
decl
.visibility_scope
];
let
dbg
=
debug_scope
.is_valid
()
&&
bx
.sess
()
.opts.debuginfo
==
FullDebugInfo
;
let
dbg
=
debug_scope
.is_valid
()
&&
bx
.sess
()
.opts.debuginfo
==
FullDebugInfo
;
if
!
memory_locals
.contains
(
local
.index
())
&&
!
dbg
{
if
!
memory_locals
.contains
(
local
.index
())
&&
!
dbg
{
...
@@ -276,7 +276,10 @@ pub fn codegen_mir<'a, 'tcx: 'a>(
...
@@ -276,7 +276,10 @@ pub fn codegen_mir<'a, 'tcx: 'a>(
debug!
(
"alloc: {:?} ({}) -> place"
,
local
,
name
);
debug!
(
"alloc: {:?} ({}) -> place"
,
local
,
name
);
let
place
=
PlaceRef
::
alloca
(
&
bx
,
layout
,
&
name
.as_str
());
let
place
=
PlaceRef
::
alloca
(
&
bx
,
layout
,
&
name
.as_str
());
if
dbg
{
if
dbg
{
let
(
scope
,
span
)
=
fx
.debug_loc
(
decl
.visibility_source_info
);
let
(
scope
,
span
)
=
fx
.debug_loc
(
mir
::
SourceInfo
{
span
:
decl
.syntactic_source_info.span
,
scope
:
decl
.visibility_scope
,
});
declare_local
(
&
bx
,
&
fx
.debug_context
,
name
,
layout
.ty
,
scope
,
declare_local
(
&
bx
,
&
fx
.debug_context
,
name
,
layout
.ty
,
scope
,
VariableAccess
::
DirectVariable
{
alloca
:
place
.llval
},
VariableAccess
::
DirectVariable
{
alloca
:
place
.llval
},
VariableKind
::
LocalVariable
,
span
);
VariableKind
::
LocalVariable
,
span
);
...
...
src/librustc_mir/borrow_check/error_reporting.rs
浏览文件 @
6c539724
...
@@ -398,7 +398,7 @@ pub(super) fn report_borrowed_value_does_not_live_long_enough(
...
@@ -398,7 +398,7 @@ pub(super) fn report_borrowed_value_does_not_live_long_enough(
let
borrow_span
=
self
.mir
.source_info
(
borrow
.reserve_location
)
.span
;
let
borrow_span
=
self
.mir
.source_info
(
borrow
.reserve_location
)
.span
;
let
proper_span
=
match
*
root_place
{
let
proper_span
=
match
*
root_place
{
Place
::
Local
(
local
)
=>
self
.mir.local_decls
[
local
]
.
visibility
_source_info.span
,
Place
::
Local
(
local
)
=>
self
.mir.local_decls
[
local
]
.
syntactic
_source_info.span
,
_
=>
drop_span
,
_
=>
drop_span
,
};
};
...
...
src/librustc_mir/borrow_check/mod.rs
浏览文件 @
6c539724
...
@@ -306,13 +306,13 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
...
@@ -306,13 +306,13 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
None
=>
continue
,
None
=>
continue
,
}
}
let
s
ource_info
=
local_decl
.visibility_source_info
;
let
s
pan
=
local_decl
.syntactic_source_info.span
;
let
mut_span
=
tcx
.sess
.codemap
()
.span_until_non_whitespace
(
s
ource_info
.s
pan
);
let
mut_span
=
tcx
.sess
.codemap
()
.span_until_non_whitespace
(
span
);
tcx
.struct_span_lint_node
(
tcx
.struct_span_lint_node
(
UNUSED_MUT
,
UNUSED_MUT
,
vsi
[
local_decl
.syntactic_source_info.scope
]
.lint_root
,
vsi
[
local_decl
.syntactic_source_info.scope
]
.lint_root
,
s
ource_info
.s
pan
,
span
,
"variable does not need to be mutable"
"variable does not need to be mutable"
)
)
.span_suggestion_short
(
mut_span
,
"remove this `mut`"
,
""
.to_owned
())
.span_suggestion_short
(
mut_span
,
"remove this `mut`"
,
""
.to_owned
())
...
...
src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs
浏览文件 @
6c539724
...
@@ -67,7 +67,7 @@ pub(in borrow_check) fn explain_why_borrow_contains_point(
...
@@ -67,7 +67,7 @@ pub(in borrow_check) fn explain_why_borrow_contains_point(
}
}
None
=>
{
None
=>
{
err
.span_label
(
err
.span_label
(
mir
.local_decls
[
local
]
.
visibility
_source_info.span
,
mir
.local_decls
[
local
]
.
syntactic
_source_info.span
,
"borrow may end up in a temporary, created here"
,
"borrow may end up in a temporary, created here"
,
);
);
...
...
src/librustc_mir/borrow_check/nll/type_check/mod.rs
浏览文件 @
6c539724
...
@@ -1201,7 +1201,7 @@ fn check_local(&mut self, mir: &Mir<'tcx>, local: Local, local_decl: &LocalDecl<
...
@@ -1201,7 +1201,7 @@ fn check_local(&mut self, mir: &Mir<'tcx>, local: Local, local_decl: &LocalDecl<
LocalKind
::
Var
|
LocalKind
::
Temp
=>
{}
LocalKind
::
Var
|
LocalKind
::
Temp
=>
{}
}
}
let
span
=
local_decl
.
visibility
_source_info.span
;
let
span
=
local_decl
.
syntactic
_source_info.span
;
let
ty
=
local_decl
.ty
;
let
ty
=
local_decl
.ty
;
// Erase the regions from `ty` to get a global type. The
// Erase the regions from `ty` to get a global type. The
...
...
src/librustc_mir/build/expr/into.rs
浏览文件 @
6c539724
...
@@ -247,7 +247,7 @@ pub fn into_expr(&mut self,
...
@@ -247,7 +247,7 @@ pub fn into_expr(&mut self,
ty
:
ptr_ty
,
ty
:
ptr_ty
,
name
:
None
,
name
:
None
,
syntactic_source_info
:
source_info
,
syntactic_source_info
:
source_info
,
visibility_s
ource_info
:
source_info
,
visibility_s
cope
:
source_info
.scope
,
internal
:
true
,
internal
:
true
,
is_user_variable
:
false
is_user_variable
:
false
});
});
...
...
src/librustc_mir/build/matches/mod.rs
浏览文件 @
6c539724
...
@@ -324,11 +324,8 @@ pub fn declare_bindings(&mut self,
...
@@ -324,11 +324,8 @@ pub fn declare_bindings(&mut self,
span
,
span
,
scope
:
syntactic_scope
,
scope
:
syntactic_scope
,
};
};
let
visibility_source_info
=
SourceInfo
{
let
visibility_scope
=
visibility_scope
.unwrap
();
span
,
this
.declare_binding
(
syntactic_source_info
,
visibility_scope
,
mutability
,
name
,
var
,
scope
:
visibility_scope
.unwrap
()
};
this
.declare_binding
(
syntactic_source_info
,
visibility_source_info
,
mutability
,
name
,
var
,
ty
,
has_guard
);
ty
,
has_guard
);
});
});
visibility_scope
visibility_scope
...
@@ -1118,16 +1115,16 @@ fn bind_matched_candidate_for_arm_body(&mut self,
...
@@ -1118,16 +1115,16 @@ fn bind_matched_candidate_for_arm_body(&mut self,
/// in the arm body, which will have type `T`.
/// in the arm body, which will have type `T`.
fn
declare_binding
(
&
mut
self
,
fn
declare_binding
(
&
mut
self
,
syntactic_source_info
:
SourceInfo
,
syntactic_source_info
:
SourceInfo
,
visibility_s
ource_info
:
SourceInfo
,
visibility_s
cope
:
SourceScope
,
mutability
:
Mutability
,
mutability
:
Mutability
,
name
:
Name
,
name
:
Name
,
var_id
:
NodeId
,
var_id
:
NodeId
,
var_ty
:
Ty
<
'tcx
>
,
var_ty
:
Ty
<
'tcx
>
,
has_guard
:
ArmHasGuard
)
has_guard
:
ArmHasGuard
)
{
{
debug!
(
"declare_binding(var_id={:?}, name={:?}, var_ty={:?}, visibility_s
ource_info
={:?},
\
debug!
(
"declare_binding(var_id={:?}, name={:?}, var_ty={:?}, visibility_s
cope
={:?},
\
syntactic_source_info={:?})"
,
syntactic_source_info={:?})"
,
var_id
,
name
,
var_ty
,
visibility_s
ource_info
,
syntactic_source_info
);
var_id
,
name
,
var_ty
,
visibility_s
cope
,
syntactic_source_info
);
let
tcx
=
self
.hir
.tcx
();
let
tcx
=
self
.hir
.tcx
();
let
local
=
LocalDecl
::
<
'tcx
>
{
let
local
=
LocalDecl
::
<
'tcx
>
{
...
@@ -1135,7 +1132,7 @@ fn declare_binding(&mut self,
...
@@ -1135,7 +1132,7 @@ fn declare_binding(&mut self,
ty
:
var_ty
.clone
(),
ty
:
var_ty
.clone
(),
name
:
Some
(
name
),
name
:
Some
(
name
),
syntactic_source_info
,
syntactic_source_info
,
visibility_s
ource_info
,
visibility_s
cope
,
internal
:
false
,
internal
:
false
,
is_user_variable
:
true
,
is_user_variable
:
true
,
};
};
...
@@ -1147,7 +1144,7 @@ fn declare_binding(&mut self,
...
@@ -1147,7 +1144,7 @@ fn declare_binding(&mut self,
ty
:
tcx
.mk_imm_ref
(
tcx
.types.re_empty
,
var_ty
),
ty
:
tcx
.mk_imm_ref
(
tcx
.types.re_empty
,
var_ty
),
name
:
Some
(
name
),
name
:
Some
(
name
),
syntactic_source_info
,
syntactic_source_info
,
visibility_s
ource_info
,
visibility_s
cope
,
internal
:
false
,
internal
:
false
,
is_user_variable
:
true
,
is_user_variable
:
true
,
});
});
...
...
src/librustc_mir/build/mod.rs
浏览文件 @
6c539724
...
@@ -665,7 +665,7 @@ fn args_and_body(&mut self,
...
@@ -665,7 +665,7 @@ fn args_and_body(&mut self,
mutability
:
Mutability
::
Mut
,
mutability
:
Mutability
::
Mut
,
ty
,
ty
,
syntactic_source_info
:
source_info
,
syntactic_source_info
:
source_info
,
visibility_s
ource_info
:
source_info
,
visibility_s
cope
:
source_info
.scope
,
name
,
name
,
internal
:
false
,
internal
:
false
,
is_user_variable
:
false
,
is_user_variable
:
false
,
...
...
src/librustc_mir/dataflow/move_paths/builder.rs
浏览文件 @
6c539724
...
@@ -233,7 +233,7 @@ impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> {
...
@@ -233,7 +233,7 @@ impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> {
fn
gather_args
(
&
mut
self
)
{
fn
gather_args
(
&
mut
self
)
{
for
arg
in
self
.mir
.args_iter
()
{
for
arg
in
self
.mir
.args_iter
()
{
let
path
=
self
.data.rev_lookup.locals
[
arg
];
let
path
=
self
.data.rev_lookup.locals
[
arg
];
let
span
=
self
.mir.local_decls
[
arg
]
.
visibility
_source_info.span
;
let
span
=
self
.mir.local_decls
[
arg
]
.
syntactic
_source_info.span
;
let
init
=
self
.data.inits
.push
(
Init
{
let
init
=
self
.data.inits
.push
(
Init
{
path
,
span
,
kind
:
InitKind
::
Deep
path
,
span
,
kind
:
InitKind
::
Deep
...
...
src/librustc_mir/shim.rs
浏览文件 @
6c539724
...
@@ -142,7 +142,7 @@ fn temp_decl(mutability: Mutability, ty: Ty, span: Span) -> LocalDecl {
...
@@ -142,7 +142,7 @@ fn temp_decl(mutability: Mutability, ty: Ty, span: Span) -> LocalDecl {
LocalDecl
{
LocalDecl
{
mutability
,
ty
,
name
:
None
,
mutability
,
ty
,
name
:
None
,
syntactic_source_info
:
source_info
,
syntactic_source_info
:
source_info
,
visibility_s
ource_info
:
source_info
,
visibility_s
cope
:
source_info
.scope
,
internal
:
false
,
internal
:
false
,
is_user_variable
:
false
is_user_variable
:
false
}
}
...
...
src/librustc_mir/transform/generator.rs
浏览文件 @
6c539724
...
@@ -301,7 +301,7 @@ fn replace_result_variable<'tcx>(ret_ty: Ty<'tcx>,
...
@@ -301,7 +301,7 @@ fn replace_result_variable<'tcx>(ret_ty: Ty<'tcx>,
ty
:
ret_ty
,
ty
:
ret_ty
,
name
:
None
,
name
:
None
,
syntactic_source_info
:
source_info
,
syntactic_source_info
:
source_info
,
visibility_s
ource_info
:
source_info
,
visibility_s
cope
:
source_info
.scope
,
internal
:
false
,
internal
:
false
,
is_user_variable
:
false
,
is_user_variable
:
false
,
};
};
...
@@ -642,7 +642,7 @@ fn create_generator_drop_shim<'a, 'tcx>(
...
@@ -642,7 +642,7 @@ fn create_generator_drop_shim<'a, 'tcx>(
ty
:
tcx
.mk_nil
(),
ty
:
tcx
.mk_nil
(),
name
:
None
,
name
:
None
,
syntactic_source_info
:
source_info
,
syntactic_source_info
:
source_info
,
visibility_s
ource_info
:
source_info
,
visibility_s
cope
:
source_info
.scope
,
internal
:
false
,
internal
:
false
,
is_user_variable
:
false
,
is_user_variable
:
false
,
};
};
...
@@ -658,7 +658,7 @@ fn create_generator_drop_shim<'a, 'tcx>(
...
@@ -658,7 +658,7 @@ fn create_generator_drop_shim<'a, 'tcx>(
}),
}),
name
:
None
,
name
:
None
,
syntactic_source_info
:
source_info
,
syntactic_source_info
:
source_info
,
visibility_s
ource_info
:
source_info
,
visibility_s
cope
:
source_info
.scope
,
internal
:
false
,
internal
:
false
,
is_user_variable
:
false
,
is_user_variable
:
false
,
};
};
...
...
src/librustc_mir/transform/inline.rs
浏览文件 @
6c539724
...
@@ -401,9 +401,7 @@ fn inline_call(&self,
...
@@ -401,9 +401,7 @@ fn inline_call(&self,
local
.syntactic_source_info.scope
=
local
.syntactic_source_info.scope
=
scope_map
[
local
.syntactic_source_info.scope
];
scope_map
[
local
.syntactic_source_info.scope
];
local
.syntactic_source_info.span
=
callsite
.location.span
;
local
.syntactic_source_info.span
=
callsite
.location.span
;
local
.visibility_source_info.scope
=
local
.visibility_scope
=
scope_map
[
local
.visibility_scope
];
scope_map
[
local
.visibility_source_info.scope
];
local
.visibility_source_info.span
=
callsite
.location.span
;
let
idx
=
caller_mir
.local_decls
.push
(
local
);
let
idx
=
caller_mir
.local_decls
.push
(
local
);
local_map
.push
(
idx
);
local_map
.push
(
idx
);
...
...
src/librustc_mir/transform/promote_consts.rs
浏览文件 @
6c539724
...
@@ -210,7 +210,7 @@ fn promote_temp(&mut self, temp: Local) -> Local {
...
@@ -210,7 +210,7 @@ fn promote_temp(&mut self, temp: Local) -> Local {
let
no_stmts
=
self
.source
[
loc
.block
]
.statements
.len
();
let
no_stmts
=
self
.source
[
loc
.block
]
.statements
.len
();
let
new_temp
=
self
.promoted.local_decls
.push
(
let
new_temp
=
self
.promoted.local_decls
.push
(
LocalDecl
::
new_temp
(
self
.source.local_decls
[
temp
]
.ty
,
LocalDecl
::
new_temp
(
self
.source.local_decls
[
temp
]
.ty
,
self
.source.local_decls
[
temp
]
.
visibility
_source_info.span
));
self
.source.local_decls
[
temp
]
.
syntactic
_source_info.span
));
debug!
(
"promote({:?} @ {:?}/{:?}, {:?})"
,
debug!
(
"promote({:?} @ {:?}/{:?}, {:?})"
,
temp
,
loc
,
no_stmts
,
self
.keep_original
);
temp
,
loc
,
no_stmts
,
self
.keep_original
);
...
@@ -335,7 +335,7 @@ fn interior_base<'a, 'tcx>(place: &'a mut Place<'tcx>)
...
@@ -335,7 +335,7 @@ fn interior_base<'a, 'tcx>(place: &'a mut Place<'tcx>)
// otherwise we would use the `promoted` directly.
// otherwise we would use the `promoted` directly.
let
mut
promoted_ref
=
LocalDecl
::
new_temp
(
ref_ty
,
span
);
let
mut
promoted_ref
=
LocalDecl
::
new_temp
(
ref_ty
,
span
);
promoted_ref
.syntactic_source_info
=
statement
.source_info
;
promoted_ref
.syntactic_source_info
=
statement
.source_info
;
promoted_ref
.visibility_s
ource_info
=
statement
.source_info
;
promoted_ref
.visibility_s
cope
=
statement
.source_info.scope
;
let
promoted_ref
=
local_decls
.push
(
promoted_ref
);
let
promoted_ref
=
local_decls
.push
(
promoted_ref
);
assert_eq!
(
self
.temps
.push
(
TempState
::
Unpromotable
),
promoted_ref
);
assert_eq!
(
self
.temps
.push
(
TempState
::
Unpromotable
),
promoted_ref
);
self
.extra_statements
.push
((
loc
,
Statement
{
self
.extra_statements
.push
((
loc
,
Statement
{
...
...
src/librustc_mir/transform/qualify_consts.rs
浏览文件 @
6c539724
...
@@ -1046,7 +1046,7 @@ fn visit_terminator_kind(&mut self,
...
@@ -1046,7 +1046,7 @@ fn visit_terminator_kind(&mut self,
// conservatively, that drop elaboration will do.
// conservatively, that drop elaboration will do.
let
needs_drop
=
if
let
Place
::
Local
(
local
)
=
*
place
{
let
needs_drop
=
if
let
Place
::
Local
(
local
)
=
*
place
{
if
self
.local_qualif
[
local
]
.map_or
(
true
,
|
q
|
q
.intersects
(
Qualif
::
NEEDS_DROP
))
{
if
self
.local_qualif
[
local
]
.map_or
(
true
,
|
q
|
q
.intersects
(
Qualif
::
NEEDS_DROP
))
{
Some
(
self
.mir.local_decls
[
local
]
.
visibility
_source_info.span
)
Some
(
self
.mir.local_decls
[
local
]
.
syntactic
_source_info.span
)
}
else
{
}
else
{
None
None
}
}
...
@@ -1102,7 +1102,7 @@ fn visit_assign(&mut self,
...
@@ -1102,7 +1102,7 @@ fn visit_assign(&mut self,
let
mut
err
=
feature_err
(
let
mut
err
=
feature_err
(
&
self
.tcx.sess.parse_sess
,
&
self
.tcx.sess.parse_sess
,
"const_let"
,
"const_let"
,
decl
.
visibility
_source_info.span
,
decl
.
syntactic
_source_info.span
,
GateIssue
::
Language
,
GateIssue
::
Language
,
"arguments of constant functions can only be immutable by-value bindings"
"arguments of constant functions can only be immutable by-value bindings"
);
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录