Auto merge of #123320 - WaffleLapkin:fixup-never-type-options, r=compiler-errors

Fixup parsing of `rustc_never_type_options` attribute

#122843 had a copy paste error, which I did not caught when testing.

r? `@compiler-errors`
This commit is contained in:
bors 2024-04-01 21:02:53 +00:00
commit 1684a753db

View File

@ -416,13 +416,13 @@ fn parse_never_type_options_attr(
continue; continue;
} }
if item.has_name(sym::diverging_block_default) && fallback.is_none() { if item.has_name(sym::diverging_block_default) && block.is_none() {
let mode = item.value_str().unwrap(); let default = item.value_str().unwrap();
match mode { match default {
sym::unit => block = Some(DivergingBlockBehavior::Unit), sym::unit => block = Some(DivergingBlockBehavior::Unit),
sym::never => block = Some(DivergingBlockBehavior::Never), 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; continue;
@ -431,7 +431,7 @@ fn parse_never_type_options_attr(
tcx.dcx().span_err( tcx.dcx().span_err(
item.span(), item.span(),
format!( format!(
"unknown never type option: `{}` (supported: `fallback`)", "unknown or duplicate never type option: `{}` (supported: `fallback`, `diverging_block_default`)",
item.name_or_empty() item.name_or_empty()
), ),
); );