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 1
1
use clippy_utils:: diagnostics:: span_lint_and_sugg;
2
+ use clippy_utils:: is_in_const_context;
2
3
use clippy_utils:: source:: snippet_with_context;
3
4
use clippy_utils:: ty:: implements_trait;
4
5
use rustc_errors:: Applicability ;
@@ -105,6 +106,7 @@ impl<'tcx> LateLintPass<'tcx> for PatternEquality {
105
106
if let ExprKind :: Let ( let_expr) = expr. kind
106
107
&& unary_pattern ( let_expr. pat )
107
108
&& !expr. span . in_external_macro ( cx. sess ( ) . source_map ( ) )
109
+ && !is_in_const_context ( cx)
108
110
{
109
111
let exp_ty = cx. typeck_results ( ) . expr_ty ( let_expr. init ) ;
110
112
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 {
139
139
}
140
140
}
141
141
}
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 {
139
139
}
140
140
}
141
141
}
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