summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_mir_build/src/thir/cx/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_mir_build/src/thir/cx/mod.rs')
-rw-r--r--compiler/rustc_mir_build/src/thir/cx/mod.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler/rustc_mir_build/src/thir/cx/mod.rs b/compiler/rustc_mir_build/src/thir/cx/mod.rs
index 1d95d6b53..b5c4b7b13 100644
--- a/compiler/rustc_mir_build/src/thir/cx/mod.rs
+++ b/compiler/rustc_mir_build/src/thir/cx/mod.rs
@@ -80,6 +80,9 @@ struct Cx<'tcx> {
/// for the receiver.
adjustment_span: Option<(HirId, Span)>,
+ /// False to indicate that adjustments should not be applied. Only used for `custom_mir`
+ apply_adjustments: bool,
+
/// The `DefId` of the owner of this body.
body_owner: DefId,
}
@@ -87,6 +90,8 @@ struct Cx<'tcx> {
impl<'tcx> Cx<'tcx> {
fn new(tcx: TyCtxt<'tcx>, def: ty::WithOptConstParam<LocalDefId>) -> Cx<'tcx> {
let typeck_results = tcx.typeck_opt_const_arg(def);
+ let did = def.did;
+ let hir = tcx.hir();
Cx {
tcx,
thir: Thir::new(),
@@ -94,8 +99,12 @@ impl<'tcx> Cx<'tcx> {
region_scope_tree: tcx.region_scope_tree(def.did),
typeck_results,
rvalue_scopes: &typeck_results.rvalue_scopes,
- body_owner: def.did.to_def_id(),
+ body_owner: did.to_def_id(),
adjustment_span: None,
+ apply_adjustments: hir
+ .attrs(hir.local_def_id_to_hir_id(did))
+ .iter()
+ .all(|attr| attr.name_or_empty() != rustc_span::sym::custom_mir),
}
}