File tree Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 11use clippy_utils:: diagnostics:: span_lint_and_sugg;
2+ use clippy_utils:: is_in_const_context;
23use clippy_utils:: source:: snippet_with_context;
34use clippy_utils:: ty:: implements_trait;
45use rustc_errors:: Applicability ;
@@ -105,6 +106,7 @@ impl<'tcx> LateLintPass<'tcx> for PatternEquality {
105106 if let ExprKind :: Let ( let_expr) = expr. kind
106107 && unary_pattern ( let_expr. pat )
107108 && !expr. span . in_external_macro ( cx. sess ( ) . source_map ( ) )
109+ && !is_in_const_context ( cx)
108110 {
109111 let exp_ty = cx. typeck_results ( ) . expr_ty ( let_expr. init ) ;
110112 let pat_ty = cx. typeck_results ( ) . pat_ty ( let_expr. pat ) ;
Original file line number Diff line number Diff line change @@ -139,3 +139,8 @@ mod issue8710 {
139139 }
140140 }
141141}
142+
143+ fn issue15376() {
144+ // PartialEq is not stable in consts yet
145+ const _: u32 = if let Some(true) = None { 0 } else { 1 };
146+ }
Original file line number Diff line number Diff line change @@ -139,3 +139,8 @@ mod issue8710 {
139139 }
140140 }
141141}
142+
143+ fn issue15376 ( ) {
144+ // PartialEq is not stable in consts yet
145+ const _: u32 = if let Some ( true ) = None { 0 } else { 1 } ;
146+ }
You can’t perform that action at this time.
0 commit comments