diff --git a/compiler/rustc_passes/src/check_const.rs b/compiler/rustc_passes/src/check_const.rs index 0af538454f0..116aaf48349 100644 --- a/compiler/rustc_passes/src/check_const.rs +++ b/compiler/rustc_passes/src/check_const.rs @@ -198,8 +198,8 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> { of_trait: Some(trait_ref), .. }) = item.kind + && let Some(def_id) = trait_ref.trait_def_id() { - 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