HACK: Overwrite the MIR's source with the correct const param
There's a cleaner way of doing this, but it involves passing `WithOptConstParam` around in more places. We're going to try to explore different approaches before committing to that.
This commit is contained in:
parent
6f61e71648
commit
606655edc4
1 changed files with 7 additions and 1 deletions
|
@ -29,7 +29,13 @@ crate fn mir_built<'tcx>(
|
|||
return tcx.mir_built(def);
|
||||
}
|
||||
|
||||
tcx.alloc_steal_mir(mir_build(tcx, def))
|
||||
let mut body = mir_build(tcx, def);
|
||||
if def.const_param_did.is_some() {
|
||||
assert!(matches!(body.source.instance, ty::InstanceDef::Item(_)));
|
||||
body.source = MirSource::from_instance(ty::InstanceDef::Item(def.to_global()));
|
||||
}
|
||||
|
||||
tcx.alloc_steal_mir(body)
|
||||
}
|
||||
|
||||
/// Construct the MIR for a given `DefId`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue