Skip to content

Commit 1684a75

Browse files
committed
Auto merge of rust-lang#123320 - WaffleLapkin:fixup-never-type-options, 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`
2 parents b38b6ca + 7107748 commit 1684a75

File tree

1 file changed

+5
-5
lines changed
  • compiler/rustc_hir_typeck/src/fn_ctxt

1 file changed

+5
-5
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -416,13 +416,13 @@ fn parse_never_type_options_attr(
416416
continue;
417417
}
418418

419-
if item.has_name(sym::diverging_block_default) && fallback.is_none() {
420-
let mode = item.value_str().unwrap();
421-
match mode {
419+
if item.has_name(sym::diverging_block_default) && block.is_none() {
420+
let default = item.value_str().unwrap();
421+
match default {
422422
sym::unit => block = Some(DivergingBlockBehavior::Unit),
423423
sym::never => block = Some(DivergingBlockBehavior::Never),
424424
_ => {
425-
tcx.dcx().span_err(item.span(), format!("unknown diverging block default: `{mode}` (supported: `unit` and `never`)"));
425+
tcx.dcx().span_err(item.span(), format!("unknown diverging block default: `{default}` (supported: `unit` and `never`)"));
426426
}
427427
};
428428
continue;
@@ -431,7 +431,7 @@ fn parse_never_type_options_attr(
431431
tcx.dcx().span_err(
432432
item.span(),
433433
format!(
434-
"unknown never type option: `{}` (supported: `fallback`)",
434+
"unknown or duplicate never type option: `{}` (supported: `fallback`, `diverging_block_default`)",
435435
item.name_or_empty()
436436
),
437437
);

0 commit comments

Comments
 (0)