From 71077482d58e807b9d09637237015df3f3d7d690 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Mon, 1 Apr 2024 10:56:33 +0000 Subject: [PATCH] Fixup parsing of `rustc_never_type_options` attribute Copy paste error strike again.. --- compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs index 74f27cfebbd..05e7c5b2b41 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs @@ -416,13 +416,13 @@ fn parse_never_type_options_attr( continue; } - if item.has_name(sym::diverging_block_default) && fallback.is_none() { - let mode = item.value_str().unwrap(); - match mode { + if item.has_name(sym::diverging_block_default) && block.is_none() { + let default = item.value_str().unwrap(); + match default { sym::unit => block = Some(DivergingBlockBehavior::Unit), sym::never => block = Some(DivergingBlockBehavior::Never), _ => { - tcx.dcx().span_err(item.span(), format!("unknown diverging block default: `{mode}` (supported: `unit` and `never`)")); + tcx.dcx().span_err(item.span(), format!("unknown diverging block default: `{default}` (supported: `unit` and `never`)")); } }; continue; @@ -431,7 +431,7 @@ fn parse_never_type_options_attr( tcx.dcx().span_err( item.span(), format!( - "unknown never type option: `{}` (supported: `fallback`)", + "unknown or duplicate never type option: `{}` (supported: `fallback`, `diverging_block_default`)", item.name_or_empty() ), );