]> git.lizzy.rs Git - rust.git/commitdiff
Retain ParamEnv constness when running deferred cast checks
authorDeadbeef <ent3rm4n@gmail.com>
Fri, 28 Oct 2022 11:46:12 +0000 (11:46 +0000)
committerDeadbeef <ent3rm4n@gmail.com>
Fri, 28 Oct 2022 12:03:24 +0000 (12:03 +0000)
Fixes #103677.

clippy_lints/src/transmute/utils.rs

index 2f190e594a83197c57e62750423037927cd1b6f8..641cdf5d330e1a21e13b2a1205e33a97fc6eac6e 100644 (file)
@@ -3,6 +3,7 @@
 use rustc_lint::LateContext;
 use rustc_middle::ty::{cast::CastKind, Ty};
 use rustc_span::DUMMY_SP;
+use rustc_hir as hir;
 
 // check if the component types of the transmuted collection and the result have different ABI,
 // size or alignment
@@ -56,7 +57,7 @@ fn check_cast<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>, from_ty: Ty<'tcx>
         if let Ok(check) = cast::CastCheck::new(
             &fn_ctxt, e, from_ty, to_ty,
             // We won't show any error to the user, so we don't care what the span is here.
-            DUMMY_SP, DUMMY_SP,
+            DUMMY_SP, DUMMY_SP, hir::Constness::NotConst,
         ) {
             let res = check.do_check(&fn_ctxt);