Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions compiler/rustc_hir_typeck/src/intrinsicck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions src/test/ui/consts/issue-104609.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
fn foo() {
oops;
//~^ ERROR: cannot find value `oops` in this scope
}

unsafe fn bar() {
std::mem::transmute::<_, *mut _>(1_u8);
}

fn main() {}
9 changes: 9 additions & 0 deletions src/test/ui/consts/issue-104609.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0425]: cannot find value `oops` in this scope
--> $DIR/issue-104609.rs:2:5
|
LL | oops;
| ^^^^ not found in this scope

error: aborting due to previous error

For more information about this error, try `rustc --explain E0425`.