Skip to content

Commit

Permalink
Rollup merge of rust-lang#123320 - WaffleLapkin:fixup-never-type-opti…
Browse files Browse the repository at this point in the history
…ons, r=compiler-errors

Fixup parsing of `rustc_never_type_options` attribute

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

r? `@compiler-errors`
  • Loading branch information
matthiaskrgr authored Apr 1, 2024
2 parents 814c3eb + 7107748 commit a3140e0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()
),
);
Expand Down

0 comments on commit a3140e0

Please sign in to comment.