diff options
| author | hi-rustin <rustin.liu@gmail.com> | 2022-11-21 09:03:33 +0800 |
|---|---|---|
| committer | hi-rustin <rustin.liu@gmail.com> | 2022-11-21 09:03:33 +0800 |
| commit | a60e267200c9cdfe8295855eb2d9ad02ad73a087 (patch) | |
| tree | 55d0b1e73e07f094bb810c033c2de5343653096e /compiler | |
| parent | a28f3c88e50a77bc2a91889241248c4543854e61 (diff) | |
| download | rust-a60e267200c9cdfe8295855eb2d9ad02ad73a087.tar.gz rust-a60e267200c9cdfe8295855eb2d9ad02ad73a087.zip | |
Do not check transmute if has non region infer
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir_typeck/src/intrinsicck.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_hir_typeck/src/intrinsicck.rs b/compiler/rustc_hir_typeck/src/intrinsicck.rs index 9812d96fcc3..c9878e381a9 100644 --- a/compiler/rustc_hir_typeck/src/intrinsicck.rs +++ b/compiler/rustc_hir_typeck/src/intrinsicck.rs @@ -3,7 +3,7 @@ use rustc_errors::struct_span_err; 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 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let from = normalize(from); let to = normalize(to); trace!(?from, ?to); - + if from.has_non_region_infer() || to.has_non_region_infer() { + // We can't check anything if there are inference variables. + return; + } // Transmutes that are only changing lifetimes are always ok. if from == to { return; |
