about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-05-13 16:03:24 +0200
committerGitHub <noreply@github.com>2022-05-13 16:03:24 +0200
commit384caefbb6da90034a948bf262b95b1b98712ef9 (patch)
treeecaeaef8e341bdb699fc40b4da4dd0c5af67e597
parent281be096c181076aef96ff3b81e869fbebbe6b50 (diff)
parent7f318256c908be1df494ae16c2d2dad94e9f66a7 (diff)
downloadrust-384caefbb6da90034a948bf262b95b1b98712ef9.tar.gz
rust-384caefbb6da90034a948bf262b95b1b98712ef9.zip
Rollup merge of #96982 - klensy:no-expect, r=Dylan-DPC
fix clippy expect_fun_call
-rw-r--r--compiler/rustc_const_eval/src/const_eval/valtrees.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/valtrees.rs b/compiler/rustc_const_eval/src/const_eval/valtrees.rs
index 374179d0cc2..f57f25c19f9 100644
--- a/compiler/rustc_const_eval/src/const_eval/valtrees.rs
+++ b/compiler/rustc_const_eval/src/const_eval/valtrees.rs
@@ -58,7 +58,9 @@ fn slice_branches<'tcx>(
     ecx: &CompileTimeEvalContext<'tcx, 'tcx>,
     place: &MPlaceTy<'tcx>,
 ) -> Option<ty::ValTree<'tcx>> {
-    let n = place.len(&ecx.tcx.tcx).expect(&format!("expected to use len of place {:?}", place));
+    let n = place
+        .len(&ecx.tcx.tcx)
+        .unwrap_or_else(|_| panic!("expected to use len of place {:?}", place));
     let branches = (0..n).map(|i| {
         let place_elem = ecx.mplace_index(place, i).unwrap();
         const_to_valtree_inner(ecx, &place_elem)