about summary refs log tree commit diff
path: root/compiler/rustc_passes/src/check_const.rs
diff options
context:
space:
mode:
authorDeadbeef <ent3rm4n@gmail.com>2022-09-27 13:42:32 +0000
committerDeadbeef <ent3rm4n@gmail.com>2022-09-27 13:47:32 +0000
commit27b280e1b5370640fc0f181a52eaae6dc379d353 (patch)
tree08999691b71330980e534a4c066faa0ef212be12 /compiler/rustc_passes/src/check_const.rs
parent57ee5cf5a93923dae9c98bffb11545fc3a31368d (diff)
downloadrust-27b280e1b5370640fc0f181a52eaae6dc379d353.tar.gz
rust-27b280e1b5370640fc0f181a52eaae6dc379d353.zip
Fix ICE in const_trait check code
This fixes #102156.
Diffstat (limited to 'compiler/rustc_passes/src/check_const.rs')
-rw-r--r--compiler/rustc_passes/src/check_const.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_passes/src/check_const.rs b/compiler/rustc_passes/src/check_const.rs
index 4062862ad74..0af538454f0 100644
--- a/compiler/rustc_passes/src/check_const.rs
+++ b/compiler/rustc_passes/src/check_const.rs
@@ -199,7 +199,7 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> {
             ..
         }) = item.kind
         {
-            let def_id = trait_ref.trait_def_id().unwrap();
+            let Some(def_id) = trait_ref.trait_def_id() else { return; };
             let source_map = tcx.sess.source_map();
             if !tcx.has_attr(def_id, sym::const_trait) {
                 tcx.sess