File tree Expand file tree Collapse file tree
c2rust-transpile/src/translator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2967,7 +2967,11 @@ impl<'c> Translation<'c> {
29672967 if ctx. is_pattern
29682968 && !matches ! (
29692969 expr_kind,
2970- CExprKind :: Paren ( ..) | CExprKind :: ConstantExpr ( ..) | CExprKind :: Literal ( ..)
2970+ CExprKind :: Paren ( ..)
2971+ | CExprKind :: ConstantExpr ( ..)
2972+ | CExprKind :: Literal ( ..)
2973+ | CExprKind :: ImplicitCast ( ..)
2974+ | CExprKind :: ExplicitCast ( ..)
29712975 )
29722976 {
29732977 return Err ( TranslationError :: generic (
@@ -3703,6 +3707,12 @@ impl<'c> Translation<'c> {
37033707 return Ok ( val) ;
37043708 }
37053709
3710+ if ctx. is_pattern && !matches ! ( kind, CastKind :: ToVoid | CastKind :: ConstCast ) {
3711+ return Err ( TranslationError :: generic (
3712+ "cast kind is not supported in patterns" ,
3713+ ) ) ;
3714+ }
3715+
37063716 match kind {
37073717 CastKind :: BitCast | CastKind :: NoOp => {
37083718 self . convert_pointer_to_pointer_cast ( source_cty, target_cty, val)
You can’t perform that action at this time.
0 commit comments