]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_hir_typeck/src/intrinsicck.rs
Rollup merge of #104359 - Nilstrieb:plus-one, r=fee1-dead
[rust.git] / compiler / rustc_hir_typeck / src / intrinsicck.rs
index 9812d96fcc3c7eec6f125fb68ad6080d7486ce36..c2dc14024655aeba39308b9efad08977356f5580 100644 (file)
@@ -3,7 +3,7 @@
 use rustc_hir as hir;
 use rustc_index::vec::Idx;
 use rustc_middle::ty::layout::{LayoutError, SizeSkeleton};
-use rustc_middle::ty::{self, Ty, TyCtxt};
+use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitable};
 use rustc_target::abi::{Pointer, VariantIdx};
 
 use super::FnCtxt;
@@ -46,7 +46,10 @@ pub fn check_transmute(&self, from: Ty<'tcx>, to: Ty<'tcx>, hir_id: HirId) {
         let from = normalize(from);
         let to = normalize(to);
         trace!(?from, ?to);
-
+        if from.has_non_region_infer() || to.has_non_region_infer() {
+            tcx.sess.delay_span_bug(span, "argument to transmute has inference variables");
+            return;
+        }
         // Transmutes that are only changing lifetimes are always ok.
         if from == to {
             return;