diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 6f9b6a4f14ce9..f89d67eced3fb 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -631,7 +631,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // be known if explicitly specified via turbofish). self.deferred_transmute_checks.borrow_mut().push((*from, to, expr.hir_id)); } - if tcx.is_intrinsic(did, sym::offload) { + if !tcx.sess.opts.unstable_opts.offload.is_empty() + && tcx.is_intrinsic(did, sym::offload) + { let args = args.skip_binder(); let f = args.type_at(0); let t = args.type_at(1); diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index b9ad57ac9d309..f302b5d01efd5 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -1154,7 +1154,9 @@ fn run_required_analyses(tcx: TyCtxt<'_>) { if not_typeck_child { tcx.ensure_ok().mir_borrowck(def_id); tcx.ensure_ok().check_transmutes(def_id); - tcx.ensure_ok().check_offloads(def_id); + if !tcx.sess.opts.unstable_opts.offload.is_empty() { + tcx.ensure_ok().check_offloads(def_id); + } } tcx.ensure_ok().has_ffi_unwind_calls(def_id); tcx.ensure_ok().check_liveness(def_id); diff --git a/compiler/rustc_middle/src/queries.rs b/compiler/rustc_middle/src/queries.rs index 28a35013b6516..c25a762e0b2ff 100644 --- a/compiler/rustc_middle/src/queries.rs +++ b/compiler/rustc_middle/src/queries.rs @@ -1137,7 +1137,7 @@ rustc_queries! { desc { "check transmute calls inside `{}`", tcx.def_path_str(key) } } - /// Unsafety-check this `LocalDefId`. + /// Type-check offloads calls given a typeck root query check_offloads(key: LocalDefId) -> Result<(), ErrorGuaranteed> { desc { "check offload calls inside `{}`", tcx.def_path_str(key) } }