about summary refs log tree commit diff
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2021-03-16 00:05:45 +0100
committerlcnr <rust@lcnr.de>2021-08-26 11:00:30 +0200
commit19d1fe21c75bcfda468611c38da518f98d6e2c32 (patch)
tree1297bac7128504471809f14ea8d827bec636950f
parent4d627fc41b0a34d99afbaa21f3b8c301d942ffc8 (diff)
downloadrust-19d1fe21c75bcfda468611c38da518f98d6e2c32.tar.gz
rust-19d1fe21c75bcfda468611c38da518f98d6e2c32.zip
make unevaluated const substs optional
-rw-r--r--clippy_lints/src/non_copy_const.rs6
-rw-r--r--clippy_lints/src/redundant_clone.rs4
-rw-r--r--clippy_utils/src/consts.rs6
3 files changed, 4 insertions, 12 deletions
diff --git a/clippy_lints/src/non_copy_const.rs b/clippy_lints/src/non_copy_const.rs
index 3f9110295fc..2a85a67fa09 100644
--- a/clippy_lints/src/non_copy_const.rs
+++ b/clippy_lints/src/non_copy_const.rs
@@ -187,11 +187,7 @@ fn is_value_unfrozen_expr<'tcx>(cx: &LateContext<'tcx>, hir_id: HirId, def_id: D
 
     let result = cx.tcx.const_eval_resolve(
         cx.param_env,
-        ty::Unevaluated {
-            def: ty::WithOptConstParam::unknown(def_id),
-            substs,
-            promoted: None,
-        },
+        ty::Unevaluated::new(ty::WithOptConstParam::unknown(def_id), substs),
         None,
     );
     is_value_unfrozen_raw(cx, result, ty)
diff --git a/clippy_lints/src/redundant_clone.rs b/clippy_lints/src/redundant_clone.rs
index 2335d2248aa..f5e43264a5c 100644
--- a/clippy_lints/src/redundant_clone.rs
+++ b/clippy_lints/src/redundant_clone.rs
@@ -705,8 +705,8 @@ struct ContainsRegion<'tcx>(TyCtxt<'tcx>);
 
 impl<'tcx> TypeVisitor<'tcx> for ContainsRegion<'tcx> {
     type BreakTy = ();
-    fn tcx_for_anon_const_substs(&self) -> TyCtxt<'tcx> {
-        self.0
+    fn tcx_for_anon_const_substs(&self) -> Option<TyCtxt<'tcx>> {
+        Some(self.0)
     }
 
     fn visit_region(&mut self, _: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
diff --git a/clippy_utils/src/consts.rs b/clippy_utils/src/consts.rs
index 9ba1381da65..8bf31807d55 100644
--- a/clippy_utils/src/consts.rs
+++ b/clippy_utils/src/consts.rs
@@ -346,11 +346,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
                     .tcx
                     .const_eval_resolve(
                         self.param_env,
-                        ty::Unevaluated {
-                            def: ty::WithOptConstParam::unknown(def_id),
-                            substs,
-                            promoted: None,
-                        },
+                        ty::Unevaluated::new(ty::WithOptConstParam::unknown(def_id), substs),
                         None,
                     )
                     .ok()