Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
a8419099
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,发现更多精彩内容 >>
提交
a8419099
编写于
7月 03, 2020
作者:
B
Bastian Kauschke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
InstanceDef::Item
上级
178c6507
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
80 addition
and
58 deletion
+80
-58
src/librustc_codegen_ssa/back/symbol_export.rs
src/librustc_codegen_ssa/back/symbol_export.rs
+2
-2
src/librustc_middle/mir/mono.rs
src/librustc_middle/mir/mono.rs
+2
-2
src/librustc_middle/ty/instance.rs
src/librustc_middle/ty/instance.rs
+28
-13
src/librustc_middle/ty/mod.rs
src/librustc_middle/ty/mod.rs
+1
-1
src/librustc_middle/ty/structural_impls.rs
src/librustc_middle/ty/structural_impls.rs
+3
-2
src/librustc_mir/const_eval/eval_queries.rs
src/librustc_mir/const_eval/eval_queries.rs
+12
-12
src/librustc_mir/const_eval/machine.rs
src/librustc_mir/const_eval/machine.rs
+2
-2
src/librustc_mir/interpret/eval_context.rs
src/librustc_mir/interpret/eval_context.rs
+11
-9
src/librustc_mir/monomorphize/collector.rs
src/librustc_mir/monomorphize/collector.rs
+2
-2
src/librustc_mir/monomorphize/partitioning.rs
src/librustc_mir/monomorphize/partitioning.rs
+3
-2
src/librustc_mir/transform/check_consts/validation.rs
src/librustc_mir/transform/check_consts/validation.rs
+2
-2
src/librustc_mir/transform/mod.rs
src/librustc_mir/transform/mod.rs
+6
-6
src/librustc_mir/util/pretty.rs
src/librustc_mir/util/pretty.rs
+4
-1
src/librustc_ty/instance.rs
src/librustc_ty/instance.rs
+2
-2
未找到文件。
src/librustc_codegen_ssa/back/symbol_export.rs
浏览文件 @
a8419099
...
...
@@ -249,9 +249,9 @@ fn exported_symbols_provider_local(
}
match
*
mono_item
{
MonoItem
::
Fn
(
Instance
{
def
:
InstanceDef
::
Item
(
def
_id
),
substs
})
=>
{
MonoItem
::
Fn
(
Instance
{
def
:
InstanceDef
::
Item
(
def
),
substs
})
=>
{
if
substs
.non_erasable_generics
()
.next
()
.is_some
()
{
let
symbol
=
ExportedSymbol
::
Generic
(
def
_
id
,
substs
);
let
symbol
=
ExportedSymbol
::
Generic
(
def
.d
id
,
substs
);
symbols
.push
((
symbol
,
SymbolExportLevel
::
Rust
));
}
}
...
...
src/librustc_middle/mir/mono.rs
浏览文件 @
a8419099
...
...
@@ -346,8 +346,8 @@ fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx>, item: MonoItem<'tcx>) -> ItemSortKey {
// instances into account. The others don't matter for
// the codegen tests and can even make item order
// unstable.
InstanceDef
::
Item
(
def
_id
)
=>
{
def
_
id
.as_local
()
.map
(|
def_id
|
tcx
.hir
()
.as_local_hir_id
(
def_id
))
InstanceDef
::
Item
(
def
)
=>
{
def
.d
id
.as_local
()
.map
(|
def_id
|
tcx
.hir
()
.as_local_hir_id
(
def_id
))
}
InstanceDef
::
VtableShim
(
..
)
|
InstanceDef
::
ReifyShim
(
..
)
...
...
src/librustc_middle/ty/instance.rs
浏览文件 @
a8419099
...
...
@@ -29,7 +29,7 @@ pub enum InstanceDef<'tcx> {
/// - `fn` items
/// - closures
/// - generators
Item
(
DefId
),
Item
(
ty
::
WithOptParam
<
DefId
>
),
/// An intrinsic `fn` item (with `"rust-intrinsic"` or `"platform-intrinsic"` ABI).
///
...
...
@@ -160,8 +160,8 @@ pub fn upstream_monomorphization(&self, tcx: TyCtxt<'tcx>) -> Option<CrateNum> {
self
.substs
.non_erasable_generics
()
.next
()
?
;
match
self
.def
{
InstanceDef
::
Item
(
def
_id
)
=>
tcx
.upstream_monomorphizations_for
(
def
_
id
)
InstanceDef
::
Item
(
def
)
=>
tcx
.upstream_monomorphizations_for
(
def
.d
id
)
.and_then
(|
monos
|
monos
.get
(
&
self
.substs
)
.cloned
()),
InstanceDef
::
DropGlue
(
_
,
Some
(
_
))
=>
tcx
.upstream_drop_glue_for
(
self
.substs
),
_
=>
None
,
...
...
@@ -171,10 +171,10 @@ pub fn upstream_monomorphization(&self, tcx: TyCtxt<'tcx>) -> Option<CrateNum> {
impl
<
'tcx
>
InstanceDef
<
'tcx
>
{
#[inline]
pub
fn
def_id
(
&
self
)
->
DefId
{
match
*
self
{
InstanceDef
::
Item
(
def
_id
)
|
InstanceDef
::
VtableShim
(
def_id
)
pub
fn
def_id
(
self
)
->
DefId
{
match
self
{
InstanceDef
::
Item
(
def
)
=>
def
.did
,
InstanceDef
::
VtableShim
(
def_id
)
|
InstanceDef
::
ReifyShim
(
def_id
)
|
InstanceDef
::
FnPtrShim
(
def_id
,
_
)
|
InstanceDef
::
Virtual
(
def_id
,
_
)
...
...
@@ -185,6 +185,21 @@ pub fn def_id(&self) -> DefId {
}
}
#[inline]
pub
fn
with_opt_param
(
self
)
->
ty
::
WithOptParam
<
DefId
>
{
match
self
{
InstanceDef
::
Item
(
def
)
=>
def
,
InstanceDef
::
VtableShim
(
def_id
)
|
InstanceDef
::
ReifyShim
(
def_id
)
|
InstanceDef
::
FnPtrShim
(
def_id
,
_
)
|
InstanceDef
::
Virtual
(
def_id
,
_
)
|
InstanceDef
::
Intrinsic
(
def_id
)
|
InstanceDef
::
ClosureOnceShim
{
call_once
:
def_id
}
|
InstanceDef
::
DropGlue
(
def_id
,
_
)
|
InstanceDef
::
CloneShim
(
def_id
,
_
)
=>
ty
::
WithOptParam
::
dummy
(
def_id
),
}
}
#[inline]
pub
fn
attrs
(
&
self
,
tcx
:
TyCtxt
<
'tcx
>
)
->
ty
::
Attributes
<
'tcx
>
{
tcx
.get_attrs
(
self
.def_id
())
...
...
@@ -198,7 +213,7 @@ pub fn attrs(&self, tcx: TyCtxt<'tcx>) -> ty::Attributes<'tcx> {
pub
fn
requires_inline
(
&
self
,
tcx
:
TyCtxt
<
'tcx
>
)
->
bool
{
use
rustc_hir
::
definitions
::
DefPathData
;
let
def_id
=
match
*
self
{
ty
::
InstanceDef
::
Item
(
def
_id
)
=>
def_
id
,
ty
::
InstanceDef
::
Item
(
def
)
=>
def
.d
id
,
ty
::
InstanceDef
::
DropGlue
(
_
,
Some
(
_
))
=>
return
false
,
_
=>
return
true
,
};
...
...
@@ -244,8 +259,8 @@ pub fn generates_cgu_internal_copy(&self, tcx: TyCtxt<'tcx>) -> bool {
pub
fn
requires_caller_location
(
&
self
,
tcx
:
TyCtxt
<
'_
>
)
->
bool
{
match
*
self
{
InstanceDef
::
Item
(
def
_id
)
=>
{
tcx
.codegen_fn_attrs
(
def
_
id
)
.flags
.contains
(
CodegenFnAttrFlags
::
TRACK_CALLER
)
InstanceDef
::
Item
(
def
)
=>
{
tcx
.codegen_fn_attrs
(
def
.d
id
)
.flags
.contains
(
CodegenFnAttrFlags
::
TRACK_CALLER
)
}
_
=>
false
,
}
...
...
@@ -283,7 +298,7 @@ pub fn new(def_id: DefId, substs: SubstsRef<'tcx>) -> Instance<'tcx> {
def_id
,
substs
);
Instance
{
def
:
InstanceDef
::
Item
(
def_id
),
substs
}
Instance
{
def
:
InstanceDef
::
Item
(
ty
::
WithOptParam
::
dummy
(
def_id
)
),
substs
}
}
pub
fn
mono
(
tcx
:
TyCtxt
<
'tcx
>
,
def_id
:
DefId
)
->
Instance
<
'tcx
>
{
...
...
@@ -356,9 +371,9 @@ pub fn resolve_for_fn_ptr(
debug!
(
"resolve(def_id={:?}, substs={:?})"
,
def_id
,
substs
);
Instance
::
resolve
(
tcx
,
param_env
,
def_id
,
substs
)
.ok
()
.flatten
()
.map
(|
mut
resolved
|
{
match
resolved
.def
{
InstanceDef
::
Item
(
def
_id
)
if
resolved
.def
.requires_caller_location
(
tcx
)
=>
{
InstanceDef
::
Item
(
def
)
if
resolved
.def
.requires_caller_location
(
tcx
)
=>
{
debug!
(
" => fn pointer created for function with #[track_caller]"
);
resolved
.def
=
InstanceDef
::
ReifyShim
(
def
_
id
);
resolved
.def
=
InstanceDef
::
ReifyShim
(
def
.d
id
);
}
InstanceDef
::
Virtual
(
def_id
,
_
)
=>
{
debug!
(
" => fn pointer created for virtual call"
);
...
...
src/librustc_middle/ty/mod.rs
浏览文件 @
a8419099
...
...
@@ -2880,7 +2880,7 @@ pub fn item_name(self, id: DefId) -> Symbol {
/// Returns the possibly-auto-generated MIR of a `(DefId, Subst)` pair.
pub
fn
instance_mir
(
self
,
instance
:
ty
::
InstanceDef
<
'tcx
>
)
->
&
'tcx
Body
<
'tcx
>
{
match
instance
{
ty
::
InstanceDef
::
Item
(
d
id
)
=>
self
.optimized_mir
(
did
),
ty
::
InstanceDef
::
Item
(
d
ef
)
=>
self
.optimized_mir
(
def
.
did
),
ty
::
InstanceDef
::
VtableShim
(
..
)
|
ty
::
InstanceDef
::
ReifyShim
(
..
)
|
ty
::
InstanceDef
::
Intrinsic
(
..
)
...
...
src/librustc_middle/ty/structural_impls.rs
浏览文件 @
a8419099
...
...
@@ -838,7 +838,7 @@ fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
Self
{
substs
:
self
.substs
.fold_with
(
folder
),
def
:
match
self
.def
{
Item
(
d
id
)
=>
Item
(
did
.fold_with
(
folder
)),
Item
(
d
ef
)
=>
Item
(
def
.fold_with
(
folder
)),
VtableShim
(
did
)
=>
VtableShim
(
did
.fold_with
(
folder
)),
ReifyShim
(
did
)
=>
ReifyShim
(
did
.fold_with
(
folder
)),
Intrinsic
(
did
)
=>
Intrinsic
(
did
.fold_with
(
folder
)),
...
...
@@ -857,7 +857,8 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
use
crate
::
ty
::
InstanceDef
::
*
;
self
.substs
.visit_with
(
visitor
)
||
match
self
.def
{
Item
(
did
)
|
VtableShim
(
did
)
|
ReifyShim
(
did
)
|
Intrinsic
(
did
)
|
Virtual
(
did
,
_
)
=>
{
Item
(
def
)
=>
def
.visit_with
(
visitor
),
VtableShim
(
did
)
|
ReifyShim
(
did
)
|
Intrinsic
(
did
)
|
Virtual
(
did
,
_
)
=>
{
did
.visit_with
(
visitor
)
}
FnPtrShim
(
did
,
ty
)
|
CloneShim
(
did
,
ty
)
=>
{
...
...
src/librustc_mir/const_eval/eval_queries.rs
浏览文件 @
a8419099
...
...
@@ -288,21 +288,21 @@ pub fn const_eval_raw_provider<'tcx>(
}
let
cid
=
key
.value
;
let
def
_id
=
cid
.instance.def
.def_id
();
let
def
=
cid
.instance.def
.with_opt_param
();
if
let
Some
(
def
_id
)
=
def_id
.as_local
()
{
if
tcx
.has_typeck_tables
(
def
_
id
)
{
if
let
Some
(
error_reported
)
=
tcx
.typeck_tables_of
(
def_id
)
.tainted_by_errors
{
if
let
Some
(
def
)
=
def
.as_local
()
{
if
tcx
.has_typeck_tables
(
def
.d
id
)
{
if
let
Some
(
error_reported
)
=
tcx
.typeck_tables_of
_const_arg
(
def
)
.tainted_by_errors
{
return
Err
(
ErrorHandled
::
Reported
(
error_reported
));
}
}
}
let
is_static
=
tcx
.is_static
(
def
_
id
);
let
is_static
=
tcx
.is_static
(
def
.d
id
);
let
mut
ecx
=
InterpCx
::
new
(
tcx
,
tcx
.def_span
(
cid
.instance
.def_id
()
),
tcx
.def_span
(
def
.did
),
key
.param_env
,
CompileTimeInterpreter
::
new
(
tcx
.sess
.const_eval_limit
()),
MemoryExtra
{
can_access_statics
:
is_static
},
...
...
@@ -334,9 +334,9 @@ pub fn const_eval_raw_provider<'tcx>(
}
v
}
else
if
let
Some
(
def
_id
)
=
def_id
.as_local
()
{
}
else
if
let
Some
(
def
)
=
def
.as_local
()
{
// constant defined in this crate, we can figure out a lint level!
match
tcx
.def_kind
(
def
_
id
.to_def_id
())
{
match
tcx
.def_kind
(
def
.d
id
.to_def_id
())
{
// constants never produce a hard error at the definition site. Anything else is
// a backwards compatibility hazard (and will break old versions of winapi for
// sure)
...
...
@@ -346,9 +346,9 @@ pub fn const_eval_raw_provider<'tcx>(
// validation thus preventing such a hard error from being a backwards
// compatibility hazard
DefKind
::
Const
|
DefKind
::
AssocConst
=>
{
let
hir_id
=
tcx
.hir
()
.as_local_hir_id
(
def
_
id
);
let
hir_id
=
tcx
.hir
()
.as_local_hir_id
(
def
.d
id
);
err
.report_as_lint
(
tcx
.at
(
tcx
.def_span
(
def
_
id
)),
tcx
.at
(
tcx
.def_span
(
def
.d
id
)),
"any use of this value will cause an error"
,
hir_id
,
Some
(
err
.span
),
...
...
@@ -359,7 +359,7 @@ pub fn const_eval_raw_provider<'tcx>(
// deny-by-default lint
_
=>
{
if
let
Some
(
p
)
=
cid
.promoted
{
let
span
=
tcx
.promoted_mir
(
def
_
id
)[
p
]
.span
;
let
span
=
tcx
.promoted_mir
(
def
.d
id
)[
p
]
.span
;
if
let
err_inval!
(
ReferencedConstant
)
=
err
.error
{
err
.report_as_error
(
tcx
.at
(
span
),
...
...
@@ -369,7 +369,7 @@ pub fn const_eval_raw_provider<'tcx>(
err
.report_as_lint
(
tcx
.at
(
span
),
"reaching this expression at runtime will panic or abort"
,
tcx
.hir
()
.as_local_hir_id
(
def
_
id
),
tcx
.hir
()
.as_local_hir_id
(
def
.d
id
),
Some
(
err
.span
),
)
}
...
...
src/librustc_mir/const_eval/machine.rs
浏览文件 @
a8419099
...
...
@@ -191,11 +191,11 @@ fn find_mir_or_eval_fn(
debug!
(
"find_mir_or_eval_fn: {:?}"
,
instance
);
// Only check non-glue functions
if
let
ty
::
InstanceDef
::
Item
(
def
_id
)
=
instance
.def
{
if
let
ty
::
InstanceDef
::
Item
(
def
)
=
instance
.def
{
// Execution might have wandered off into other crates, so we cannot do a stability-
// sensitive check here. But we can at least rule out functions that are not const
// at all.
if
ecx
.tcx
.is_const_fn_raw
(
def
_
id
)
{
if
ecx
.tcx
.is_const_fn_raw
(
def
.d
id
)
{
// If this function is a `const fn` then under certain circumstances we
// can evaluate call via the query system, thus memoizing all future calls.
if
ecx
.try_eval_const_fn_call
(
instance
,
ret
,
args
)
?
{
...
...
src/librustc_mir/interpret/eval_context.rs
浏览文件 @
a8419099
...
...
@@ -394,24 +394,26 @@ pub fn load_mir(
promoted
:
Option
<
mir
::
Promoted
>
,
)
->
InterpResult
<
'tcx
,
&
'tcx
mir
::
Body
<
'tcx
>>
{
// do not continue if typeck errors occurred (can only occur in local crate)
let
did
=
instance
.def_id
();
if
let
Some
(
did
)
=
did
.as_local
()
{
if
self
.tcx
.has_typeck_tables
(
did
)
{
if
let
Some
(
error_reported
)
=
self
.tcx
.typeck_tables_of
(
did
)
.tainted_by_errors
{
let
def
=
instance
.with_opt_param
();
if
let
Some
(
def
)
=
def
.as_local
()
{
if
self
.tcx
.has_typeck_tables
(
def
.did
)
{
if
let
Some
(
error_reported
)
=
self
.tcx
.typeck_tables_of_const_arg
(
def
)
.tainted_by_errors
{
throw_inval!
(
TypeckError
(
error_reported
))
}
}
}
trace!
(
"load mir(instance={:?}, promoted={:?})"
,
instance
,
promoted
);
if
let
Some
(
promoted
)
=
promoted
{
return
Ok
(
&
self
.tcx
.promoted_mir
(
did
)[
promoted
]);
return
Ok
(
&
self
.tcx
.promoted_mir
(
d
ef
.d
id
)[
promoted
]);
}
match
instance
{
ty
::
InstanceDef
::
Item
(
def
_id
)
=>
{
if
self
.tcx
.is_mir_available
(
did
)
{
Ok
(
self
.tcx
.optimized_mir
(
did
))
ty
::
InstanceDef
::
Item
(
def
)
=>
{
if
self
.tcx
.is_mir_available
(
d
ef
.d
id
)
{
Ok
(
self
.tcx
.optimized_mir
(
d
ef
.d
id
))
}
else
{
throw_unsup!
(
NoMirFor
(
def
_
id
))
throw_unsup!
(
NoMirFor
(
def
.d
id
))
}
}
_
=>
Ok
(
self
.tcx
.instance_mir
(
instance
)),
...
...
src/librustc_mir/monomorphize/collector.rs
浏览文件 @
a8419099
...
...
@@ -768,8 +768,8 @@ fn visit_instance_use<'tcx>(
// need a mono item.
fn
should_monomorphize_locally
<
'tcx
>
(
tcx
:
TyCtxt
<
'tcx
>
,
instance
:
&
Instance
<
'tcx
>
)
->
bool
{
let
def_id
=
match
instance
.def
{
ty
::
InstanceDef
::
Item
(
def
_id
)
|
ty
::
InstanceDef
::
DropGlue
(
def_id
,
Some
(
_
))
=>
def_
id
,
ty
::
InstanceDef
::
Item
(
def
)
=>
def
.d
id
,
ty
::
InstanceDef
::
DropGlue
(
def_id
,
Some
(
_
))
=>
def_id
,
ty
::
InstanceDef
::
VtableShim
(
..
)
|
ty
::
InstanceDef
::
ReifyShim
(
..
)
|
ty
::
InstanceDef
::
ClosureOnceShim
{
..
}
...
...
src/librustc_mir/monomorphize/partitioning.rs
浏览文件 @
a8419099
...
...
@@ -314,7 +314,8 @@ fn mono_item_visibility(
};
let
def_id
=
match
instance
.def
{
InstanceDef
::
Item
(
def_id
)
|
InstanceDef
::
DropGlue
(
def_id
,
Some
(
_
))
=>
def_id
,
InstanceDef
::
Item
(
def
)
=>
def
.did
,
InstanceDef
::
DropGlue
(
def_id
,
Some
(
_
))
=>
def_id
,
// These are all compiler glue and such, never exported, always hidden.
InstanceDef
::
VtableShim
(
..
)
...
...
@@ -704,7 +705,7 @@ fn characteristic_def_id_of_mono_item<'tcx>(
match
mono_item
{
MonoItem
::
Fn
(
instance
)
=>
{
let
def_id
=
match
instance
.def
{
ty
::
InstanceDef
::
Item
(
def
_id
)
=>
def_
id
,
ty
::
InstanceDef
::
Item
(
def
)
=>
def
.d
id
,
ty
::
InstanceDef
::
VtableShim
(
..
)
|
ty
::
InstanceDef
::
ReifyShim
(
..
)
|
ty
::
InstanceDef
::
FnPtrShim
(
..
)
...
...
src/librustc_mir/transform/check_consts/validation.rs
浏览文件 @
a8419099
...
...
@@ -520,8 +520,8 @@ fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location
let
instance
=
Instance
::
resolve
(
self
.tcx
,
self
.param_env
,
def_id
,
substs
);
debug!
(
"Resolving ({:?}) -> {:?}"
,
def_id
,
instance
);
if
let
Ok
(
Some
(
func
))
=
instance
{
if
let
InstanceDef
::
Item
(
def
_id
)
=
func
.def
{
if
is_const_fn
(
self
.tcx
,
def
_
id
)
{
if
let
InstanceDef
::
Item
(
def
)
=
func
.def
{
if
is_const_fn
(
self
.tcx
,
def
.d
id
)
{
return
;
}
}
...
...
src/librustc_mir/transform/mod.rs
浏览文件 @
a8419099
...
...
@@ -9,7 +9,7 @@
use
rustc_middle
::
mir
::{
traversal
,
Body
,
ConstQualifs
,
MirPhase
,
Promoted
};
use
rustc_middle
::
ty
::
query
::
Providers
;
use
rustc_middle
::
ty
::
steal
::
Steal
;
use
rustc_middle
::
ty
::{
InstanceDef
,
TyCtxt
,
TypeFoldable
};
use
rustc_middle
::
ty
::{
self
,
InstanceDef
,
TyCtxt
,
TypeFoldable
};
use
rustc_span
::{
Span
,
Symbol
};
use
std
::
borrow
::
Cow
;
...
...
@@ -116,7 +116,7 @@ pub struct MirSource<'tcx> {
impl
<
'tcx
>
MirSource
<
'tcx
>
{
pub
fn
item
(
def_id
:
DefId
)
->
Self
{
MirSource
{
instance
:
InstanceDef
::
Item
(
def_id
),
promoted
:
None
}
MirSource
{
instance
:
InstanceDef
::
Item
(
ty
::
WithOptParam
::
dummy
(
def_id
)
),
promoted
:
None
}
}
#[inline]
...
...
@@ -249,7 +249,7 @@ fn mir_const(tcx: TyCtxt<'_>, def_id: DefId) -> Steal<Body<'_>> {
run_passes
(
tcx
,
&
mut
body
,
InstanceDef
::
Item
(
def_id
.to_def_id
(
)),
InstanceDef
::
Item
(
ty
::
WithOptParam
::
dummy
(
def_id
.to_def_id
()
)),
None
,
MirPhase
::
Const
,
&
[
&
[
...
...
@@ -284,7 +284,7 @@ fn mir_validated(
run_passes
(
tcx
,
&
mut
body
,
InstanceDef
::
Item
(
def_id
.to_def_id
(
)),
InstanceDef
::
Item
(
ty
::
WithOptParam
::
dummy
(
def_id
.to_def_id
()
)),
None
,
MirPhase
::
Validated
,
&
[
&
[
...
...
@@ -350,7 +350,7 @@ fn run_post_borrowck_cleanup_passes<'tcx>(
run_passes
(
tcx
,
body
,
InstanceDef
::
Item
(
def_id
.to_def_id
(
)),
InstanceDef
::
Item
(
ty
::
WithOptParam
::
dummy
(
def_id
.to_def_id
()
)),
promoted
,
MirPhase
::
DropElab
,
&
[
post_borrowck_cleanup
],
...
...
@@ -414,7 +414,7 @@ fn run_optimization_passes<'tcx>(
run_passes
(
tcx
,
body
,
InstanceDef
::
Item
(
def_id
.to_def_id
(
)),
InstanceDef
::
Item
(
ty
::
WithOptParam
::
dummy
(
def_id
.to_def_id
()
)),
promoted
,
MirPhase
::
Optimized
,
&
[
...
...
src/librustc_mir/util/pretty.rs
浏览文件 @
a8419099
...
...
@@ -248,7 +248,10 @@ pub fn write_mir_pretty<'tcx>(
for
(
i
,
body
)
in
tcx
.promoted_mir
(
def_id
)
.iter_enumerated
()
{
writeln!
(
w
)
?
;
let
src
=
MirSource
{
instance
:
ty
::
InstanceDef
::
Item
(
def_id
),
promoted
:
Some
(
i
)
};
let
src
=
MirSource
{
instance
:
ty
::
InstanceDef
::
Item
(
ty
::
WithOptParam
::
dummy
(
def_id
)),
promoted
:
Some
(
i
),
};
write_mir_fn
(
tcx
,
src
,
body
,
&
mut
|
_
,
_
|
Ok
(()),
w
)
?
;
}
}
...
...
src/librustc_ty/instance.rs
浏览文件 @
a8419099
...
...
@@ -86,7 +86,7 @@ fn inner_resolve_instance<'tcx>(
}
_
=>
{
debug!
(
" => free item"
);
ty
::
InstanceDef
::
Item
(
def
.did
)
ty
::
InstanceDef
::
Item
(
def
)
}
};
Ok
(
Some
(
Instance
{
def
,
substs
}))
...
...
@@ -215,7 +215,7 @@ fn resolve_associated_item<'tcx>(
Some
(
ty
::
Instance
::
new
(
leaf_def
.item.def_id
,
substs
))
}
traits
::
ImplSourceGenerator
(
generator_data
)
=>
Some
(
Instance
{
def
:
ty
::
InstanceDef
::
Item
(
generator_data
.generator_def_id
),
def
:
ty
::
InstanceDef
::
Item
(
ty
::
WithOptParam
::
dummy
(
generator_data
.generator_def_id
)
),
substs
:
generator_data
.substs
,
}),
traits
::
ImplSourceClosure
(
closure_data
)
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录