Ensure valid local_data is set for custom mir building
MIR unsafety checking requires this to be valid
This commit is contained in:
parent
f03c2aef47
commit
adf1717219
@ -20,6 +20,7 @@
|
|||||||
use rustc_ast::Attribute;
|
use rustc_ast::Attribute;
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
|
use rustc_hir::HirId;
|
||||||
use rustc_index::vec::IndexVec;
|
use rustc_index::vec::IndexVec;
|
||||||
use rustc_middle::{
|
use rustc_middle::{
|
||||||
mir::*,
|
mir::*,
|
||||||
@ -33,6 +34,7 @@
|
|||||||
pub(super) fn build_custom_mir<'tcx>(
|
pub(super) fn build_custom_mir<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
did: DefId,
|
did: DefId,
|
||||||
|
hir_id: HirId,
|
||||||
thir: &Thir<'tcx>,
|
thir: &Thir<'tcx>,
|
||||||
expr: ExprId,
|
expr: ExprId,
|
||||||
params: &IndexVec<ParamId, Param<'tcx>>,
|
params: &IndexVec<ParamId, Param<'tcx>>,
|
||||||
@ -67,7 +69,10 @@ pub(super) fn build_custom_mir<'tcx>(
|
|||||||
parent_scope: None,
|
parent_scope: None,
|
||||||
inlined: None,
|
inlined: None,
|
||||||
inlined_parent_scope: None,
|
inlined_parent_scope: None,
|
||||||
local_data: ClearCrossCrate::Clear,
|
local_data: ClearCrossCrate::Set(SourceScopeLocalData {
|
||||||
|
lint_root: hir_id,
|
||||||
|
safety: Safety::Safe,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
body.injection_phase = Some(parse_attribute(attr));
|
body.injection_phase = Some(parse_attribute(attr));
|
||||||
|
|
||||||
|
@ -487,6 +487,7 @@ fn construct_fn<'tcx>(
|
|||||||
return custom::build_custom_mir(
|
return custom::build_custom_mir(
|
||||||
tcx,
|
tcx,
|
||||||
fn_def.did.to_def_id(),
|
fn_def.did.to_def_id(),
|
||||||
|
fn_id,
|
||||||
thir,
|
thir,
|
||||||
expr,
|
expr,
|
||||||
arguments,
|
arguments,
|
||||||
|
Loading…
Reference in New Issue
Block a user