Auto merge of #129359 - matthiaskrgr:rollup-nyre44t, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #128627 (Special case DUMMY_SP to emit line 0/column 0 locations on DWARF platforms.)
 - #128843 (Minor Refactor: Remove a Redundant Conditional Check)
 - #129179 (CFI: Erase regions when projecting ADT to its transparent non-1zst field)
 - #129281 (Tweak unreachable lint wording)
 - #129312 (Fix stability attribute of `impl !Error for &str`)
 - #129332 (Avoid extra `cast()`s after `CStr::as_ptr()`)
 - #129339 (Make `ArgAbi::make_indirect_force` more specific)
 - #129344 (Use `bool` in favor of `Option<()>` for diagnostics)
 - #129345 (Use shorthand field initialization syntax more aggressively in the compiler)
 - #129355 (fix comment on PlaceMention semantics)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-08-21 17:18:07 +00:00
commit 6b678c57b6
126 changed files with 990 additions and 866 deletions

View File

@ -86,9 +86,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
// Multiple different abi names may actually be the same ABI // Multiple different abi names may actually be the same ABI
// If the specified ABIs are not the same name, alert the user that they resolve to the same ABI // If the specified ABIs are not the same name, alert the user that they resolve to the same ABI
let source_map = self.tcx.sess.source_map(); let source_map = self.tcx.sess.source_map();
let equivalent = (source_map.span_to_snippet(*prev_sp) let equivalent = source_map.span_to_snippet(*prev_sp)
!= source_map.span_to_snippet(*abi_span)) != source_map.span_to_snippet(*abi_span);
.then_some(());
self.dcx().emit_err(AbiSpecifiedMultipleTimes { self.dcx().emit_err(AbiSpecifiedMultipleTimes {
abi_span: *abi_span, abi_span: *abi_span,

View File

@ -184,7 +184,7 @@ pub struct AbiSpecifiedMultipleTimes {
#[label] #[label]
pub prev_span: Span, pub prev_span: Span,
#[note] #[note]
pub equivalent: Option<()>, pub equivalent: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]

View File

@ -1421,7 +1421,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
}; };
hir::FnHeader { hir::FnHeader {
safety: self.lower_safety(h.safety, default_safety), safety: self.lower_safety(h.safety, default_safety),
asyncness: asyncness, asyncness,
constness: self.lower_constness(h.constness), constness: self.lower_constness(h.constness),
abi: self.lower_extern(h.ext), abi: self.lower_extern(h.ext),
} }

View File

@ -562,10 +562,8 @@ impl<'a> AstValidator<'a> {
FnHeader { safety: _, coroutine_kind, constness, ext }: FnHeader, FnHeader { safety: _, coroutine_kind, constness, ext }: FnHeader,
) { ) {
let report_err = |span| { let report_err = |span| {
self.dcx().emit_err(errors::FnQualifierInExtern { self.dcx()
span: span, .emit_err(errors::FnQualifierInExtern { span, block: self.current_extern_span() });
block: self.current_extern_span(),
});
}; };
match coroutine_kind { match coroutine_kind {
Some(knd) => report_err(knd.span()), Some(knd) => report_err(knd.span()),
@ -963,14 +961,13 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
self_ty, self_ty,
items, items,
}) => { }) => {
let error = let error = |annotation_span, annotation, only_trait| errors::InherentImplCannot {
|annotation_span, annotation, only_trait: bool| errors::InherentImplCannot { span: self_ty.span,
span: self_ty.span, annotation_span,
annotation_span, annotation,
annotation, self_ty: self_ty.span,
self_ty: self_ty.span, only_trait,
only_trait: only_trait.then_some(()), };
};
self.with_in_trait_impl(None, |this| { self.with_in_trait_impl(None, |this| {
this.visibility_not_permitted( this.visibility_not_permitted(
@ -1195,7 +1192,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
} else if where_clauses.after.has_where_token { } else if where_clauses.after.has_where_token {
self.dcx().emit_err(errors::WhereClauseAfterTypeAlias { self.dcx().emit_err(errors::WhereClauseAfterTypeAlias {
span: where_clauses.after.span, span: where_clauses.after.span,
help: self.session.is_nightly_build().then_some(()), help: self.session.is_nightly_build(),
}); });
} }
} }

View File

@ -484,7 +484,7 @@ pub struct InherentImplCannot<'a> {
#[label(ast_passes_type)] #[label(ast_passes_type)]
pub self_ty: Span, pub self_ty: Span,
#[note(ast_passes_only_trait)] #[note(ast_passes_only_trait)]
pub only_trait: Option<()>, pub only_trait: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
@ -528,7 +528,7 @@ pub struct WhereClauseAfterTypeAlias {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[help] #[help]
pub help: Option<()>, pub help: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]

View File

@ -846,7 +846,7 @@ pub fn find_deprecation(
sess.dcx().emit_err( sess.dcx().emit_err(
session_diagnostics::DeprecatedItemSuggestion { session_diagnostics::DeprecatedItemSuggestion {
span: mi.span, span: mi.span,
is_nightly: sess.is_nightly_build().then_some(()), is_nightly: sess.is_nightly_build(),
details: (), details: (),
}, },
); );

View File

@ -342,7 +342,7 @@ pub(crate) struct DeprecatedItemSuggestion {
pub span: Span, pub span: Span,
#[help] #[help]
pub is_nightly: Option<()>, pub is_nightly: bool,
#[note] #[note]
pub details: (), pub details: (),

View File

@ -149,7 +149,7 @@ fn create_wrapper_function(
} }
llvm::LLVMRustSetVisibility(callee, llvm::Visibility::Hidden); llvm::LLVMRustSetVisibility(callee, llvm::Visibility::Hidden);
let llbb = llvm::LLVMAppendBasicBlockInContext(llcx, llfn, c"entry".as_ptr().cast()); let llbb = llvm::LLVMAppendBasicBlockInContext(llcx, llfn, c"entry".as_ptr());
let llbuilder = llvm::LLVMCreateBuilderInContext(llcx); let llbuilder = llvm::LLVMCreateBuilderInContext(llcx);
llvm::LLVMPositionBuilderAtEnd(llbuilder, llbb); llvm::LLVMPositionBuilderAtEnd(llbuilder, llbb);

View File

@ -616,7 +616,7 @@ pub(crate) fn run_pass_manager(
llvm::LLVMRustAddModuleFlagU32( llvm::LLVMRustAddModuleFlagU32(
module.module_llvm.llmod(), module.module_llvm.llmod(),
llvm::LLVMModFlagBehavior::Error, llvm::LLVMModFlagBehavior::Error,
c"LTOPostLink".as_ptr().cast(), c"LTOPostLink".as_ptr(),
1, 1,
); );
} }

View File

@ -1031,7 +1031,7 @@ unsafe fn embed_bitcode(
let llglobal = llvm::LLVMAddGlobal( let llglobal = llvm::LLVMAddGlobal(
llmod, llmod,
common::val_ty(llconst), common::val_ty(llconst),
c"rustc.embedded.module".as_ptr().cast(), c"rustc.embedded.module".as_ptr(),
); );
llvm::LLVMSetInitializer(llglobal, llconst); llvm::LLVMSetInitializer(llglobal, llconst);
@ -1044,7 +1044,7 @@ unsafe fn embed_bitcode(
let llglobal = llvm::LLVMAddGlobal( let llglobal = llvm::LLVMAddGlobal(
llmod, llmod,
common::val_ty(llconst), common::val_ty(llconst),
c"rustc.embedded.cmdline".as_ptr().cast(), c"rustc.embedded.cmdline".as_ptr(),
); );
llvm::LLVMSetInitializer(llglobal, llconst); llvm::LLVMSetInitializer(llglobal, llconst);
let section = if is_apple { let section = if is_apple {
@ -1054,7 +1054,7 @@ unsafe fn embed_bitcode(
} else { } else {
c".llvmcmd" c".llvmcmd"
}; };
llvm::LLVMSetSection(llglobal, section.as_ptr().cast()); llvm::LLVMSetSection(llglobal, section.as_ptr());
llvm::LLVMRustSetLinkage(llglobal, llvm::Linkage::PrivateLinkage); llvm::LLVMRustSetLinkage(llglobal, llvm::Linkage::PrivateLinkage);
} else { } else {
// We need custom section flags, so emit module-level inline assembly. // We need custom section flags, so emit module-level inline assembly.
@ -1107,7 +1107,7 @@ fn create_msvc_imps(
.collect::<Vec<_>>(); .collect::<Vec<_>>();
for (imp_name, val) in globals { for (imp_name, val) in globals {
let imp = llvm::LLVMAddGlobal(llmod, ptr_ty, imp_name.as_ptr().cast()); let imp = llvm::LLVMAddGlobal(llmod, ptr_ty, imp_name.as_ptr());
llvm::LLVMSetInitializer(imp, val); llvm::LLVMSetInitializer(imp, val);
llvm::LLVMRustSetLinkage(imp, llvm::Linkage::ExternalLinkage); llvm::LLVMRustSetLinkage(imp, llvm::Linkage::ExternalLinkage);
} }

View File

@ -525,7 +525,7 @@ impl<'ll> CodegenCx<'ll, '_> {
let val = llvm::LLVMMetadataAsValue(self.llcx, meta); let val = llvm::LLVMMetadataAsValue(self.llcx, meta);
llvm::LLVMAddNamedMetadataOperand( llvm::LLVMAddNamedMetadataOperand(
self.llmod, self.llmod,
c"wasm.custom_sections".as_ptr().cast(), c"wasm.custom_sections".as_ptr(),
val, val,
); );
} }

View File

@ -207,7 +207,7 @@ pub unsafe fn create_module<'ll>(
// If skipping the PLT is enabled, we need to add some module metadata // If skipping the PLT is enabled, we need to add some module metadata
// to ensure intrinsic calls don't use it. // to ensure intrinsic calls don't use it.
if !sess.needs_plt() { if !sess.needs_plt() {
let avoid_plt = c"RtLibUseGOT".as_ptr().cast(); let avoid_plt = c"RtLibUseGOT".as_ptr();
unsafe { unsafe {
llvm::LLVMRustAddModuleFlagU32(llmod, llvm::LLVMModFlagBehavior::Warning, avoid_plt, 1); llvm::LLVMRustAddModuleFlagU32(llmod, llvm::LLVMModFlagBehavior::Warning, avoid_plt, 1);
} }
@ -215,7 +215,7 @@ pub unsafe fn create_module<'ll>(
// Enable canonical jump tables if CFI is enabled. (See https://reviews.llvm.org/D65629.) // Enable canonical jump tables if CFI is enabled. (See https://reviews.llvm.org/D65629.)
if sess.is_sanitizer_cfi_canonical_jump_tables_enabled() && sess.is_sanitizer_cfi_enabled() { if sess.is_sanitizer_cfi_canonical_jump_tables_enabled() && sess.is_sanitizer_cfi_enabled() {
let canonical_jump_tables = c"CFI Canonical Jump Tables".as_ptr().cast(); let canonical_jump_tables = c"CFI Canonical Jump Tables".as_ptr();
unsafe { unsafe {
llvm::LLVMRustAddModuleFlagU32( llvm::LLVMRustAddModuleFlagU32(
llmod, llmod,
@ -228,7 +228,7 @@ pub unsafe fn create_module<'ll>(
// Enable LTO unit splitting if specified or if CFI is enabled. (See https://reviews.llvm.org/D53891.) // Enable LTO unit splitting if specified or if CFI is enabled. (See https://reviews.llvm.org/D53891.)
if sess.is_split_lto_unit_enabled() || sess.is_sanitizer_cfi_enabled() { if sess.is_split_lto_unit_enabled() || sess.is_sanitizer_cfi_enabled() {
let enable_split_lto_unit = c"EnableSplitLTOUnit".as_ptr().cast(); let enable_split_lto_unit = c"EnableSplitLTOUnit".as_ptr();
unsafe { unsafe {
llvm::LLVMRustAddModuleFlagU32( llvm::LLVMRustAddModuleFlagU32(
llmod, llmod,
@ -241,7 +241,7 @@ pub unsafe fn create_module<'ll>(
// Add "kcfi" module flag if KCFI is enabled. (See https://reviews.llvm.org/D119296.) // Add "kcfi" module flag if KCFI is enabled. (See https://reviews.llvm.org/D119296.)
if sess.is_sanitizer_kcfi_enabled() { if sess.is_sanitizer_kcfi_enabled() {
let kcfi = c"kcfi".as_ptr().cast(); let kcfi = c"kcfi".as_ptr();
unsafe { unsafe {
llvm::LLVMRustAddModuleFlagU32(llmod, llvm::LLVMModFlagBehavior::Override, kcfi, 1); llvm::LLVMRustAddModuleFlagU32(llmod, llvm::LLVMModFlagBehavior::Override, kcfi, 1);
} }
@ -280,26 +280,26 @@ pub unsafe fn create_module<'ll>(
llvm::LLVMRustAddModuleFlagU32( llvm::LLVMRustAddModuleFlagU32(
llmod, llmod,
llvm::LLVMModFlagBehavior::Min, llvm::LLVMModFlagBehavior::Min,
c"branch-target-enforcement".as_ptr().cast(), c"branch-target-enforcement".as_ptr(),
bti.into(), bti.into(),
); );
llvm::LLVMRustAddModuleFlagU32( llvm::LLVMRustAddModuleFlagU32(
llmod, llmod,
llvm::LLVMModFlagBehavior::Min, llvm::LLVMModFlagBehavior::Min,
c"sign-return-address".as_ptr().cast(), c"sign-return-address".as_ptr(),
pac_ret.is_some().into(), pac_ret.is_some().into(),
); );
let pac_opts = pac_ret.unwrap_or(PacRet { leaf: false, key: PAuthKey::A }); let pac_opts = pac_ret.unwrap_or(PacRet { leaf: false, key: PAuthKey::A });
llvm::LLVMRustAddModuleFlagU32( llvm::LLVMRustAddModuleFlagU32(
llmod, llmod,
llvm::LLVMModFlagBehavior::Min, llvm::LLVMModFlagBehavior::Min,
c"sign-return-address-all".as_ptr().cast(), c"sign-return-address-all".as_ptr(),
pac_opts.leaf.into(), pac_opts.leaf.into(),
); );
llvm::LLVMRustAddModuleFlagU32( llvm::LLVMRustAddModuleFlagU32(
llmod, llmod,
llvm::LLVMModFlagBehavior::Min, llvm::LLVMModFlagBehavior::Min,
c"sign-return-address-with-bkey".as_ptr().cast(), c"sign-return-address-with-bkey".as_ptr(),
u32::from(pac_opts.key == PAuthKey::B), u32::from(pac_opts.key == PAuthKey::B),
); );
} }
@ -317,7 +317,7 @@ pub unsafe fn create_module<'ll>(
llvm::LLVMRustAddModuleFlagU32( llvm::LLVMRustAddModuleFlagU32(
llmod, llmod,
llvm::LLVMModFlagBehavior::Override, llvm::LLVMModFlagBehavior::Override,
c"cf-protection-branch".as_ptr().cast(), c"cf-protection-branch".as_ptr(),
1, 1,
); );
} }
@ -327,7 +327,7 @@ pub unsafe fn create_module<'ll>(
llvm::LLVMRustAddModuleFlagU32( llvm::LLVMRustAddModuleFlagU32(
llmod, llmod,
llvm::LLVMModFlagBehavior::Override, llvm::LLVMModFlagBehavior::Override,
c"cf-protection-return".as_ptr().cast(), c"cf-protection-return".as_ptr(),
1, 1,
); );
} }
@ -338,7 +338,7 @@ pub unsafe fn create_module<'ll>(
llvm::LLVMRustAddModuleFlagU32( llvm::LLVMRustAddModuleFlagU32(
llmod, llmod,
llvm::LLVMModFlagBehavior::Error, llvm::LLVMModFlagBehavior::Error,
c"Virtual Function Elim".as_ptr().cast(), c"Virtual Function Elim".as_ptr(),
1, 1,
); );
} }

View File

@ -34,8 +34,7 @@ pub fn get_or_insert_gdb_debug_scripts_section_global<'ll>(cx: &CodegenCx<'ll, '
let c_section_var_name = c"__rustc_debug_gdb_scripts_section__"; let c_section_var_name = c"__rustc_debug_gdb_scripts_section__";
let section_var_name = c_section_var_name.to_str().unwrap(); let section_var_name = c_section_var_name.to_str().unwrap();
let section_var = let section_var = unsafe { llvm::LLVMGetNamedGlobal(cx.llmod, c_section_var_name.as_ptr()) };
unsafe { llvm::LLVMGetNamedGlobal(cx.llmod, c_section_var_name.as_ptr().cast()) };
section_var.unwrap_or_else(|| { section_var.unwrap_or_else(|| {
let mut section_contents = Vec::new(); let mut section_contents = Vec::new();
@ -70,7 +69,7 @@ pub fn get_or_insert_gdb_debug_scripts_section_global<'ll>(cx: &CodegenCx<'ll, '
let section_var = cx let section_var = cx
.define_global(section_var_name, llvm_type) .define_global(section_var_name, llvm_type)
.unwrap_or_else(|| bug!("symbol `{}` is already defined", section_var_name)); .unwrap_or_else(|| bug!("symbol `{}` is already defined", section_var_name));
llvm::LLVMSetSection(section_var, c".debug_gdb_scripts".as_ptr().cast()); llvm::LLVMSetSection(section_var, c".debug_gdb_scripts".as_ptr());
llvm::LLVMSetInitializer(section_var, cx.const_bytes(section_contents)); llvm::LLVMSetInitializer(section_var, cx.const_bytes(section_contents));
llvm::LLVMSetGlobalConstant(section_var, llvm::True); llvm::LLVMSetGlobalConstant(section_var, llvm::True);
llvm::LLVMSetUnnamedAddress(section_var, llvm::UnnamedAddr::Global); llvm::LLVMSetUnnamedAddress(section_var, llvm::UnnamedAddr::Global);

View File

@ -952,7 +952,7 @@ pub fn build_compile_unit_di_node<'ll, 'tcx>(
producer.as_ptr().cast(), producer.as_ptr().cast(),
producer.len(), producer.len(),
tcx.sess.opts.optimize != config::OptLevel::No, tcx.sess.opts.optimize != config::OptLevel::No,
c"".as_ptr().cast(), c"".as_ptr(),
0, 0,
// NB: this doesn't actually have any perceptible effect, it seems. LLVM will instead // NB: this doesn't actually have any perceptible effect, it seems. LLVM will instead
// put the path supplied to `MCSplitDwarfFile` into the debug info of the final // put the path supplied to `MCSplitDwarfFile` into the debug info of the final

View File

@ -109,7 +109,7 @@ impl<'ll, 'tcx> CodegenUnitDebugContext<'ll, 'tcx> {
llvm::LLVMRustAddModuleFlagU32( llvm::LLVMRustAddModuleFlagU32(
self.llmod, self.llmod,
llvm::LLVMModFlagBehavior::Warning, llvm::LLVMModFlagBehavior::Warning,
c"Dwarf Version".as_ptr().cast(), c"Dwarf Version".as_ptr(),
dwarf_version, dwarf_version,
); );
} else { } else {
@ -117,7 +117,7 @@ impl<'ll, 'tcx> CodegenUnitDebugContext<'ll, 'tcx> {
llvm::LLVMRustAddModuleFlagU32( llvm::LLVMRustAddModuleFlagU32(
self.llmod, self.llmod,
llvm::LLVMModFlagBehavior::Warning, llvm::LLVMModFlagBehavior::Warning,
c"CodeView".as_ptr().cast(), c"CodeView".as_ptr(),
1, 1,
) )
} }
@ -126,7 +126,7 @@ impl<'ll, 'tcx> CodegenUnitDebugContext<'ll, 'tcx> {
llvm::LLVMRustAddModuleFlagU32( llvm::LLVMRustAddModuleFlagU32(
self.llmod, self.llmod,
llvm::LLVMModFlagBehavior::Warning, llvm::LLVMModFlagBehavior::Warning,
c"Debug Info Version".as_ptr().cast(), c"Debug Info Version".as_ptr(),
llvm::LLVMRustDebugMetadataVersion(), llvm::LLVMRustDebugMetadataVersion(),
); );
} }
@ -570,7 +570,17 @@ impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
inlined_at: Option<&'ll DILocation>, inlined_at: Option<&'ll DILocation>,
span: Span, span: Span,
) -> &'ll DILocation { ) -> &'ll DILocation {
let DebugLoc { line, col, .. } = self.lookup_debug_loc(span.lo()); // When emitting debugging information, DWARF (i.e. everything but MSVC)
// treats line 0 as a magic value meaning that the code could not be
// attributed to any line in the source. That's also exactly what dummy
// spans are. Make that equivalence here, rather than passing dummy spans
// to lookup_debug_loc, which will return line 1 for them.
let (line, col) = if span.is_dummy() && !self.sess().target.is_like_msvc {
(0, 0)
} else {
let DebugLoc { line, col, .. } = self.lookup_debug_loc(span.lo());
(line, col)
};
unsafe { llvm::LLVMRustDIBuilderCreateDebugLocation(line, col, scope, inlined_at) } unsafe { llvm::LLVMRustDIBuilderCreateDebugLocation(line, col, scope, inlined_at) }
} }

View File

@ -1500,7 +1500,7 @@ impl<'a> Linker for L4Bender<'a> {
impl<'a> L4Bender<'a> { impl<'a> L4Bender<'a> {
pub fn new(cmd: Command, sess: &'a Session) -> L4Bender<'a> { pub fn new(cmd: Command, sess: &'a Session) -> L4Bender<'a> {
L4Bender { cmd, sess: sess, hinted_static: false } L4Bender { cmd, sess, hinted_static: false }
} }
fn hint_static(&mut self) { fn hint_static(&mut self) {
@ -1520,7 +1520,7 @@ pub struct AixLinker<'a> {
impl<'a> AixLinker<'a> { impl<'a> AixLinker<'a> {
pub fn new(cmd: Command, sess: &'a Session) -> AixLinker<'a> { pub fn new(cmd: Command, sess: &'a Session) -> AixLinker<'a> {
AixLinker { cmd, sess: sess, hinted_static: None } AixLinker { cmd, sess, hinted_static: None }
} }
fn hint_static(&mut self) { fn hint_static(&mut self) {

View File

@ -384,7 +384,7 @@ impl<'tcx> NonConstOp<'tcx> for HeapAllocation {
ccx.dcx().create_err(errors::UnallowedHeapAllocations { ccx.dcx().create_err(errors::UnallowedHeapAllocations {
span, span,
kind: ccx.const_kind(), kind: ccx.const_kind(),
teach: ccx.tcx.sess.teach(E0010).then_some(()), teach: ccx.tcx.sess.teach(E0010),
}) })
} }
} }
@ -444,16 +444,16 @@ impl<'tcx> NonConstOp<'tcx> for CellBorrow {
if let hir::ConstContext::Static(_) = ccx.const_kind() { if let hir::ConstContext::Static(_) = ccx.const_kind() {
ccx.dcx().create_err(errors::InteriorMutableDataRefer { ccx.dcx().create_err(errors::InteriorMutableDataRefer {
span, span,
opt_help: Some(()), opt_help: true,
kind: ccx.const_kind(), kind: ccx.const_kind(),
teach: ccx.tcx.sess.teach(E0492).then_some(()), teach: ccx.tcx.sess.teach(E0492),
}) })
} else { } else {
ccx.dcx().create_err(errors::InteriorMutableDataRefer { ccx.dcx().create_err(errors::InteriorMutableDataRefer {
span, span,
opt_help: None, opt_help: false,
kind: ccx.const_kind(), kind: ccx.const_kind(),
teach: ccx.tcx.sess.teach(E0492).then_some(()), teach: ccx.tcx.sess.teach(E0492),
}) })
} }
} }
@ -481,12 +481,12 @@ impl<'tcx> NonConstOp<'tcx> for MutBorrow {
hir::BorrowKind::Raw => ccx.tcx.dcx().create_err(errors::UnallowedMutableRaw { hir::BorrowKind::Raw => ccx.tcx.dcx().create_err(errors::UnallowedMutableRaw {
span, span,
kind: ccx.const_kind(), kind: ccx.const_kind(),
teach: ccx.tcx.sess.teach(E0764).then_some(()), teach: ccx.tcx.sess.teach(E0764),
}), }),
hir::BorrowKind::Ref => ccx.dcx().create_err(errors::UnallowedMutableRefs { hir::BorrowKind::Ref => ccx.dcx().create_err(errors::UnallowedMutableRefs {
span, span,
kind: ccx.const_kind(), kind: ccx.const_kind(),
teach: ccx.tcx.sess.teach(E0764).then_some(()), teach: ccx.tcx.sess.teach(E0764),
}), }),
} }
} }

View File

@ -151,7 +151,7 @@ pub(crate) struct UnallowedMutableRefs {
pub span: Span, pub span: Span,
pub kind: ConstContext, pub kind: ConstContext,
#[note(const_eval_teach_note)] #[note(const_eval_teach_note)]
pub teach: Option<()>, pub teach: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
@ -161,7 +161,7 @@ pub(crate) struct UnallowedMutableRaw {
pub span: Span, pub span: Span,
pub kind: ConstContext, pub kind: ConstContext,
#[note(const_eval_teach_note)] #[note(const_eval_teach_note)]
pub teach: Option<()>, pub teach: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(const_eval_non_const_fmt_macro_call, code = E0015)] #[diag(const_eval_non_const_fmt_macro_call, code = E0015)]
@ -196,7 +196,7 @@ pub(crate) struct UnallowedHeapAllocations {
pub span: Span, pub span: Span,
pub kind: ConstContext, pub kind: ConstContext,
#[note(const_eval_teach_note)] #[note(const_eval_teach_note)]
pub teach: Option<()>, pub teach: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
@ -214,10 +214,10 @@ pub(crate) struct InteriorMutableDataRefer {
#[label] #[label]
pub span: Span, pub span: Span,
#[help] #[help]
pub opt_help: Option<()>, pub opt_help: bool,
pub kind: ConstContext, pub kind: ConstContext,
#[note(const_eval_teach_note)] #[note(const_eval_teach_note)]
pub teach: Option<()>, pub teach: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]

View File

@ -281,7 +281,7 @@ pub(crate) struct IncompleteParse<'a> {
pub macro_path: &'a ast::Path, pub macro_path: &'a ast::Path,
pub kind_name: &'a str, pub kind_name: &'a str,
#[note(expand_macro_expands_to_match_arm)] #[note(expand_macro_expands_to_match_arm)]
pub expands_to_match_arm: Option<()>, pub expands_to_match_arm: bool,
#[suggestion( #[suggestion(
expand_suggestion_add_semi, expand_suggestion_add_semi,

View File

@ -1031,7 +1031,7 @@ pub(crate) fn ensure_complete_parse<'a>(
label_span: span, label_span: span,
macro_path, macro_path,
kind_name, kind_name,
expands_to_match_arm: expands_to_match_arm.then_some(()), expands_to_match_arm,
add_semicolon, add_semicolon,
}); });
} }

View File

@ -1564,7 +1564,7 @@ fn check_type_alias_type_params_are_used<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalD
// * compare the param span to the pred span to detect lone user-written `Sized` bounds // * compare the param span to the pred span to detect lone user-written `Sized` bounds
let has_explicit_bounds = bounded_params.is_empty() let has_explicit_bounds = bounded_params.is_empty()
|| (*bounded_params).get(&param.index).is_some_and(|&&pred_sp| pred_sp != span); || (*bounded_params).get(&param.index).is_some_and(|&&pred_sp| pred_sp != span);
let const_param_help = (!has_explicit_bounds).then_some(()); let const_param_help = !has_explicit_bounds;
let mut diag = tcx.dcx().create_err(errors::UnusedGenericParameter { let mut diag = tcx.dcx().create_err(errors::UnusedGenericParameter {
span, span,

View File

@ -216,7 +216,7 @@ fn check_start_fn_ty(tcx: TyCtxt<'_>, start_def_id: DefId) {
} }
if sig.header.asyncness.is_async() { if sig.header.asyncness.is_async() {
let span = tcx.def_span(it.owner_id); let span = tcx.def_span(it.owner_id);
tcx.dcx().emit_err(errors::StartAsync { span: span }); tcx.dcx().emit_err(errors::StartAsync { span });
error = true; error = true;
} }

View File

@ -1972,8 +1972,7 @@ fn report_bivariance<'tcx>(
} }
let const_param_help = let const_param_help =
matches!(param.kind, hir::GenericParamKind::Type { .. } if !has_explicit_bounds) matches!(param.kind, hir::GenericParamKind::Type { .. } if !has_explicit_bounds);
.then_some(());
let mut diag = tcx.dcx().create_err(errors::UnusedGenericParameter { let mut diag = tcx.dcx().create_err(errors::UnusedGenericParameter {
span: param.span, span: param.span,

View File

@ -1606,7 +1606,7 @@ pub(crate) struct UnusedGenericParameter {
#[subdiagnostic] #[subdiagnostic]
pub help: UnusedGenericParameterHelp, pub help: UnusedGenericParameterHelp,
#[help(hir_analysis_const_param_help)] #[help(hir_analysis_const_param_help)]
pub const_param_help: Option<()>, pub const_param_help: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
@ -1643,9 +1643,9 @@ pub(crate) struct UnconstrainedGenericParameter {
pub param_name: Symbol, pub param_name: Symbol,
pub param_def_kind: &'static str, pub param_def_kind: &'static str,
#[note(hir_analysis_const_param_note)] #[note(hir_analysis_const_param_note)]
pub const_param_note: Option<()>, pub const_param_note: bool,
#[note(hir_analysis_const_param_note2)] #[note(hir_analysis_const_param_note2)]
pub const_param_note2: Option<()>, pub const_param_note2: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]

View File

@ -959,11 +959,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
\n where\n T: {qself_str},\n{}", \n where\n T: {qself_str},\n{}",
where_bounds.join(",\n"), where_bounds.join(",\n"),
)); ));
} let reported = err.emit();
let reported = err.emit();
if !where_bounds.is_empty() {
return Err(reported); return Err(reported);
} }
err.emit();
} }
Ok(bound) Ok(bound)

View File

@ -137,8 +137,7 @@ fn enforce_impl_params_are_constrained(
} }
}; };
if err { if err {
let const_param_note = let const_param_note = matches!(param.kind, ty::GenericParamDefKind::Const { .. });
matches!(param.kind, ty::GenericParamDefKind::Const { .. }).then_some(());
let mut diag = tcx.dcx().create_err(UnconstrainedGenericParameter { let mut diag = tcx.dcx().create_err(UnconstrainedGenericParameter {
span: tcx.def_span(param.def_id), span: tcx.def_span(param.def_id),
param_name: param.name, param_name: param.name,

View File

@ -505,7 +505,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
span: self.span, span: self.span,
expr_ty: self.expr_ty, expr_ty: self.expr_ty,
cast_ty: fcx.ty_to_string(self.cast_ty), cast_ty: fcx.ty_to_string(self.cast_ty),
teach: fcx.tcx.sess.teach(E0607).then_some(()), teach: fcx.tcx.sess.teach(E0607),
}); });
} }
CastError::IntToFatCast(known_metadata) => { CastError::IntToFatCast(known_metadata) => {

View File

@ -706,7 +706,7 @@ pub(crate) struct CastThinPointerToFatPointer<'tcx> {
pub expr_ty: Ty<'tcx>, pub expr_ty: Ty<'tcx>,
pub cast_ty: String, pub cast_ty: String,
#[note(hir_typeck_teach_help)] #[note(hir_typeck_teach_help)]
pub(crate) teach: Option<()>, pub(crate) teach: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
@ -720,7 +720,7 @@ pub(crate) struct PassToVariadicFunction<'tcx, 'a> {
pub sugg_span: Option<Span>, pub sugg_span: Option<Span>,
pub replace: String, pub replace: String,
#[help] #[help]
pub help: Option<()>, pub help: bool,
#[note(hir_typeck_teach_help)] #[note(hir_typeck_teach_help)]
pub(crate) teach: Option<()>, pub(crate) teach: bool,
} }

View File

@ -406,9 +406,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
) { ) {
let (sugg_span, replace, help) = let (sugg_span, replace, help) =
if let Ok(snippet) = sess.source_map().span_to_snippet(span) { if let Ok(snippet) = sess.source_map().span_to_snippet(span) {
(Some(span), format!("{snippet} as {cast_ty}"), None) (Some(span), format!("{snippet} as {cast_ty}"), false)
} else { } else {
(None, "".to_string(), Some(())) (None, "".to_string(), true)
}; };
sess.dcx().emit_err(errors::PassToVariadicFunction { sess.dcx().emit_err(errors::PassToVariadicFunction {
@ -418,7 +418,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
help, help,
replace, replace,
sugg_span, sugg_span,
teach: sess.teach(E0617).then_some(()), teach: sess.teach(E0617),
}); });
} }

View File

@ -527,7 +527,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
{ {
if self.check_and_add_sugg_binding(LetStmt { if self.check_and_add_sugg_binding(LetStmt {
ty_hir_id_opt: if let Some(ty) = ty { Some(ty.hir_id) } else { None }, ty_hir_id_opt: if let Some(ty) = ty { Some(ty.hir_id) } else { None },
binding_id: binding_id, binding_id,
span: pat.span, span: pat.span,
init_hir_id: init.hir_id, init_hir_id: init.hir_id,
}) { }) {

View File

@ -189,10 +189,10 @@ pub struct CreateLock<'a> {
pub lock_err: std::io::Error, pub lock_err: std::io::Error,
pub session_dir: &'a Path, pub session_dir: &'a Path,
#[note(incremental_lock_unsupported)] #[note(incremental_lock_unsupported)]
pub is_unsupported_lock: Option<()>, pub is_unsupported_lock: bool,
#[help(incremental_cargo_help_1)] #[help(incremental_cargo_help_1)]
#[help(incremental_cargo_help_2)] #[help(incremental_cargo_help_2)]
pub is_cargo: Option<()>, pub is_cargo: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]

View File

@ -486,12 +486,12 @@ fn lock_directory(
// the lock should be exclusive // the lock should be exclusive
Ok(lock) => Ok((lock, lock_file_path)), Ok(lock) => Ok((lock, lock_file_path)),
Err(lock_err) => { Err(lock_err) => {
let is_unsupported_lock = flock::Lock::error_unsupported(&lock_err).then_some(()); let is_unsupported_lock = flock::Lock::error_unsupported(&lock_err);
Err(sess.dcx().emit_err(errors::CreateLock { Err(sess.dcx().emit_err(errors::CreateLock {
lock_err, lock_err,
session_dir, session_dir,
is_unsupported_lock, is_unsupported_lock,
is_cargo: rustc_session::utils::was_invoked_from_cargo().then_some(()), is_cargo: rustc_session::utils::was_invoked_from_cargo(),
})) }))
} }
} }
@ -851,7 +851,7 @@ fn delete_old(sess: &Session, path: &Path) {
debug!("garbage_collect_session_directories() - deleting `{}`", path.display()); debug!("garbage_collect_session_directories() - deleting `{}`", path.display());
if let Err(err) = safe_remove_dir_all(path) { if let Err(err) = safe_remove_dir_all(path) {
sess.dcx().emit_warn(errors::SessionGcFailed { path: path, err }); sess.dcx().emit_warn(errors::SessionGcFailed { path, err });
} else { } else {
delete_session_dir_lock_file(sess, &lock_file_path(path)); delete_session_dir_lock_file(sess, &lock_file_path(path));
} }

View File

@ -1330,7 +1330,7 @@ impl UnreachablePub {
BuiltinUnreachablePub { BuiltinUnreachablePub {
what, what,
suggestion: (vis_span, applicability), suggestion: (vis_span, applicability),
help: exportable.then_some(()), help: exportable,
}, },
); );
} }

View File

@ -77,7 +77,7 @@ pub struct UnknownToolInScopedLint {
pub tool_name: Symbol, pub tool_name: Symbol,
pub lint_name: String, pub lint_name: String,
#[help] #[help]
pub is_nightly_build: Option<()>, pub is_nightly_build: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]

View File

@ -24,7 +24,7 @@ fn check_expectations(tcx: TyCtxt<'_>, tool_filter: Option<Symbol>) {
&& tool_filter.map_or(true, |filter| expectation.lint_tool == Some(filter)) && tool_filter.map_or(true, |filter| expectation.lint_tool == Some(filter))
{ {
let rationale = expectation.reason.map(|rationale| ExpectationNote { rationale }); let rationale = expectation.reason.map(|rationale| ExpectationNote { rationale });
let note = expectation.is_unfulfilled_lint_expectations.then_some(()); let note = expectation.is_unfulfilled_lint_expectations;
tcx.emit_node_span_lint( tcx.emit_node_span_lint(
UNFULFILLED_LINT_EXPECTATIONS, UNFULFILLED_LINT_EXPECTATIONS,
*hir_id, *hir_id,

View File

@ -936,7 +936,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
span: tool_ident.map(|ident| ident.span), span: tool_ident.map(|ident| ident.span),
tool_name: tool_name.unwrap(), tool_name: tool_name.unwrap(),
lint_name: pprust::path_to_string(&meta_item.path), lint_name: pprust::path_to_string(&meta_item.path),
is_nightly_build: sess.is_nightly_build().then_some(()), is_nightly_build: sess.is_nightly_build(),
}); });
continue; continue;
} }

View File

@ -257,7 +257,7 @@ pub struct BuiltinUnreachablePub<'a> {
#[suggestion(code = "pub(crate)")] #[suggestion(code = "pub(crate)")]
pub suggestion: (Span, Applicability), pub suggestion: (Span, Applicability),
#[help] #[help]
pub help: Option<()>, pub help: bool,
} }
#[derive(LintDiagnostic)] #[derive(LintDiagnostic)]
@ -572,7 +572,7 @@ pub struct Expectation {
#[subdiagnostic] #[subdiagnostic]
pub rationale: Option<ExpectationNote>, pub rationale: Option<ExpectationNote>,
#[note] #[note]
pub note: Option<()>, pub note: bool,
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
@ -756,7 +756,7 @@ pub enum InvalidReferenceCastingDiag<'tcx> {
#[label] #[label]
orig_cast: Option<Span>, orig_cast: Option<Span>,
#[note(lint_invalid_reference_casting_note_ty_has_interior_mutability)] #[note(lint_invalid_reference_casting_note_ty_has_interior_mutability)]
ty_has_interior_mutability: Option<()>, ty_has_interior_mutability: bool,
}, },
#[diag(lint_invalid_reference_casting_assign_to_ref)] #[diag(lint_invalid_reference_casting_assign_to_ref)]
#[note(lint_invalid_reference_casting_note_book)] #[note(lint_invalid_reference_casting_note_book)]
@ -764,7 +764,7 @@ pub enum InvalidReferenceCastingDiag<'tcx> {
#[label] #[label]
orig_cast: Option<Span>, orig_cast: Option<Span>,
#[note(lint_invalid_reference_casting_note_ty_has_interior_mutability)] #[note(lint_invalid_reference_casting_note_ty_has_interior_mutability)]
ty_has_interior_mutability: Option<()>, ty_has_interior_mutability: bool,
}, },
#[diag(lint_invalid_reference_casting_bigger_layout)] #[diag(lint_invalid_reference_casting_bigger_layout)]
#[note(lint_layout)] #[note(lint_layout)]

View File

@ -54,8 +54,6 @@ impl<'tcx> LateLintPass<'tcx> for InvalidReferenceCasting {
&& let Some(ty_has_interior_mutability) = && let Some(ty_has_interior_mutability) =
is_cast_from_ref_to_mut_ptr(cx, init, &mut peel_casts) is_cast_from_ref_to_mut_ptr(cx, init, &mut peel_casts)
{ {
let ty_has_interior_mutability = ty_has_interior_mutability.then_some(());
cx.emit_span_lint( cx.emit_span_lint(
INVALID_REFERENCE_CASTING, INVALID_REFERENCE_CASTING,
expr.span, expr.span,

View File

@ -1002,11 +1002,7 @@ impl CrateError {
if !locator.crate_rejections.via_filename.is_empty() { if !locator.crate_rejections.via_filename.is_empty() {
let mismatches = locator.crate_rejections.via_filename.iter(); let mismatches = locator.crate_rejections.via_filename.iter();
for CrateMismatch { path, .. } in mismatches { for CrateMismatch { path, .. } in mismatches {
dcx.emit_err(errors::CrateLocationUnknownType { dcx.emit_err(errors::CrateLocationUnknownType { span, path, crate_name });
span,
path: path,
crate_name,
});
dcx.emit_err(errors::LibFilenameForm { dcx.emit_err(errors::LibFilenameForm {
span, span,
dll_prefix: &locator.dll_prefix, dll_prefix: &locator.dll_prefix,
@ -1035,7 +1031,7 @@ impl CrateError {
} }
dcx.emit_err(errors::NewerCrateVersion { dcx.emit_err(errors::NewerCrateVersion {
span, span,
crate_name: crate_name, crate_name,
add_info, add_info,
found_crates, found_crates,
}); });

View File

@ -160,7 +160,7 @@ pub struct TypeLengthLimit {
pub span: Span, pub span: Span,
pub shrunk: String, pub shrunk: String,
#[note(middle_written_to_path)] #[note(middle_written_to_path)]
pub was_written: Option<()>, pub was_written: bool,
pub path: PathBuf, pub path: PathBuf,
pub type_length: usize, pub type_length: usize,
} }

View File

@ -395,7 +395,7 @@ pub enum StatementKind<'tcx> {
/// `PlaceMention(PLACE)`. /// `PlaceMention(PLACE)`.
/// ///
/// When executed at runtime, this computes the given place, but then discards /// When executed at runtime, this computes the given place, but then discards
/// it without doing a load. It is UB if the place is not pointing to live memory. /// it without doing a load. `let _ = *ptr;` is fine even if the pointer is dangling.
PlaceMention(Box<Place<'tcx>>), PlaceMention(Box<Place<'tcx>>),
/// Encodes a user's type ascription. These need to be preserved /// Encodes a user's type ascription. These need to be preserved

View File

@ -581,9 +581,9 @@ impl<'tcx> Instance<'tcx> {
let mut path = PathBuf::new(); let mut path = PathBuf::new();
let was_written = if let Some(path2) = written_to_path { let was_written = if let Some(path2) = written_to_path {
path = path2; path = path2;
Some(()) true
} else { } else {
None false
}; };
tcx.dcx().emit_fatal(error::TypeLengthLimit { tcx.dcx().emit_fatal(error::TypeLengthLimit {
// We don't use `def_span(def_id)` so that diagnostics point // We don't use `def_span(def_id)` so that diagnostics point

View File

@ -327,14 +327,17 @@ mir_build_union_pattern = cannot use unions in constant patterns
mir_build_unreachable_making_this_unreachable = collectively making this unreachable mir_build_unreachable_making_this_unreachable = collectively making this unreachable
mir_build_unreachable_making_this_unreachable_n_more = ...and {$covered_by_many_n_more_count} other patterns collectively make this unreachable
mir_build_unreachable_matches_same_values = matches some of the same values mir_build_unreachable_matches_same_values = matches some of the same values
mir_build_unreachable_pattern = unreachable pattern mir_build_unreachable_pattern = unreachable pattern
.label = unreachable pattern .label = no value can reach this
.unreachable_matches_no_values = this pattern matches no values because `{$ty}` is uninhabited .unreachable_matches_no_values = matches no values because `{$matches_no_values_ty}` is uninhabited
.unreachable_uninhabited_note = to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
.unreachable_covered_by_catchall = matches any value .unreachable_covered_by_catchall = matches any value
.unreachable_covered_by_one = matches all the values already .unreachable_covered_by_one = matches all the relevant values
.unreachable_covered_by_many = these patterns collectively make the last one unreachable .unreachable_covered_by_many = multiple earlier patterns match some of the same values
mir_build_unsafe_fn_safe_body = an unsafe function restricts its caller, but its body is safe by default mir_build_unsafe_fn_safe_body = an unsafe function restricts its caller, but its body is safe by default
mir_build_unsafe_not_inherited = items do not inherit unsafety from separate enclosing items mir_build_unsafe_not_inherited = items do not inherit unsafety from separate enclosing items

View File

@ -793,7 +793,7 @@ impl UnsafeOpKind {
missing.iter().map(|feature| Cow::from(feature.to_string())).collect(), missing.iter().map(|feature| Cow::from(feature.to_string())).collect(),
), ),
missing_target_features_count: missing.len(), missing_target_features_count: missing.len(),
note: if build_enabled.is_empty() { None } else { Some(()) }, note: !build_enabled.is_empty(),
build_target_features: DiagArgValue::StrListSepByAnd( build_target_features: DiagArgValue::StrListSepByAnd(
build_enabled build_enabled
.iter() .iter()
@ -958,7 +958,7 @@ impl UnsafeOpKind {
missing.iter().map(|feature| Cow::from(feature.to_string())).collect(), missing.iter().map(|feature| Cow::from(feature.to_string())).collect(),
), ),
missing_target_features_count: missing.len(), missing_target_features_count: missing.len(),
note: if build_enabled.is_empty() { None } else { Some(()) }, note: !build_enabled.is_empty(),
build_target_features: DiagArgValue::StrListSepByAnd( build_target_features: DiagArgValue::StrListSepByAnd(
build_enabled build_enabled
.iter() .iter()
@ -977,7 +977,7 @@ impl UnsafeOpKind {
missing.iter().map(|feature| Cow::from(feature.to_string())).collect(), missing.iter().map(|feature| Cow::from(feature.to_string())).collect(),
), ),
missing_target_features_count: missing.len(), missing_target_features_count: missing.len(),
note: if build_enabled.is_empty() { None } else { Some(()) }, note: !build_enabled.is_empty(),
build_target_features: DiagArgValue::StrListSepByAnd( build_target_features: DiagArgValue::StrListSepByAnd(
build_enabled build_enabled
.iter() .iter()

View File

@ -161,7 +161,7 @@ pub(crate) struct UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe {
pub(crate) missing_target_features: DiagArgValue, pub(crate) missing_target_features: DiagArgValue,
pub(crate) missing_target_features_count: usize, pub(crate) missing_target_features_count: usize,
#[note] #[note]
pub(crate) note: Option<()>, pub(crate) note: bool,
pub(crate) build_target_features: DiagArgValue, pub(crate) build_target_features: DiagArgValue,
pub(crate) build_target_features_count: usize, pub(crate) build_target_features_count: usize,
#[subdiagnostic] #[subdiagnostic]
@ -413,7 +413,7 @@ pub(crate) struct CallToFunctionWithRequiresUnsafe {
pub(crate) missing_target_features: DiagArgValue, pub(crate) missing_target_features: DiagArgValue,
pub(crate) missing_target_features_count: usize, pub(crate) missing_target_features_count: usize,
#[note] #[note]
pub(crate) note: Option<()>, pub(crate) note: bool,
pub(crate) build_target_features: DiagArgValue, pub(crate) build_target_features: DiagArgValue,
pub(crate) build_target_features_count: usize, pub(crate) build_target_features_count: usize,
#[subdiagnostic] #[subdiagnostic]
@ -431,7 +431,7 @@ pub(crate) struct CallToFunctionWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
pub(crate) missing_target_features: DiagArgValue, pub(crate) missing_target_features: DiagArgValue,
pub(crate) missing_target_features_count: usize, pub(crate) missing_target_features_count: usize,
#[note] #[note]
pub(crate) note: Option<()>, pub(crate) note: bool,
pub(crate) build_target_features: DiagArgValue, pub(crate) build_target_features: DiagArgValue,
pub(crate) build_target_features_count: usize, pub(crate) build_target_features_count: usize,
#[subdiagnostic] #[subdiagnostic]
@ -586,20 +586,18 @@ pub(crate) struct NonConstPath {
pub(crate) struct UnreachablePattern<'tcx> { pub(crate) struct UnreachablePattern<'tcx> {
#[label] #[label]
pub(crate) span: Option<Span>, pub(crate) span: Option<Span>,
#[subdiagnostic] #[label(mir_build_unreachable_matches_no_values)]
pub(crate) matches_no_values: Option<UnreachableMatchesNoValues<'tcx>>, pub(crate) matches_no_values: Option<Span>,
pub(crate) matches_no_values_ty: Ty<'tcx>,
#[note(mir_build_unreachable_uninhabited_note)]
pub(crate) uninhabited_note: Option<()>,
#[label(mir_build_unreachable_covered_by_catchall)] #[label(mir_build_unreachable_covered_by_catchall)]
pub(crate) covered_by_catchall: Option<Span>, pub(crate) covered_by_catchall: Option<Span>,
#[label(mir_build_unreachable_covered_by_one)] #[label(mir_build_unreachable_covered_by_one)]
pub(crate) covered_by_one: Option<Span>, pub(crate) covered_by_one: Option<Span>,
#[note(mir_build_unreachable_covered_by_many)] #[note(mir_build_unreachable_covered_by_many)]
pub(crate) covered_by_many: Option<MultiSpan>, pub(crate) covered_by_many: Option<MultiSpan>,
} pub(crate) covered_by_many_n_more_count: usize,
#[derive(Subdiagnostic)]
#[note(mir_build_unreachable_matches_no_values)]
pub(crate) struct UnreachableMatchesNoValues<'tcx> {
pub(crate) ty: Ty<'tcx>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
@ -623,7 +621,7 @@ pub(crate) struct LowerRangeBoundMustBeLessThanOrEqualToUpper {
#[label] #[label]
pub(crate) span: Span, pub(crate) span: Span,
#[note(mir_build_teach_note)] #[note(mir_build_teach_note)]
pub(crate) teach: Option<()>, pub(crate) teach: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
@ -865,7 +863,7 @@ pub(crate) struct PatternNotCovered<'s, 'tcx> {
#[subdiagnostic] #[subdiagnostic]
pub(crate) adt_defined_here: Option<AdtDefinedHere<'tcx>>, pub(crate) adt_defined_here: Option<AdtDefinedHere<'tcx>>,
#[note(mir_build_privately_uninhabited)] #[note(mir_build_privately_uninhabited)]
pub(crate) witness_1_is_privately_uninhabited: Option<()>, pub(crate) witness_1_is_privately_uninhabited: bool,
#[note(mir_build_pattern_ty)] #[note(mir_build_pattern_ty)]
pub(crate) _p: (), pub(crate) _p: (),
pub(crate) pattern_ty: Ty<'tcx>, pub(crate) pattern_ty: Ty<'tcx>,

View File

@ -218,12 +218,7 @@ impl<'tcx> Cx<'tcx> {
let lhs = let lhs =
self.thir.exprs.push(Expr { temp_lifetime, ty: discr_ty, span, kind }); self.thir.exprs.push(Expr { temp_lifetime, ty: discr_ty, span, kind });
let bin = ExprKind::Binary { op: BinOp::Add, lhs, rhs: offset }; let bin = ExprKind::Binary { op: BinOp::Add, lhs, rhs: offset };
self.thir.exprs.push(Expr { self.thir.exprs.push(Expr { temp_lifetime, ty: discr_ty, span, kind: bin })
temp_lifetime,
ty: discr_ty,
span: span,
kind: bin,
})
} }
None => offset, None => offset,
}; };

View File

@ -718,7 +718,7 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
uncovered: Uncovered::new(pat.span, &cx, witnesses), uncovered: Uncovered::new(pat.span, &cx, witnesses),
inform, inform,
interpreted_as_const, interpreted_as_const,
witness_1_is_privately_uninhabited: witness_1_is_privately_uninhabited.then_some(()), witness_1_is_privately_uninhabited,
_p: (), _p: (),
pattern_ty, pattern_ty,
let_suggestion, let_suggestion,
@ -917,22 +917,28 @@ fn report_unreachable_pattern<'p, 'tcx>(
pat: &DeconstructedPat<'p, 'tcx>, pat: &DeconstructedPat<'p, 'tcx>,
explanation: &RedundancyExplanation<'p, 'tcx>, explanation: &RedundancyExplanation<'p, 'tcx>,
) { ) {
static CAP_COVERED_BY_MANY: usize = 4;
let pat_span = pat.data().span; let pat_span = pat.data().span;
let mut lint = UnreachablePattern { let mut lint = UnreachablePattern {
span: Some(pat_span), span: Some(pat_span),
matches_no_values: None, matches_no_values: None,
matches_no_values_ty: **pat.ty(),
uninhabited_note: None,
covered_by_catchall: None, covered_by_catchall: None,
covered_by_one: None, covered_by_one: None,
covered_by_many: None, covered_by_many: None,
covered_by_many_n_more_count: 0,
}; };
match explanation.covered_by.as_slice() { match explanation.covered_by.as_slice() {
[] => { [] => {
// Empty pattern; we report the uninhabited type that caused the emptiness. // Empty pattern; we report the uninhabited type that caused the emptiness.
lint.span = None; // Don't label the pattern itself lint.span = None; // Don't label the pattern itself
lint.uninhabited_note = Some(()); // Give a link about empty types
lint.matches_no_values = Some(pat_span);
pat.walk(&mut |subpat| { pat.walk(&mut |subpat| {
let ty = **subpat.ty(); let ty = **subpat.ty();
if cx.is_uninhabited(ty) { if cx.is_uninhabited(ty) {
lint.matches_no_values = Some(UnreachableMatchesNoValues { ty }); lint.matches_no_values_ty = ty;
false // No need to dig further. false // No need to dig further.
} else if matches!(subpat.ctor(), Constructor::Ref | Constructor::UnionField) { } else if matches!(subpat.ctor(), Constructor::Ref | Constructor::UnionField) {
false // Don't explore further since they are not by-value. false // Don't explore further since they are not by-value.
@ -948,15 +954,27 @@ fn report_unreachable_pattern<'p, 'tcx>(
lint.covered_by_one = Some(covering_pat.data().span); lint.covered_by_one = Some(covering_pat.data().span);
} }
covering_pats => { covering_pats => {
let mut iter = covering_pats.iter();
let mut multispan = MultiSpan::from_span(pat_span); let mut multispan = MultiSpan::from_span(pat_span);
for p in covering_pats { for p in iter.by_ref().take(CAP_COVERED_BY_MANY) {
multispan.push_span_label( multispan.push_span_label(
p.data().span, p.data().span,
fluent::mir_build_unreachable_matches_same_values, fluent::mir_build_unreachable_matches_same_values,
); );
} }
multispan let remain = iter.count();
.push_span_label(pat_span, fluent::mir_build_unreachable_making_this_unreachable); if remain == 0 {
multispan.push_span_label(
pat_span,
fluent::mir_build_unreachable_making_this_unreachable,
);
} else {
lint.covered_by_many_n_more_count = remain;
multispan.push_span_label(
pat_span,
fluent::mir_build_unreachable_making_this_unreachable_n_more,
);
}
lint.covered_by_many = Some(multispan); lint.covered_by_many = Some(multispan);
} }
} }

View File

@ -129,7 +129,7 @@ impl<'tcx> ConstToPat<'tcx> {
let err = TypeNotPartialEq { span: self.span, non_peq_ty: ty }; let err = TypeNotPartialEq { span: self.span, non_peq_ty: ty };
let e = self.tcx().dcx().emit_err(err); let e = self.tcx().dcx().emit_err(err);
let kind = PatKind::Error(e); let kind = PatKind::Error(e);
return Box::new(Pat { span: self.span, ty: ty, kind }); return Box::new(Pat { span: self.span, ty, kind });
} }
} }

View File

@ -256,7 +256,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
RangeEnd::Included => { RangeEnd::Included => {
self.tcx.dcx().emit_err(LowerRangeBoundMustBeLessThanOrEqualToUpper { self.tcx.dcx().emit_err(LowerRangeBoundMustBeLessThanOrEqualToUpper {
span, span,
teach: self.tcx.sess.teach(E0030).then_some(()), teach: self.tcx.sess.teach(E0030),
}) })
} }
RangeEnd::Excluded => { RangeEnd::Excluded => {

View File

@ -931,7 +931,7 @@ fn compute_storage_conflicts<'mir, 'tcx>(
// Compute the storage conflicts for all eligible locals. // Compute the storage conflicts for all eligible locals.
let mut visitor = StorageConflictVisitor { let mut visitor = StorageConflictVisitor {
body, body,
saved_locals: saved_locals, saved_locals,
local_conflicts: BitMatrix::from_row_n(&ineligible_locals, body.local_decls.len()), local_conflicts: BitMatrix::from_row_n(&ineligible_locals, body.local_decls.len()),
eligible_storage_live: BitSet::new_empty(body.local_decls.len()), eligible_storage_live: BitSet::new_empty(body.local_decls.len()),
}; };

View File

@ -338,7 +338,7 @@ impl<'a, 'tcx> ConstAnalysis<'a, 'tcx> {
tcx, tcx,
local_decls: &body.local_decls, local_decls: &body.local_decls,
ecx: InterpCx::new(tcx, DUMMY_SP, param_env, DummyMachine), ecx: InterpCx::new(tcx, DUMMY_SP, param_env, DummyMachine),
param_env: param_env, param_env,
} }
} }

View File

@ -580,9 +580,9 @@ fn check_recursion_limit<'tcx>(
let mut path = PathBuf::new(); let mut path = PathBuf::new();
let was_written = if let Some(written_to_path) = written_to_path { let was_written = if let Some(written_to_path) = written_to_path {
path = written_to_path; path = written_to_path;
Some(()) true
} else { } else {
None false
}; };
tcx.dcx().emit_fatal(RecursionLimit { tcx.dcx().emit_fatal(RecursionLimit {
span, span,

View File

@ -16,7 +16,7 @@ pub struct RecursionLimit {
pub def_span: Span, pub def_span: Span,
pub def_path_str: String, pub def_path_str: String,
#[note(monomorphize_written_to_path)] #[note(monomorphize_written_to_path)]
pub was_written: Option<()>, pub was_written: bool,
pub path: PathBuf, pub path: PathBuf,
} }

View File

@ -913,7 +913,7 @@ pub(crate) struct InvalidLiteralSuffixOnTupleIndex {
#[help(parse_tuple_exception_line_1)] #[help(parse_tuple_exception_line_1)]
#[help(parse_tuple_exception_line_2)] #[help(parse_tuple_exception_line_2)]
#[help(parse_tuple_exception_line_3)] #[help(parse_tuple_exception_line_3)]
pub exception: Option<()>, pub exception: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
@ -1299,7 +1299,7 @@ pub(crate) struct ComparisonOperatorsCannotBeChained {
pub suggest_turbofish: Option<Span>, pub suggest_turbofish: Option<Span>,
#[help(parse_sugg_turbofish_syntax)] #[help(parse_sugg_turbofish_syntax)]
#[help(parse_sugg_parentheses_for_function_args)] #[help(parse_sugg_parentheses_for_function_args)]
pub help_turbofish: Option<()>, pub help_turbofish: bool,
#[subdiagnostic] #[subdiagnostic]
pub chaining_sugg: Option<ComparisonOperatorsCannotBeChainedSugg>, pub chaining_sugg: Option<ComparisonOperatorsCannotBeChainedSugg>,
} }
@ -1578,7 +1578,7 @@ pub(crate) struct PathSingleColon {
pub suggestion: Span, pub suggestion: Span,
#[note(parse_type_ascription_removed)] #[note(parse_type_ascription_removed)]
pub type_ascription: Option<()>, pub type_ascription: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
@ -1589,7 +1589,7 @@ pub(crate) struct ColonAsSemi {
pub span: Span, pub span: Span,
#[note(parse_type_ascription_removed)] #[note(parse_type_ascription_removed)]
pub type_ascription: Option<()>, pub type_ascription: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
@ -2462,7 +2462,7 @@ pub(crate) struct TrailingVertNotAllowed {
pub start: Option<Span>, pub start: Option<Span>,
pub token: Token, pub token: Token,
#[note(parse_note_pattern_alternatives_use_single_vert)] #[note(parse_note_pattern_alternatives_use_single_vert)]
pub note_double_vert: Option<()>, pub note_double_vert: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
@ -2894,7 +2894,7 @@ pub(crate) struct BadItemKind {
pub descr: &'static str, pub descr: &'static str,
pub ctx: &'static str, pub ctx: &'static str,
#[help] #[help]
pub help: Option<()>, pub help: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]

View File

@ -1403,7 +1403,7 @@ impl<'a> Parser<'a> {
let mut err = ComparisonOperatorsCannotBeChained { let mut err = ComparisonOperatorsCannotBeChained {
span: vec![op.span, self.prev_token.span], span: vec![op.span, self.prev_token.span],
suggest_turbofish: None, suggest_turbofish: None,
help_turbofish: None, help_turbofish: false,
chaining_sugg: None, chaining_sugg: None,
}; };
@ -1436,7 +1436,7 @@ impl<'a> Parser<'a> {
{ {
err.suggest_turbofish = Some(op.span.shrink_to_lo()); err.suggest_turbofish = Some(op.span.shrink_to_lo());
} else { } else {
err.help_turbofish = Some(()); err.help_turbofish = true;
} }
let snapshot = self.create_snapshot_for_diagnostic(); let snapshot = self.create_snapshot_for_diagnostic();
@ -1468,7 +1468,7 @@ impl<'a> Parser<'a> {
{ {
err.suggest_turbofish = Some(op.span.shrink_to_lo()); err.suggest_turbofish = Some(op.span.shrink_to_lo());
} else { } else {
err.help_turbofish = Some(()); err.help_turbofish = true;
} }
// Consume the fn call arguments. // Consume the fn call arguments.
match self.consume_fn_args() { match self.consume_fn_args() {
@ -1487,7 +1487,7 @@ impl<'a> Parser<'a> {
{ {
// All we know is that this is `foo < bar >` and *nothing* else. Try to // All we know is that this is `foo < bar >` and *nothing* else. Try to
// be helpful, but don't attempt to recover. // be helpful, but don't attempt to recover.
err.help_turbofish = Some(()); err.help_turbofish = true;
} }
// If it looks like a genuine attempt to chain operators (as opposed to a // If it looks like a genuine attempt to chain operators (as opposed to a
@ -1895,7 +1895,7 @@ impl<'a> Parser<'a> {
{ {
self.dcx().emit_err(ColonAsSemi { self.dcx().emit_err(ColonAsSemi {
span: self.token.span, span: self.token.span,
type_ascription: self.psess.unstable_features.is_nightly_build().then_some(()), type_ascription: self.psess.unstable_features.is_nightly_build(),
}); });
self.bump(); self.bump();
return true; return true;

View File

@ -2162,13 +2162,13 @@ impl<'a> Parser<'a> {
self.dcx().emit_warn(errors::InvalidLiteralSuffixOnTupleIndex { self.dcx().emit_warn(errors::InvalidLiteralSuffixOnTupleIndex {
span, span,
suffix, suffix,
exception: Some(()), exception: true,
}); });
} else { } else {
self.dcx().emit_err(errors::InvalidLiteralSuffixOnTupleIndex { self.dcx().emit_err(errors::InvalidLiteralSuffixOnTupleIndex {
span, span,
suffix, suffix,
exception: None, exception: false,
}); });
} }
} }

View File

@ -1248,8 +1248,8 @@ impl<'a> Parser<'a> {
let span = self.psess.source_map().guess_head_span(span); let span = self.psess.source_map().guess_head_span(span);
let descr = kind.descr(); let descr = kind.descr();
let help = match kind { let help = match kind {
ItemKind::DelegationMac(deleg) if deleg.suffixes.is_none() => None, ItemKind::DelegationMac(deleg) if deleg.suffixes.is_none() => false,
_ => Some(()), _ => true,
}; };
self.dcx().emit_err(errors::BadItemKind { span, descr, ctx, help }); self.dcx().emit_err(errors::BadItemKind { span, descr, ctx, help });
None None

View File

@ -333,7 +333,7 @@ impl<'a> Parser<'a> {
span: self.token.span, span: self.token.span,
start: lo, start: lo,
token: self.token.clone(), token: self.token.clone(),
note_double_vert: matches!(self.token.kind, token::OrOr).then_some(()), note_double_vert: matches!(self.token.kind, token::OrOr),
}); });
self.bump(); self.bump();
true true

View File

@ -261,11 +261,7 @@ impl<'a> Parser<'a> {
self.dcx().emit_err(PathSingleColon { self.dcx().emit_err(PathSingleColon {
span: self.prev_token.span, span: self.prev_token.span,
suggestion: self.prev_token.span.shrink_to_hi(), suggestion: self.prev_token.span.shrink_to_hi(),
type_ascription: self type_ascription: self.psess.unstable_features.is_nightly_build(),
.psess
.unstable_features
.is_nightly_build()
.then_some(()),
}); });
} }
continue; continue;
@ -334,11 +330,7 @@ impl<'a> Parser<'a> {
err = self.dcx().create_err(PathSingleColon { err = self.dcx().create_err(PathSingleColon {
span: self.token.span, span: self.token.span,
suggestion: self.prev_token.span.shrink_to_hi(), suggestion: self.prev_token.span.shrink_to_hi(),
type_ascription: self type_ascription: self.psess.unstable_features.is_nightly_build(),
.psess
.unstable_features
.is_nightly_build()
.then_some(()),
}); });
} }
// Attempt to find places where a missing `>` might belong. // Attempt to find places where a missing `>` might belong.

View File

@ -2619,8 +2619,7 @@ fn check_duplicates(
warning: matches!( warning: matches!(
duplicates, duplicates,
FutureWarnFollowing | FutureWarnPreceding FutureWarnFollowing | FutureWarnPreceding
) ),
.then_some(()),
}, },
); );
} }

View File

@ -49,7 +49,7 @@ fn report_duplicate_item(
orig_span, orig_span,
crate_name: tcx.crate_name(item_def_id.krate), crate_name: tcx.crate_name(item_def_id.krate),
orig_crate_name: tcx.crate_name(original_def_id.krate), orig_crate_name: tcx.crate_name(original_def_id.krate),
different_crates: (item_def_id.krate != original_def_id.krate).then_some(()), different_crates: (item_def_id.krate != original_def_id.krate),
name, name,
}); });
} }

View File

@ -752,7 +752,7 @@ pub struct UnusedDuplicate {
#[note] #[note]
pub other: Span, pub other: Span,
#[warning] #[warning]
pub warning: Option<()>, pub warning: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
@ -911,7 +911,7 @@ pub struct DuplicateDiagnosticItemInCrate {
#[note(passes_diagnostic_item_first_defined)] #[note(passes_diagnostic_item_first_defined)]
pub orig_span: Option<Span>, pub orig_span: Option<Span>,
#[note] #[note]
pub different_crates: Option<()>, pub different_crates: bool,
pub crate_name: Symbol, pub crate_name: Symbol,
pub orig_crate_name: Symbol, pub orig_crate_name: Symbol,
pub name: Symbol, pub name: Symbol,

View File

@ -214,7 +214,7 @@ pub fn query_system<'tcx>(
local_providers, local_providers,
extern_providers, extern_providers,
encode_query_results: encode_all_query_results, encode_query_results: encode_all_query_results,
try_mark_green: try_mark_green, try_mark_green,
}, },
jobs: AtomicU64::new(1), jobs: AtomicU64::new(1),
} }

View File

@ -1158,7 +1158,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
fn contains_macro_use(&mut self, attrs: &[ast::Attribute]) -> bool { fn contains_macro_use(&mut self, attrs: &[ast::Attribute]) -> bool {
for attr in attrs { for attr in attrs {
if attr.has_name(sym::macro_escape) { if attr.has_name(sym::macro_escape) {
let inner_attribute = matches!(attr.style, ast::AttrStyle::Inner).then_some(()); let inner_attribute = matches!(attr.style, ast::AttrStyle::Inner);
self.r self.r
.dcx() .dcx()
.emit_warn(errors::MacroExternDeprecated { span: attr.span, inner_attribute }); .emit_warn(errors::MacroExternDeprecated { span: attr.span, inner_attribute });

View File

@ -1456,7 +1456,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
let label_span = ident.span.shrink_to_hi(); let label_span = ident.span.shrink_to_hi();
let mut spans = MultiSpan::from_span(label_span); let mut spans = MultiSpan::from_span(label_span);
spans.push_span_label(label_span, "put a macro name here"); spans.push_span_label(label_span, "put a macro name here");
err.subdiagnostic(MaybeMissingMacroRulesName { spans: spans }); err.subdiagnostic(MaybeMissingMacroRulesName { spans });
return; return;
} }

View File

@ -850,7 +850,7 @@ pub(crate) struct MacroExternDeprecated {
#[primary_span] #[primary_span]
pub(crate) span: Span, pub(crate) span: Span,
#[help] #[help]
pub inner_attribute: Option<()>, pub inner_attribute: bool,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]

View File

@ -146,7 +146,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for TransformTy<'tcx> {
!is_zst !is_zst
}); });
if let Some(field) = field { if let Some(field) = field {
let ty0 = self.tcx.type_of(field.did).instantiate(self.tcx, args); let ty0 = self.tcx.erase_regions(field.ty(self.tcx, args));
// Generalize any repr(transparent) user-defined type that is either a // Generalize any repr(transparent) user-defined type that is either a
// pointer or reference, and either references itself or any other type that // pointer or reference, and either references itself or any other type that
// contains or references itself, to avoid a reference cycle. // contains or references itself, to avoid a reference cycle.
@ -316,7 +316,7 @@ pub fn transform_instance<'tcx>(
.drop_trait() .drop_trait()
.unwrap_or_else(|| bug!("typeid_for_instance: couldn't get drop_trait lang item")); .unwrap_or_else(|| bug!("typeid_for_instance: couldn't get drop_trait lang item"));
let predicate = ty::ExistentialPredicate::Trait(ty::ExistentialTraitRef { let predicate = ty::ExistentialPredicate::Trait(ty::ExistentialTraitRef {
def_id: def_id, def_id,
args: List::empty(), args: List::empty(),
}); });
let predicates = tcx.mk_poly_existential_predicates(&[ty::Binder::dummy(predicate)]); let predicates = tcx.mk_poly_existential_predicates(&[ty::Binder::dummy(predicate)]);

View File

@ -132,7 +132,7 @@ pub(super) fn allocation_filter<'tcx>(
)); ));
} }
Allocation { Allocation {
bytes: bytes, bytes,
provenance: ProvenanceMap { ptrs }, provenance: ProvenanceMap { ptrs },
align: alloc.align.bytes(), align: alloc.align.bytes(),
mutability: alloc.mutability.stable(tables), mutability: alloc.mutability.stable(tables),

View File

@ -642,7 +642,7 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
pub fn make_indirect(&mut self) { pub fn make_indirect(&mut self) {
match self.mode { match self.mode {
PassMode::Direct(_) | PassMode::Pair(_, _) => { PassMode::Direct(_) | PassMode::Pair(_, _) => {
self.make_indirect_force(); self.mode = Self::indirect_pass_mode(&self.layout);
} }
PassMode::Indirect { attrs: _, meta_attrs: _, on_stack: false } => { PassMode::Indirect { attrs: _, meta_attrs: _, on_stack: false } => {
// already indirect // already indirect
@ -652,9 +652,19 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
} }
} }
/// Same as make_indirect, but doesn't check the current `PassMode`. /// Same as `make_indirect`, but for arguments that are ignored. Only needed for ABIs that pass
pub fn make_indirect_force(&mut self) { /// ZSTs indirectly.
self.mode = Self::indirect_pass_mode(&self.layout); pub fn make_indirect_from_ignore(&mut self) {
match self.mode {
PassMode::Ignore => {
self.mode = Self::indirect_pass_mode(&self.layout);
}
PassMode::Indirect { attrs: _, meta_attrs: _, on_stack: false } => {
// already indirect
return;
}
_ => panic!("Tried to make {:?} indirect (expected `PassMode::Ignore`)", self.mode),
}
} }
/// Pass this argument indirectly, by placing it at a fixed stack offset. /// Pass this argument indirectly, by placing it at a fixed stack offset.

View File

@ -16,7 +16,7 @@ fn classify_arg<Ty>(cx: &impl HasTargetSpec, arg: &mut ArgAbi<'_, Ty>) {
&& matches!(&*cx.target_spec().env, "gnu" | "musl" | "uclibc") && matches!(&*cx.target_spec().env, "gnu" | "musl" | "uclibc")
&& arg.layout.is_zst() && arg.layout.is_zst()
{ {
arg.make_indirect_force(); arg.make_indirect_from_ignore();
} }
return; return;
} }

View File

@ -28,7 +28,7 @@ where
&& matches!(&*cx.target_spec().env, "gnu" | "musl" | "uclibc") && matches!(&*cx.target_spec().env, "gnu" | "musl" | "uclibc")
&& arg.layout.is_zst() && arg.layout.is_zst()
{ {
arg.make_indirect_force(); arg.make_indirect_from_ignore();
} }
return; return;
} }

View File

@ -225,7 +225,7 @@ where
&& matches!(&*cx.target_spec().env, "gnu" | "musl" | "uclibc") && matches!(&*cx.target_spec().env, "gnu" | "musl" | "uclibc")
&& arg.layout.is_zst() && arg.layout.is_zst()
{ {
arg.make_indirect_force(); arg.make_indirect_from_ignore();
} }
return; return;
} }

View File

@ -43,7 +43,7 @@ pub fn compute_abi_info<Ty>(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>)
&& cx.target_spec().env == "gnu" && cx.target_spec().env == "gnu"
&& arg.layout.is_zst() && arg.layout.is_zst()
{ {
arg.make_indirect_force(); arg.make_indirect_from_ignore();
} }
continue; continue;
} }

View File

@ -382,7 +382,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
infer_subdiags, infer_subdiags,
multi_suggestions, multi_suggestions,
bad_label, bad_label,
was_written: None, was_written: false,
path: Default::default(), path: Default::default(),
}), }),
TypeAnnotationNeeded::E0283 => self.dcx().create_err(AmbiguousImpl { TypeAnnotationNeeded::E0283 => self.dcx().create_err(AmbiguousImpl {
@ -393,7 +393,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
infer_subdiags, infer_subdiags,
multi_suggestions, multi_suggestions,
bad_label, bad_label,
was_written: None, was_written: false,
path: Default::default(), path: Default::default(),
}), }),
TypeAnnotationNeeded::E0284 => self.dcx().create_err(AmbiguousReturn { TypeAnnotationNeeded::E0284 => self.dcx().create_err(AmbiguousReturn {
@ -404,7 +404,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
infer_subdiags, infer_subdiags,
multi_suggestions, multi_suggestions,
bad_label, bad_label,
was_written: None, was_written: false,
path: Default::default(), path: Default::default(),
}), }),
} }
@ -586,7 +586,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
infer_subdiags, infer_subdiags,
multi_suggestions, multi_suggestions,
bad_label: None, bad_label: None,
was_written: path.as_ref().map(|_| ()), was_written: path.is_some(),
path: path.unwrap_or_default(), path: path.unwrap_or_default(),
}), }),
TypeAnnotationNeeded::E0283 => self.dcx().create_err(AmbiguousImpl { TypeAnnotationNeeded::E0283 => self.dcx().create_err(AmbiguousImpl {
@ -597,7 +597,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
infer_subdiags, infer_subdiags,
multi_suggestions, multi_suggestions,
bad_label: None, bad_label: None,
was_written: path.as_ref().map(|_| ()), was_written: path.is_some(),
path: path.unwrap_or_default(), path: path.unwrap_or_default(),
}), }),
TypeAnnotationNeeded::E0284 => self.dcx().create_err(AmbiguousReturn { TypeAnnotationNeeded::E0284 => self.dcx().create_err(AmbiguousReturn {
@ -608,7 +608,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
infer_subdiags, infer_subdiags,
multi_suggestions, multi_suggestions,
bad_label: None, bad_label: None,
was_written: path.as_ref().map(|_| ()), was_written: path.is_some(),
path: path.unwrap_or_default(), path: path.unwrap_or_default(),
}), }),
} }

View File

@ -203,7 +203,7 @@ pub struct AnnotationRequired<'a> {
#[subdiagnostic] #[subdiagnostic]
pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>, pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>,
#[note(trait_selection_full_type_written)] #[note(trait_selection_full_type_written)]
pub was_written: Option<()>, pub was_written: bool,
pub path: PathBuf, pub path: PathBuf,
} }
@ -224,7 +224,7 @@ pub struct AmbiguousImpl<'a> {
#[subdiagnostic] #[subdiagnostic]
pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>, pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>,
#[note(trait_selection_full_type_written)] #[note(trait_selection_full_type_written)]
pub was_written: Option<()>, pub was_written: bool,
pub path: PathBuf, pub path: PathBuf,
} }
@ -245,7 +245,7 @@ pub struct AmbiguousReturn<'a> {
#[subdiagnostic] #[subdiagnostic]
pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>, pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>,
#[note(trait_selection_full_type_written)] #[note(trait_selection_full_type_written)]
pub was_written: Option<()>, pub was_written: bool,
pub path: PathBuf, pub path: PathBuf,
} }

View File

@ -770,7 +770,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
let reported = let reported =
tcx.dcx().emit_err(UnableToConstructConstantValue { tcx.dcx().emit_err(UnableToConstructConstantValue {
span: tcx.def_span(unevaluated.def), span: tcx.def_span(unevaluated.def),
unevaluated: unevaluated, unevaluated,
}); });
Err(ErrorHandled::Reported(reported.into(), tcx.def_span(unevaluated.def))) Err(ErrorHandled::Reported(reported.into(), tcx.def_span(unevaluated.def)))
} }

View File

@ -284,7 +284,7 @@ fn error(
) -> Result<!, ErrorGuaranteed> { ) -> Result<!, ErrorGuaranteed> {
let reported = tcx.dcx().emit_err(GenericConstantTooComplex { let reported = tcx.dcx().emit_err(GenericConstantTooComplex {
span: root_span, span: root_span,
maybe_supported: None, maybe_supported: false,
sub, sub,
}); });
@ -298,7 +298,7 @@ fn maybe_supported_error(
) -> Result<!, ErrorGuaranteed> { ) -> Result<!, ErrorGuaranteed> {
let reported = tcx.dcx().emit_err(GenericConstantTooComplex { let reported = tcx.dcx().emit_err(GenericConstantTooComplex {
span: root_span, span: root_span,
maybe_supported: Some(()), maybe_supported: true,
sub, sub,
}); });

View File

@ -18,7 +18,7 @@ pub struct GenericConstantTooComplex {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[note(ty_utils_maybe_supported)] #[note(ty_utils_maybe_supported)]
pub maybe_supported: Option<()>, pub maybe_supported: bool,
#[subdiagnostic] #[subdiagnostic]
pub sub: GenericConstantTooComplexSub, pub sub: GenericConstantTooComplexSub,
} }

View File

@ -2818,5 +2818,5 @@ impl_fn_for_zst! {
} }
// This is required to make `impl From<&str> for Box<dyn Error>` and `impl<E> From<E> for Box<dyn Error>` not overlap. // This is required to make `impl From<&str> for Box<dyn Error>` and `impl<E> From<E> for Box<dyn Error>` not overlap.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "error_in_core_neg_impl", since = "1.65.0")]
impl !crate::error::Error for &str {} impl !crate::error::Error for &str {}

View File

@ -116,7 +116,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
if pfd.revents & libc::POLLNVAL == 0 { if pfd.revents & libc::POLLNVAL == 0 {
continue; continue;
} }
if open64(c"/dev/null".as_ptr().cast(), libc::O_RDWR, 0) == -1 { if open64(c"/dev/null".as_ptr(), libc::O_RDWR, 0) == -1 {
// If the stream is closed but we failed to reopen it, abort the // If the stream is closed but we failed to reopen it, abort the
// process. Otherwise we wouldn't preserve the safety of // process. Otherwise we wouldn't preserve the safety of
// operations on the corresponding Rust object Stdin, Stdout, or // operations on the corresponding Rust object Stdin, Stdout, or
@ -147,7 +147,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
use crate::sys::os::errno; use crate::sys::os::errno;
for fd in 0..3 { for fd in 0..3 {
if libc::fcntl(fd, libc::F_GETFD) == -1 && errno() == libc::EBADF { if libc::fcntl(fd, libc::F_GETFD) == -1 && errno() == libc::EBADF {
if open64(c"/dev/null".as_ptr().cast(), libc::O_RDWR, 0) == -1 { if open64(c"/dev/null".as_ptr(), libc::O_RDWR, 0) == -1 {
// If the stream is closed but we failed to reopen it, abort the // If the stream is closed but we failed to reopen it, abort the
// process. Otherwise we wouldn't preserve the safety of // process. Otherwise we wouldn't preserve the safety of
// operations on the corresponding Rust object Stdin, Stdout, or // operations on the corresponding Rust object Stdin, Stdout, or

View File

@ -0,0 +1,45 @@
//@ min-lldb-version: 310
//@ compile-flags:-g
// === GDB TESTS ===================================================================================
// gdb-command:run 7
// gdb-command:next
// gdb-command:next
// gdb-check:[...]#loc1[...]
// gdb-command:next
// gdb-check:[...]#loc2[...]
// === LLDB TESTS ==================================================================================
// lldb-command:run 7
// lldb-command:next
// lldb-command:next
// lldb-command:frame select
// lldb-check:[...]#loc1[...]
// lldb-command:next
// lldb-command:frame select
// lldb-check:[...]#loc2[...]
use std::env;
use std::num::ParseIntError;
fn main() -> Result<(), ParseIntError> {
let args = env::args();
let number_str = args.skip(1).next().unwrap();
let number = number_str.parse::<i32>()?;
zzz(); // #break
if number % 7 == 0 {
// This generates code with a dummy span for
// some reason. If that ever changes this
// test will not test what it wants to test.
return Ok(()); // #loc1
}
println!("{}", number);
Ok(())
} // #loc2
fn zzz() { () }

View File

@ -2,9 +2,9 @@ warning: unreachable pattern
--> $DIR/packed_pattern.rs:16:9 --> $DIR/packed_pattern.rs:16:9
| |
LL | Foo { field: (5, 6, 7, 8) } => {}, LL | Foo { field: (5, 6, 7, 8) } => {},
| --------------------------- matches all the values already | --------------------------- matches all the relevant values
LL | FOO => unreachable!(), LL | FOO => unreachable!(),
| ^^^ unreachable pattern | ^^^ no value can reach this
| |
= note: `#[warn(unreachable_patterns)]` on by default = note: `#[warn(unreachable_patterns)]` on by default

View File

@ -2,9 +2,9 @@ warning: unreachable pattern
--> $DIR/packed_pattern2.rs:24:9 --> $DIR/packed_pattern2.rs:24:9
| |
LL | Bar { a: Foo { field: (5, 6) } } => {}, LL | Bar { a: Foo { field: (5, 6) } } => {},
| -------------------------------- matches all the values already | -------------------------------- matches all the relevant values
LL | FOO => unreachable!(), LL | FOO => unreachable!(),
| ^^^ unreachable pattern | ^^^ no value can reach this
| |
= note: `#[warn(unreachable_patterns)]` on by default = note: `#[warn(unreachable_patterns)]` on by default

View File

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/E0001.rs:8:9 --> $DIR/E0001.rs:8:9
| |
LL | _ => {/* ... */} LL | _ => {/* ... */}
| ^ unreachable pattern | ^ no value can reach this
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/E0001.rs:8:9 --> $DIR/E0001.rs:8:9
| |
LL | Some(_) => {/* ... */} LL | Some(_) => {/* ... */}

View File

@ -13,7 +13,7 @@ LL | Nil => true,
| --- matches any value | --- matches any value
LL | LL |
LL | _ => false LL | _ => false
| ^ unreachable pattern | ^ no value can reach this
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/issue-30302.rs:4:9 --> $DIR/issue-30302.rs:4:9

View File

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:8:9 --> $DIR/exhaustiveness-unreachable-pattern.rs:8:9
| |
LL | (1 | 2,) => {} LL | (1 | 2,) => {}
| -------- matches all the values already | -------- matches all the relevant values
LL | (1,) => {} LL | (1,) => {}
| ^^^^ unreachable pattern | ^^^^ no value can reach this
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/exhaustiveness-unreachable-pattern.rs:1:9 --> $DIR/exhaustiveness-unreachable-pattern.rs:1:9
@ -16,17 +16,17 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:13:9 --> $DIR/exhaustiveness-unreachable-pattern.rs:13:9
| |
LL | (1 | 2,) => {} LL | (1 | 2,) => {}
| -------- matches all the values already | -------- matches all the relevant values
LL | (2,) => {} LL | (2,) => {}
| ^^^^ unreachable pattern | ^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:19:9 --> $DIR/exhaustiveness-unreachable-pattern.rs:19:9
| |
LL | (1 | 2,) => {} LL | (1 | 2,) => {}
| ^^^^^^^^ unreachable pattern | ^^^^^^^^ no value can reach this
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/exhaustiveness-unreachable-pattern.rs:19:9 --> $DIR/exhaustiveness-unreachable-pattern.rs:19:9
| |
LL | (1,) => {} LL | (1,) => {}
@ -40,44 +40,44 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:24:9 --> $DIR/exhaustiveness-unreachable-pattern.rs:24:9
| |
LL | (1 | 2, 3 | 4) => {} LL | (1 | 2, 3 | 4) => {}
| -------------- matches all the values already | -------------- matches all the relevant values
LL | (1, 3) => {} LL | (1, 3) => {}
| ^^^^^^ unreachable pattern | ^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:25:9 --> $DIR/exhaustiveness-unreachable-pattern.rs:25:9
| |
LL | (1 | 2, 3 | 4) => {} LL | (1 | 2, 3 | 4) => {}
| -------------- matches all the values already | -------------- matches all the relevant values
LL | (1, 3) => {} LL | (1, 3) => {}
LL | (1, 4) => {} LL | (1, 4) => {}
| ^^^^^^ unreachable pattern | ^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:26:9 --> $DIR/exhaustiveness-unreachable-pattern.rs:26:9
| |
LL | (1 | 2, 3 | 4) => {} LL | (1 | 2, 3 | 4) => {}
| -------------- matches all the values already | -------------- matches all the relevant values
... ...
LL | (2, 4) => {} LL | (2, 4) => {}
| ^^^^^^ unreachable pattern | ^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:27:9 --> $DIR/exhaustiveness-unreachable-pattern.rs:27:9
| |
LL | (1 | 2, 3 | 4) => {} LL | (1 | 2, 3 | 4) => {}
| -------------- matches all the values already | -------------- matches all the relevant values
... ...
LL | (2 | 1, 4) => {} LL | (2 | 1, 4) => {}
| ^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:29:9 --> $DIR/exhaustiveness-unreachable-pattern.rs:29:9
| |
LL | (1, 4 | 5) => {} LL | (1, 4 | 5) => {}
| ^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^ no value can reach this
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/exhaustiveness-unreachable-pattern.rs:29:9 --> $DIR/exhaustiveness-unreachable-pattern.rs:29:9
| |
LL | (1 | 2, 3 | 4) => {} LL | (1 | 2, 3 | 4) => {}
@ -92,107 +92,107 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:34:13 --> $DIR/exhaustiveness-unreachable-pattern.rs:34:13
| |
LL | (0, 0, 0) => {} LL | (0, 0, 0) => {}
| - matches all the values already | - matches all the relevant values
LL | (0, 0 | 1, 0) => {} LL | (0, 0 | 1, 0) => {}
| ^ unreachable pattern | ^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:42:9 --> $DIR/exhaustiveness-unreachable-pattern.rs:42:9
| |
LL | (None | Some(1 | 2),) => {} LL | (None | Some(1 | 2),) => {}
| --------------------- matches all the values already | --------------------- matches all the relevant values
LL | (Some(1),) => {} LL | (Some(1),) => {}
| ^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:43:9 --> $DIR/exhaustiveness-unreachable-pattern.rs:43:9
| |
LL | (None | Some(1 | 2),) => {} LL | (None | Some(1 | 2),) => {}
| --------------------- matches all the values already | --------------------- matches all the relevant values
LL | (Some(1),) => {} LL | (Some(1),) => {}
LL | (None,) => {} LL | (None,) => {}
| ^^^^^^^ unreachable pattern | ^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:48:9 --> $DIR/exhaustiveness-unreachable-pattern.rs:48:9
| |
LL | ((1 | 2,) | (3 | 4,),) => {} LL | ((1 | 2,) | (3 | 4,),) => {}
| ---------------------- matches all the values already | ---------------------- matches all the relevant values
LL | ((1..=4,),) => {} LL | ((1..=4,),) => {}
| ^^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:53:14 --> $DIR/exhaustiveness-unreachable-pattern.rs:53:14
| |
LL | (1 | 1,) => {} LL | (1 | 1,) => {}
| - ^ unreachable pattern | - ^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:57:19 --> $DIR/exhaustiveness-unreachable-pattern.rs:57:19
| |
LL | (0 | 1) | 1 => {} LL | (0 | 1) | 1 => {}
| - ^ unreachable pattern | - ^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:63:14 --> $DIR/exhaustiveness-unreachable-pattern.rs:63:14
| |
LL | 0 | (0 | 0) => {} LL | 0 | (0 | 0) => {}
| - ^ unreachable pattern | - ^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:63:18 --> $DIR/exhaustiveness-unreachable-pattern.rs:63:18
| |
LL | 0 | (0 | 0) => {} LL | 0 | (0 | 0) => {}
| - ^ unreachable pattern | - ^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:71:13 --> $DIR/exhaustiveness-unreachable-pattern.rs:71:13
| |
LL | Some(0) | LL | Some(0) |
| ------- matches all the values already | ------- matches all the relevant values
LL | / Some( LL | / Some(
LL | | 0 | 0) => {} LL | | 0 | 0) => {}
| |______________________^ unreachable pattern | |______________________^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:77:15 --> $DIR/exhaustiveness-unreachable-pattern.rs:77:15
| |
LL | [0 LL | [0
| - matches all the values already | - matches all the relevant values
LL | | 0 LL | | 0
| ^ unreachable pattern | ^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:79:15 --> $DIR/exhaustiveness-unreachable-pattern.rs:79:15
| |
LL | , 0 LL | , 0
| - matches all the values already | - matches all the relevant values
LL | | 0] => {} LL | | 0] => {}
| ^ unreachable pattern | ^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:83:20 --> $DIR/exhaustiveness-unreachable-pattern.rs:83:20
| |
LL | (true, 0 | 0) => {} LL | (true, 0 | 0) => {}
| - ^ unreachable pattern | - ^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:84:17 --> $DIR/exhaustiveness-unreachable-pattern.rs:84:17
| |
LL | (_, 0 | 0) => {} LL | (_, 0 | 0) => {}
| ^ unreachable pattern | ^ no value can reach this
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/exhaustiveness-unreachable-pattern.rs:84:17 --> $DIR/exhaustiveness-unreachable-pattern.rs:84:17
| |
LL | (true, 0 | 0) => {} LL | (true, 0 | 0) => {}
@ -206,25 +206,25 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:92:10 --> $DIR/exhaustiveness-unreachable-pattern.rs:92:10
| |
LL | [1, ..] => {} LL | [1, ..] => {}
| - matches all the values already | - matches all the relevant values
LL | [1 LL | [1
| ^ unreachable pattern | ^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:104:10 --> $DIR/exhaustiveness-unreachable-pattern.rs:104:10
| |
LL | [true, ..] => {} LL | [true, ..] => {}
| ---- matches all the values already | ---- matches all the relevant values
LL | [true LL | [true
| ^^^^ unreachable pattern | ^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:111:36 --> $DIR/exhaustiveness-unreachable-pattern.rs:111:36
| |
LL | (true | false, None | Some(true LL | (true | false, None | Some(true
| ^^^^ unreachable pattern | ^^^^ no value can reach this
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/exhaustiveness-unreachable-pattern.rs:111:36 --> $DIR/exhaustiveness-unreachable-pattern.rs:111:36
| |
LL | (true, Some(_)) => {} LL | (true, Some(_)) => {}
@ -238,12 +238,12 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:116:14 --> $DIR/exhaustiveness-unreachable-pattern.rs:116:14
| |
LL | (true LL | (true
| ^^^^ unreachable pattern | ^^^^ no value can reach this
... ...
LL | (true | false, None | Some(t_or_f!())) => {} LL | (true | false, None | Some(t_or_f!())) => {}
| --------- in this macro invocation | --------- in this macro invocation
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/exhaustiveness-unreachable-pattern.rs:116:14 --> $DIR/exhaustiveness-unreachable-pattern.rs:116:14
| |
LL | (true LL | (true
@ -261,26 +261,26 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:127:14 --> $DIR/exhaustiveness-unreachable-pattern.rs:127:14
| |
LL | Some(0) => {} LL | Some(0) => {}
| - matches all the values already | - matches all the relevant values
LL | Some(0 LL | Some(0
| ^ unreachable pattern | ^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:146:19 --> $DIR/exhaustiveness-unreachable-pattern.rs:146:19
| |
LL | Some(false) => {} LL | Some(false) => {}
| ----- matches all the values already | ----- matches all the relevant values
LL | None | Some(true LL | None | Some(true
LL | | false) => {} LL | | false) => {}
| ^^^^^ unreachable pattern | ^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:154:15 --> $DIR/exhaustiveness-unreachable-pattern.rs:154:15
| |
LL | | true) => {} LL | | true) => {}
| ^^^^ unreachable pattern | ^^^^ no value can reach this
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/exhaustiveness-unreachable-pattern.rs:154:15 --> $DIR/exhaustiveness-unreachable-pattern.rs:154:15
| |
LL | (false, true) => {} LL | (false, true) => {}
@ -295,9 +295,9 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:160:15 --> $DIR/exhaustiveness-unreachable-pattern.rs:160:15
| |
LL | | true, LL | | true,
| ^^^^ unreachable pattern | ^^^^ no value can reach this
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/exhaustiveness-unreachable-pattern.rs:160:15 --> $DIR/exhaustiveness-unreachable-pattern.rs:160:15
| |
LL | (true, false) => {} LL | (true, false) => {}
@ -314,13 +314,13 @@ error: unreachable pattern
LL | (x, y) LL | (x, y)
| ------ matches any value | ------ matches any value
LL | | (y, x) => {} LL | | (y, x) => {}
| ^^^^^^ unreachable pattern | ^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:169:30 --> $DIR/exhaustiveness-unreachable-pattern.rs:169:30
| |
LL | fn unreachable_in_param((_ | (_, _)): (bool, bool)) {} LL | fn unreachable_in_param((_ | (_, _)): (bool, bool)) {}
| - ^^^^^^ unreachable pattern | - ^^^^^^ no value can reach this
| | | |
| matches any value | matches any value
@ -328,7 +328,7 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:176:14 --> $DIR/exhaustiveness-unreachable-pattern.rs:176:14
| |
LL | let (_ | (_, _)) = bool_pair; LL | let (_ | (_, _)) = bool_pair;
| - ^^^^^^ unreachable pattern | - ^^^^^^ no value can reach this
| | | |
| matches any value | matches any value
@ -336,7 +336,7 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:178:14 --> $DIR/exhaustiveness-unreachable-pattern.rs:178:14
| |
LL | for (_ | (_, _)) in [bool_pair] {} LL | for (_ | (_, _)) in [bool_pair] {}
| - ^^^^^^ unreachable pattern | - ^^^^^^ no value can reach this
| | | |
| matches any value | matches any value
@ -344,25 +344,25 @@ error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:181:20 --> $DIR/exhaustiveness-unreachable-pattern.rs:181:20
| |
LL | let (Some(_) | Some(true)) = bool_option else { return }; LL | let (Some(_) | Some(true)) = bool_option else { return };
| ------- ^^^^^^^^^^ unreachable pattern | ------- ^^^^^^^^^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:183:22 --> $DIR/exhaustiveness-unreachable-pattern.rs:183:22
| |
LL | if let Some(_) | Some(true) = bool_option {} LL | if let Some(_) | Some(true) = bool_option {}
| ------- ^^^^^^^^^^ unreachable pattern | ------- ^^^^^^^^^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:185:25 --> $DIR/exhaustiveness-unreachable-pattern.rs:185:25
| |
LL | while let Some(_) | Some(true) = bool_option {} LL | while let Some(_) | Some(true) = bool_option {}
| ------- ^^^^^^^^^^ unreachable pattern | ------- ^^^^^^^^^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: aborting due to 36 previous errors error: aborting due to 36 previous errors

View File

@ -19,7 +19,7 @@ LL | A => "A",
| - matches any value | - matches any value
LL | LL |
LL | B => "B", LL | B => "B",
| ^ unreachable pattern | ^ no value can reach this
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/issue-14221.rs:1:9 --> $DIR/issue-14221.rs:1:9

View File

@ -52,7 +52,7 @@ error: unreachable pattern
LL | Bar => {} LL | Bar => {}
| --- matches any value | --- matches any value
LL | BAR => {} LL | BAR => {}
| ^^^ unreachable pattern | ^^^ no value can reach this
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/consts-opaque.rs:6:9 --> $DIR/consts-opaque.rs:6:9
@ -67,7 +67,7 @@ LL | Bar => {}
| --- matches any value | --- matches any value
... ...
LL | _ => {} LL | _ => {}
| ^ unreachable pattern | ^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/consts-opaque.rs:56:9 --> $DIR/consts-opaque.rs:56:9
@ -75,7 +75,7 @@ error: unreachable pattern
LL | BAR => {} LL | BAR => {}
| --- matches any value | --- matches any value
LL | Bar => {} LL | Bar => {}
| ^^^ unreachable pattern | ^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/consts-opaque.rs:58:9 --> $DIR/consts-opaque.rs:58:9
@ -84,7 +84,7 @@ LL | BAR => {}
| --- matches any value | --- matches any value
... ...
LL | _ => {} LL | _ => {}
| ^ unreachable pattern | ^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/consts-opaque.rs:64:9 --> $DIR/consts-opaque.rs:64:9
@ -92,7 +92,7 @@ error: unreachable pattern
LL | BAR => {} LL | BAR => {}
| --- matches any value | --- matches any value
LL | BAR => {} // should not be emitting unreachable warning LL | BAR => {} // should not be emitting unreachable warning
| ^^^ unreachable pattern | ^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/consts-opaque.rs:66:9 --> $DIR/consts-opaque.rs:66:9
@ -101,31 +101,31 @@ LL | BAR => {}
| --- matches any value | --- matches any value
... ...
LL | _ => {} // should not be emitting unreachable warning LL | _ => {} // should not be emitting unreachable warning
| ^ unreachable pattern | ^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/consts-opaque.rs:72:9 --> $DIR/consts-opaque.rs:72:9
| |
LL | BAZ => {} LL | BAZ => {}
| --- matches all the values already | --- matches all the relevant values
LL | Baz::Baz1 => {} // should not be emitting unreachable warning LL | Baz::Baz1 => {} // should not be emitting unreachable warning
| ^^^^^^^^^ unreachable pattern | ^^^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/consts-opaque.rs:79:9 --> $DIR/consts-opaque.rs:79:9
| |
LL | Baz::Baz1 => {} LL | Baz::Baz1 => {}
| --------- matches all the values already | --------- matches all the relevant values
LL | BAZ => {} LL | BAZ => {}
| ^^^ unreachable pattern | ^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/consts-opaque.rs:87:9 --> $DIR/consts-opaque.rs:87:9
| |
LL | _ => {} // should not be emitting unreachable warning LL | _ => {} // should not be emitting unreachable warning
| ^ unreachable pattern | ^ no value can reach this
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/consts-opaque.rs:87:9 --> $DIR/consts-opaque.rs:87:9
| |
LL | BAZ => {} LL | BAZ => {}

View File

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:17:9 --> $DIR/empty-match-check-notes.rs:17:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `EmptyEnum` is uninhabited
| |
= note: this pattern matches no values because `EmptyEnum` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here note: the lint level is defined here
--> $DIR/empty-match-check-notes.rs:7:9 --> $DIR/empty-match-check-notes.rs:7:9
| |
@ -12,31 +12,31 @@ LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:21:9 --> $DIR/empty-match-check-notes.rs:22:9
| |
LL | _ if false => {} LL | _ if false => {}
| ^ | ^ matches no values because `EmptyEnum` is uninhabited
| |
= note: this pattern matches no values because `EmptyEnum` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:29:9 --> $DIR/empty-match-check-notes.rs:31:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `EmptyForeignEnum` is uninhabited
| |
= note: this pattern matches no values because `EmptyForeignEnum` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:33:9 --> $DIR/empty-match-check-notes.rs:36:9
| |
LL | _ if false => {} LL | _ if false => {}
| ^ | ^ matches no values because `EmptyForeignEnum` is uninhabited
| |
= note: this pattern matches no values because `EmptyForeignEnum` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0005]: refutable pattern in local binding error[E0005]: refutable pattern in local binding
--> $DIR/empty-match-check-notes.rs:39:9 --> $DIR/empty-match-check-notes.rs:43:9
| |
LL | let None = *x; LL | let None = *x;
| ^^^^ pattern `Some(_)` not covered | ^^^^ pattern `Some(_)` not covered
@ -51,7 +51,7 @@ LL | if let None = *x { todo!() };
| ++ +++++++++++ | ++ +++++++++++
error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered
--> $DIR/empty-match-check-notes.rs:49:11 --> $DIR/empty-match-check-notes.rs:53:11
| |
LL | match 0u8 { LL | match 0u8 {
| ^^^ pattern `0_u8..=u8::MAX` not covered | ^^^ pattern `0_u8..=u8::MAX` not covered

View File

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:17:9 --> $DIR/empty-match-check-notes.rs:17:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `EmptyEnum` is uninhabited
| |
= note: this pattern matches no values because `EmptyEnum` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here note: the lint level is defined here
--> $DIR/empty-match-check-notes.rs:7:9 --> $DIR/empty-match-check-notes.rs:7:9
| |
@ -12,31 +12,31 @@ LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:21:9 --> $DIR/empty-match-check-notes.rs:22:9
| |
LL | _ if false => {} LL | _ if false => {}
| ^ | ^ matches no values because `EmptyEnum` is uninhabited
| |
= note: this pattern matches no values because `EmptyEnum` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:29:9 --> $DIR/empty-match-check-notes.rs:31:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `EmptyForeignEnum` is uninhabited
| |
= note: this pattern matches no values because `EmptyForeignEnum` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:33:9 --> $DIR/empty-match-check-notes.rs:36:9
| |
LL | _ if false => {} LL | _ if false => {}
| ^ | ^ matches no values because `EmptyForeignEnum` is uninhabited
| |
= note: this pattern matches no values because `EmptyForeignEnum` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0005]: refutable pattern in local binding error[E0005]: refutable pattern in local binding
--> $DIR/empty-match-check-notes.rs:39:9 --> $DIR/empty-match-check-notes.rs:43:9
| |
LL | let None = *x; LL | let None = *x;
| ^^^^ pattern `Some(_)` not covered | ^^^^ pattern `Some(_)` not covered
@ -51,7 +51,7 @@ LL | if let None = *x { todo!() };
| ++ +++++++++++ | ++ +++++++++++
error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered
--> $DIR/empty-match-check-notes.rs:49:11 --> $DIR/empty-match-check-notes.rs:53:11
| |
LL | match 0u8 { LL | match 0u8 {
| ^^^ pattern `0_u8..=u8::MAX` not covered | ^^^ pattern `0_u8..=u8::MAX` not covered

View File

@ -16,10 +16,12 @@ fn empty_enum(x: EmptyEnum) {
match x { match x {
_ => {} //~ ERROR unreachable pattern _ => {} //~ ERROR unreachable pattern
//~^ NOTE matches no values //~^ NOTE matches no values
//~| NOTE to learn more about uninhabited types, see
} }
match x { match x {
_ if false => {} //~ ERROR unreachable pattern _ if false => {} //~ ERROR unreachable pattern
//~^ NOTE matches no values //~^ NOTE matches no values
//~| NOTE to learn more about uninhabited types, see
} }
} }
@ -28,10 +30,12 @@ fn empty_foreign_enum(x: empty::EmptyForeignEnum) {
match x { match x {
_ => {} //~ ERROR unreachable pattern _ => {} //~ ERROR unreachable pattern
//~^ NOTE matches no values //~^ NOTE matches no values
//~| NOTE to learn more about uninhabited types, see
} }
match x { match x {
_ if false => {} //~ ERROR unreachable pattern _ if false => {} //~ ERROR unreachable pattern
//~^ NOTE matches no values //~^ NOTE matches no values
//~| NOTE to learn more about uninhabited types, see
} }
} }

View File

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:49:9 --> $DIR/empty-types.rs:49:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here note: the lint level is defined here
--> $DIR/empty-types.rs:15:9 --> $DIR/empty-types.rs:15:9
| |
@ -15,9 +15,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:52:9 --> $DIR/empty-types.rs:52:9
| |
LL | _x => {} LL | _x => {}
| ^^ | ^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0004]: non-exhaustive patterns: type `&!` is non-empty error[E0004]: non-exhaustive patterns: type `&!` is non-empty
--> $DIR/empty-types.rs:56:11 --> $DIR/empty-types.rs:56:11
@ -38,33 +38,33 @@ error: unreachable pattern
--> $DIR/empty-types.rs:70:9 --> $DIR/empty-types.rs:70:9
| |
LL | (_, _) => {} LL | (_, _) => {}
| ^^^^^^ | ^^^^^^ matches no values because `(u32, !)` is uninhabited
| |
= note: this pattern matches no values because `(u32, !)` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:76:9 --> $DIR/empty-types.rs:76:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `(!, !)` is uninhabited
| |
= note: this pattern matches no values because `(!, !)` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:79:9 --> $DIR/empty-types.rs:79:9
| |
LL | (_, _) => {} LL | (_, _) => {}
| ^^^^^^ | ^^^^^^ matches no values because `(!, !)` is uninhabited
| |
= note: this pattern matches no values because `(!, !)` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:83:9 --> $DIR/empty-types.rs:83:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0004]: non-exhaustive patterns: `Ok(_)` not covered error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
--> $DIR/empty-types.rs:87:11 --> $DIR/empty-types.rs:87:11
@ -89,17 +89,17 @@ error: unreachable pattern
--> $DIR/empty-types.rs:94:9 --> $DIR/empty-types.rs:94:9
| |
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:99:9 --> $DIR/empty-types.rs:99:9
| |
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered
--> $DIR/empty-types.rs:96:11 --> $DIR/empty-types.rs:96:11
@ -137,153 +137,153 @@ error: unreachable pattern
--> $DIR/empty-types.rs:112:9 --> $DIR/empty-types.rs:112:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:115:9 --> $DIR/empty-types.rs:115:9
| |
LL | Ok(_) => {} LL | Ok(_) => {}
| ^^^^^ | ^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:118:9 --> $DIR/empty-types.rs:118:9
| |
LL | Ok(_) => {} LL | Ok(_) => {}
| ^^^^^ | ^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:119:9 --> $DIR/empty-types.rs:119:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:122:9 --> $DIR/empty-types.rs:122:9
| |
LL | Ok(_) => {} LL | Ok(_) => {}
| ^^^^^ | ^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:123:9 --> $DIR/empty-types.rs:123:9
| |
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:132:13 --> $DIR/empty-types.rs:132:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `Void` is uninhabited
| |
= note: this pattern matches no values because `Void` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:135:13 --> $DIR/empty-types.rs:135:13
| |
LL | _ if false => {} LL | _ if false => {}
| ^ | ^ matches no values because `Void` is uninhabited
| |
= note: this pattern matches no values because `Void` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:143:13 --> $DIR/empty-types.rs:143:13
| |
LL | Some(_) => {} LL | Some(_) => {}
| ^^^^^^^ | ^^^^^^^ matches no values because `Void` is uninhabited
| |
= note: this pattern matches no values because `Void` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:147:13 --> $DIR/empty-types.rs:147:13
| |
LL | None => {} LL | None => {}
| ---- matches all the values already | ---- matches all the relevant values
LL | _ => {} LL | _ => {}
| ^ unreachable pattern | ^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:199:13 --> $DIR/empty-types.rs:199:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:204:13 --> $DIR/empty-types.rs:204:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:209:13 --> $DIR/empty-types.rs:209:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:214:13 --> $DIR/empty-types.rs:214:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:220:13 --> $DIR/empty-types.rs:220:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:281:9 --> $DIR/empty-types.rs:281:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:284:9 --> $DIR/empty-types.rs:284:9
| |
LL | (_, _) => {} LL | (_, _) => {}
| ^^^^^^ | ^^^^^^ matches no values because `(!, !)` is uninhabited
| |
= note: this pattern matches no values because `(!, !)` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:287:9 --> $DIR/empty-types.rs:287:9
| |
LL | Ok(_) => {} LL | Ok(_) => {}
| ^^^^^ | ^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:288:9 --> $DIR/empty-types.rs:288:9
| |
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty
--> $DIR/empty-types.rs:327:11 --> $DIR/empty-types.rs:327:11
@ -344,25 +344,25 @@ error: unreachable pattern
--> $DIR/empty-types.rs:368:9 --> $DIR/empty-types.rs:368:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `[!; 3]` is uninhabited
| |
= note: this pattern matches no values because `[!; 3]` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:371:9 --> $DIR/empty-types.rs:371:9
| |
LL | [_, _, _] => {} LL | [_, _, _] => {}
| ^^^^^^^^^ | ^^^^^^^^^ matches no values because `[!; 3]` is uninhabited
| |
= note: this pattern matches no values because `[!; 3]` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:374:9 --> $DIR/empty-types.rs:374:9
| |
LL | [_, ..] => {} LL | [_, ..] => {}
| ^^^^^^^ | ^^^^^^^ matches no values because `[!; 3]` is uninhabited
| |
= note: this pattern matches no values because `[!; 3]` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty
--> $DIR/empty-types.rs:388:11 --> $DIR/empty-types.rs:388:11
@ -382,9 +382,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:395:9 --> $DIR/empty-types.rs:395:9
| |
LL | [] => {} LL | [] => {}
| -- matches all the values already | -- matches all the relevant values
LL | _ => {} LL | _ => {}
| ^ unreachable pattern | ^ no value can reach this
error[E0004]: non-exhaustive patterns: `[]` not covered error[E0004]: non-exhaustive patterns: `[]` not covered
--> $DIR/empty-types.rs:397:11 --> $DIR/empty-types.rs:397:11
@ -404,67 +404,67 @@ error: unreachable pattern
--> $DIR/empty-types.rs:416:9 --> $DIR/empty-types.rs:416:9
| |
LL | Some(_) => {} LL | Some(_) => {}
| ^^^^^^^ | ^^^^^^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:421:9 --> $DIR/empty-types.rs:421:9
| |
LL | Some(_a) => {} LL | Some(_a) => {}
| ^^^^^^^^ | ^^^^^^^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:426:9 --> $DIR/empty-types.rs:426:9
| |
LL | None => {} LL | None => {}
| ---- matches all the values already | ---- matches all the relevant values
LL | // !useful, !reachable LL | // !useful, !reachable
LL | _ => {} LL | _ => {}
| ^ unreachable pattern | ^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:431:9 --> $DIR/empty-types.rs:431:9
| |
LL | None => {} LL | None => {}
| ---- matches all the values already | ---- matches all the relevant values
LL | // !useful, !reachable LL | // !useful, !reachable
LL | _a => {} LL | _a => {}
| ^^ unreachable pattern | ^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:603:9 --> $DIR/empty-types.rs:603:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:606:9 --> $DIR/empty-types.rs:606:9
| |
LL | _x => {} LL | _x => {}
| ^^ | ^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:609:9 --> $DIR/empty-types.rs:609:9
| |
LL | _ if false => {} LL | _ if false => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:612:9 --> $DIR/empty-types.rs:612:9
| |
LL | _x if false => {} LL | _x if false => {}
| ^^ | ^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: aborting due to 49 previous errors error: aborting due to 49 previous errors

View File

@ -11,9 +11,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:49:9 --> $DIR/empty-types.rs:49:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here note: the lint level is defined here
--> $DIR/empty-types.rs:15:9 --> $DIR/empty-types.rs:15:9
| |
@ -24,9 +24,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:52:9 --> $DIR/empty-types.rs:52:9
| |
LL | _x => {} LL | _x => {}
| ^^ | ^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0004]: non-exhaustive patterns: type `&!` is non-empty error[E0004]: non-exhaustive patterns: type `&!` is non-empty
--> $DIR/empty-types.rs:56:11 --> $DIR/empty-types.rs:56:11
@ -47,33 +47,33 @@ error: unreachable pattern
--> $DIR/empty-types.rs:70:9 --> $DIR/empty-types.rs:70:9
| |
LL | (_, _) => {} LL | (_, _) => {}
| ^^^^^^ | ^^^^^^ matches no values because `(u32, !)` is uninhabited
| |
= note: this pattern matches no values because `(u32, !)` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:76:9 --> $DIR/empty-types.rs:76:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `(!, !)` is uninhabited
| |
= note: this pattern matches no values because `(!, !)` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:79:9 --> $DIR/empty-types.rs:79:9
| |
LL | (_, _) => {} LL | (_, _) => {}
| ^^^^^^ | ^^^^^^ matches no values because `(!, !)` is uninhabited
| |
= note: this pattern matches no values because `(!, !)` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:83:9 --> $DIR/empty-types.rs:83:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0004]: non-exhaustive patterns: `Ok(_)` not covered error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
--> $DIR/empty-types.rs:87:11 --> $DIR/empty-types.rs:87:11
@ -98,17 +98,17 @@ error: unreachable pattern
--> $DIR/empty-types.rs:94:9 --> $DIR/empty-types.rs:94:9
| |
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:99:9 --> $DIR/empty-types.rs:99:9
| |
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered
--> $DIR/empty-types.rs:96:11 --> $DIR/empty-types.rs:96:11
@ -160,81 +160,81 @@ error: unreachable pattern
--> $DIR/empty-types.rs:112:9 --> $DIR/empty-types.rs:112:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:115:9 --> $DIR/empty-types.rs:115:9
| |
LL | Ok(_) => {} LL | Ok(_) => {}
| ^^^^^ | ^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:118:9 --> $DIR/empty-types.rs:118:9
| |
LL | Ok(_) => {} LL | Ok(_) => {}
| ^^^^^ | ^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:119:9 --> $DIR/empty-types.rs:119:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:122:9 --> $DIR/empty-types.rs:122:9
| |
LL | Ok(_) => {} LL | Ok(_) => {}
| ^^^^^ | ^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:123:9 --> $DIR/empty-types.rs:123:9
| |
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:132:13 --> $DIR/empty-types.rs:132:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `Void` is uninhabited
| |
= note: this pattern matches no values because `Void` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:135:13 --> $DIR/empty-types.rs:135:13
| |
LL | _ if false => {} LL | _ if false => {}
| ^ | ^ matches no values because `Void` is uninhabited
| |
= note: this pattern matches no values because `Void` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:143:13 --> $DIR/empty-types.rs:143:13
| |
LL | Some(_) => {} LL | Some(_) => {}
| ^^^^^^^ | ^^^^^^^ matches no values because `Void` is uninhabited
| |
= note: this pattern matches no values because `Void` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:147:13 --> $DIR/empty-types.rs:147:13
| |
LL | None => {} LL | None => {}
| ---- matches all the values already | ---- matches all the relevant values
LL | _ => {} LL | _ => {}
| ^ unreachable pattern | ^ no value can reach this
error[E0004]: non-exhaustive patterns: `Some(!)` not covered error[E0004]: non-exhaustive patterns: `Some(!)` not covered
--> $DIR/empty-types.rs:156:15 --> $DIR/empty-types.rs:156:15
@ -259,73 +259,73 @@ error: unreachable pattern
--> $DIR/empty-types.rs:199:13 --> $DIR/empty-types.rs:199:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:204:13 --> $DIR/empty-types.rs:204:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:209:13 --> $DIR/empty-types.rs:209:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:214:13 --> $DIR/empty-types.rs:214:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:220:13 --> $DIR/empty-types.rs:220:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:281:9 --> $DIR/empty-types.rs:281:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:284:9 --> $DIR/empty-types.rs:284:9
| |
LL | (_, _) => {} LL | (_, _) => {}
| ^^^^^^ | ^^^^^^ matches no values because `(!, !)` is uninhabited
| |
= note: this pattern matches no values because `(!, !)` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:287:9 --> $DIR/empty-types.rs:287:9
| |
LL | Ok(_) => {} LL | Ok(_) => {}
| ^^^^^ | ^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:288:9 --> $DIR/empty-types.rs:288:9
| |
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0005]: refutable pattern in local binding error[E0005]: refutable pattern in local binding
--> $DIR/empty-types.rs:297:13 --> $DIR/empty-types.rs:297:13
@ -478,25 +478,25 @@ error: unreachable pattern
--> $DIR/empty-types.rs:368:9 --> $DIR/empty-types.rs:368:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `[!; 3]` is uninhabited
| |
= note: this pattern matches no values because `[!; 3]` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:371:9 --> $DIR/empty-types.rs:371:9
| |
LL | [_, _, _] => {} LL | [_, _, _] => {}
| ^^^^^^^^^ | ^^^^^^^^^ matches no values because `[!; 3]` is uninhabited
| |
= note: this pattern matches no values because `[!; 3]` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:374:9 --> $DIR/empty-types.rs:374:9
| |
LL | [_, ..] => {} LL | [_, ..] => {}
| ^^^^^^^ | ^^^^^^^ matches no values because `[!; 3]` is uninhabited
| |
= note: this pattern matches no values because `[!; 3]` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty
--> $DIR/empty-types.rs:388:11 --> $DIR/empty-types.rs:388:11
@ -516,9 +516,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:395:9 --> $DIR/empty-types.rs:395:9
| |
LL | [] => {} LL | [] => {}
| -- matches all the values already | -- matches all the relevant values
LL | _ => {} LL | _ => {}
| ^ unreachable pattern | ^ no value can reach this
error[E0004]: non-exhaustive patterns: `[]` not covered error[E0004]: non-exhaustive patterns: `[]` not covered
--> $DIR/empty-types.rs:397:11 --> $DIR/empty-types.rs:397:11
@ -538,35 +538,35 @@ error: unreachable pattern
--> $DIR/empty-types.rs:416:9 --> $DIR/empty-types.rs:416:9
| |
LL | Some(_) => {} LL | Some(_) => {}
| ^^^^^^^ | ^^^^^^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:421:9 --> $DIR/empty-types.rs:421:9
| |
LL | Some(_a) => {} LL | Some(_a) => {}
| ^^^^^^^^ | ^^^^^^^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:426:9 --> $DIR/empty-types.rs:426:9
| |
LL | None => {} LL | None => {}
| ---- matches all the values already | ---- matches all the relevant values
LL | // !useful, !reachable LL | // !useful, !reachable
LL | _ => {} LL | _ => {}
| ^ unreachable pattern | ^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:431:9 --> $DIR/empty-types.rs:431:9
| |
LL | None => {} LL | None => {}
| ---- matches all the values already | ---- matches all the relevant values
LL | // !useful, !reachable LL | // !useful, !reachable
LL | _a => {} LL | _a => {}
| ^^ unreachable pattern | ^^ no value can reach this
error[E0004]: non-exhaustive patterns: `&Some(!)` not covered error[E0004]: non-exhaustive patterns: `&Some(!)` not covered
--> $DIR/empty-types.rs:451:11 --> $DIR/empty-types.rs:451:11
@ -662,33 +662,33 @@ error: unreachable pattern
--> $DIR/empty-types.rs:603:9 --> $DIR/empty-types.rs:603:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:606:9 --> $DIR/empty-types.rs:606:9
| |
LL | _x => {} LL | _x => {}
| ^^ | ^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:609:9 --> $DIR/empty-types.rs:609:9
| |
LL | _ if false => {} LL | _ if false => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:612:9 --> $DIR/empty-types.rs:612:9
| |
LL | _x if false => {} LL | _x if false => {}
| ^^ | ^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0004]: non-exhaustive patterns: `&!` not covered error[E0004]: non-exhaustive patterns: `&!` not covered
--> $DIR/empty-types.rs:637:11 --> $DIR/empty-types.rs:637:11

View File

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:49:9 --> $DIR/empty-types.rs:49:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here note: the lint level is defined here
--> $DIR/empty-types.rs:15:9 --> $DIR/empty-types.rs:15:9
| |
@ -15,9 +15,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:52:9 --> $DIR/empty-types.rs:52:9
| |
LL | _x => {} LL | _x => {}
| ^^ | ^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0004]: non-exhaustive patterns: type `&!` is non-empty error[E0004]: non-exhaustive patterns: type `&!` is non-empty
--> $DIR/empty-types.rs:56:11 --> $DIR/empty-types.rs:56:11
@ -38,33 +38,33 @@ error: unreachable pattern
--> $DIR/empty-types.rs:70:9 --> $DIR/empty-types.rs:70:9
| |
LL | (_, _) => {} LL | (_, _) => {}
| ^^^^^^ | ^^^^^^ matches no values because `(u32, !)` is uninhabited
| |
= note: this pattern matches no values because `(u32, !)` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:76:9 --> $DIR/empty-types.rs:76:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `(!, !)` is uninhabited
| |
= note: this pattern matches no values because `(!, !)` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:79:9 --> $DIR/empty-types.rs:79:9
| |
LL | (_, _) => {} LL | (_, _) => {}
| ^^^^^^ | ^^^^^^ matches no values because `(!, !)` is uninhabited
| |
= note: this pattern matches no values because `(!, !)` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:83:9 --> $DIR/empty-types.rs:83:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0004]: non-exhaustive patterns: `Ok(_)` not covered error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
--> $DIR/empty-types.rs:87:11 --> $DIR/empty-types.rs:87:11
@ -89,17 +89,17 @@ error: unreachable pattern
--> $DIR/empty-types.rs:94:9 --> $DIR/empty-types.rs:94:9
| |
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:99:9 --> $DIR/empty-types.rs:99:9
| |
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered
--> $DIR/empty-types.rs:96:11 --> $DIR/empty-types.rs:96:11
@ -151,81 +151,81 @@ error: unreachable pattern
--> $DIR/empty-types.rs:112:9 --> $DIR/empty-types.rs:112:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:115:9 --> $DIR/empty-types.rs:115:9
| |
LL | Ok(_) => {} LL | Ok(_) => {}
| ^^^^^ | ^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:118:9 --> $DIR/empty-types.rs:118:9
| |
LL | Ok(_) => {} LL | Ok(_) => {}
| ^^^^^ | ^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:119:9 --> $DIR/empty-types.rs:119:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:122:9 --> $DIR/empty-types.rs:122:9
| |
LL | Ok(_) => {} LL | Ok(_) => {}
| ^^^^^ | ^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:123:9 --> $DIR/empty-types.rs:123:9
| |
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:132:13 --> $DIR/empty-types.rs:132:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `Void` is uninhabited
| |
= note: this pattern matches no values because `Void` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:135:13 --> $DIR/empty-types.rs:135:13
| |
LL | _ if false => {} LL | _ if false => {}
| ^ | ^ matches no values because `Void` is uninhabited
| |
= note: this pattern matches no values because `Void` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:143:13 --> $DIR/empty-types.rs:143:13
| |
LL | Some(_) => {} LL | Some(_) => {}
| ^^^^^^^ | ^^^^^^^ matches no values because `Void` is uninhabited
| |
= note: this pattern matches no values because `Void` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:147:13 --> $DIR/empty-types.rs:147:13
| |
LL | None => {} LL | None => {}
| ---- matches all the values already | ---- matches all the relevant values
LL | _ => {} LL | _ => {}
| ^ unreachable pattern | ^ no value can reach this
error[E0004]: non-exhaustive patterns: `Some(_)` not covered error[E0004]: non-exhaustive patterns: `Some(_)` not covered
--> $DIR/empty-types.rs:156:15 --> $DIR/empty-types.rs:156:15
@ -250,73 +250,73 @@ error: unreachable pattern
--> $DIR/empty-types.rs:199:13 --> $DIR/empty-types.rs:199:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:204:13 --> $DIR/empty-types.rs:204:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:209:13 --> $DIR/empty-types.rs:209:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:214:13 --> $DIR/empty-types.rs:214:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:220:13 --> $DIR/empty-types.rs:220:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:281:9 --> $DIR/empty-types.rs:281:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:284:9 --> $DIR/empty-types.rs:284:9
| |
LL | (_, _) => {} LL | (_, _) => {}
| ^^^^^^ | ^^^^^^ matches no values because `(!, !)` is uninhabited
| |
= note: this pattern matches no values because `(!, !)` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:287:9 --> $DIR/empty-types.rs:287:9
| |
LL | Ok(_) => {} LL | Ok(_) => {}
| ^^^^^ | ^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:288:9 --> $DIR/empty-types.rs:288:9
| |
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^ matches no values because `Result<!, !>` is uninhabited
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0005]: refutable pattern in local binding error[E0005]: refutable pattern in local binding
--> $DIR/empty-types.rs:297:13 --> $DIR/empty-types.rs:297:13
@ -469,25 +469,25 @@ error: unreachable pattern
--> $DIR/empty-types.rs:368:9 --> $DIR/empty-types.rs:368:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `[!; 3]` is uninhabited
| |
= note: this pattern matches no values because `[!; 3]` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:371:9 --> $DIR/empty-types.rs:371:9
| |
LL | [_, _, _] => {} LL | [_, _, _] => {}
| ^^^^^^^^^ | ^^^^^^^^^ matches no values because `[!; 3]` is uninhabited
| |
= note: this pattern matches no values because `[!; 3]` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:374:9 --> $DIR/empty-types.rs:374:9
| |
LL | [_, ..] => {} LL | [_, ..] => {}
| ^^^^^^^ | ^^^^^^^ matches no values because `[!; 3]` is uninhabited
| |
= note: this pattern matches no values because `[!; 3]` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty
--> $DIR/empty-types.rs:388:11 --> $DIR/empty-types.rs:388:11
@ -507,9 +507,9 @@ error: unreachable pattern
--> $DIR/empty-types.rs:395:9 --> $DIR/empty-types.rs:395:9
| |
LL | [] => {} LL | [] => {}
| -- matches all the values already | -- matches all the relevant values
LL | _ => {} LL | _ => {}
| ^ unreachable pattern | ^ no value can reach this
error[E0004]: non-exhaustive patterns: `[]` not covered error[E0004]: non-exhaustive patterns: `[]` not covered
--> $DIR/empty-types.rs:397:11 --> $DIR/empty-types.rs:397:11
@ -529,35 +529,35 @@ error: unreachable pattern
--> $DIR/empty-types.rs:416:9 --> $DIR/empty-types.rs:416:9
| |
LL | Some(_) => {} LL | Some(_) => {}
| ^^^^^^^ | ^^^^^^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:421:9 --> $DIR/empty-types.rs:421:9
| |
LL | Some(_a) => {} LL | Some(_a) => {}
| ^^^^^^^^ | ^^^^^^^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:426:9 --> $DIR/empty-types.rs:426:9
| |
LL | None => {} LL | None => {}
| ---- matches all the values already | ---- matches all the relevant values
LL | // !useful, !reachable LL | // !useful, !reachable
LL | _ => {} LL | _ => {}
| ^ unreachable pattern | ^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:431:9 --> $DIR/empty-types.rs:431:9
| |
LL | None => {} LL | None => {}
| ---- matches all the values already | ---- matches all the relevant values
LL | // !useful, !reachable LL | // !useful, !reachable
LL | _a => {} LL | _a => {}
| ^^ unreachable pattern | ^^ no value can reach this
error[E0004]: non-exhaustive patterns: `&Some(_)` not covered error[E0004]: non-exhaustive patterns: `&Some(_)` not covered
--> $DIR/empty-types.rs:451:11 --> $DIR/empty-types.rs:451:11
@ -653,33 +653,33 @@ error: unreachable pattern
--> $DIR/empty-types.rs:603:9 --> $DIR/empty-types.rs:603:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:606:9 --> $DIR/empty-types.rs:606:9
| |
LL | _x => {} LL | _x => {}
| ^^ | ^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:609:9 --> $DIR/empty-types.rs:609:9
| |
LL | _ if false => {} LL | _ if false => {}
| ^ | ^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:612:9 --> $DIR/empty-types.rs:612:9
| |
LL | _x if false => {} LL | _x if false => {}
| ^^ | ^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `!` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0004]: non-exhaustive patterns: `&_` not covered error[E0004]: non-exhaustive patterns: `&_` not covered
--> $DIR/empty-types.rs:637:11 --> $DIR/empty-types.rs:637:11

View File

@ -6,10 +6,10 @@
fn main() { fn main() {
match (0u8,) { match (0u8,) {
(1 | 2,) => {} (1 | 2,) => {}
//~^ NOTE matches all the values already //~^ NOTE matches all the relevant values
(2,) => {} (2,) => {}
//~^ ERROR unreachable pattern //~^ ERROR unreachable pattern
//~| NOTE unreachable pattern //~| NOTE no value can reach this
_ => {} _ => {}
} }
@ -20,18 +20,38 @@ fn main() {
//~^ NOTE matches some of the same values //~^ NOTE matches some of the same values
(1 | 2,) => {} (1 | 2,) => {}
//~^ ERROR unreachable pattern //~^ ERROR unreachable pattern
//~| NOTE unreachable pattern //~| NOTE no value can reach this
//~| NOTE these patterns collectively make the last one unreachable //~| NOTE multiple earlier patterns match some of the same values
//~| NOTE collectively making this unreachable //~| NOTE collectively making this unreachable
_ => {} _ => {}
} }
match 0u8 {
1 => {}
//~^ NOTE matches some of the same values
2 => {}
//~^ NOTE matches some of the same values
3 => {}
//~^ NOTE matches some of the same values
4 => {}
//~^ NOTE matches some of the same values
5 => {}
6 => {}
1 ..= 6 => {}
//~^ ERROR unreachable pattern
//~| NOTE no value can reach this
//~| NOTE multiple earlier patterns match some of the same values
//~| NOTE ...and 2 other patterns
_ => {}
}
let res: Result<(),!> = Ok(()); let res: Result<(),!> = Ok(());
match res { match res {
Ok(_) => {} Ok(_) => {}
Err(_) => {} Err(_) => {}
//~^ ERROR unreachable pattern //~^ ERROR unreachable pattern
//~| NOTE this pattern matches no values because `!` is uninhabited //~| NOTE matches no values because `!` is uninhabited
//~| NOTE to learn more about uninhabited types, see
} }
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
@ -44,22 +64,24 @@ fn main() {
match (&res1, res2) { match (&res1, res2) {
(Err(_), Err(_)) => {} (Err(_), Err(_)) => {}
//~^ ERROR unreachable pattern //~^ ERROR unreachable pattern
//~| NOTE this pattern matches no values because `Void2` is uninhabited //~| NOTE matches no values because `Void2` is uninhabited
//~| NOTE to learn more about uninhabited types, see
_ => {} _ => {}
} }
match (res1, &res2) { match (res1, &res2) {
(Err(_), Err(_)) => {} (Err(_), Err(_)) => {}
//~^ ERROR unreachable pattern //~^ ERROR unreachable pattern
//~| NOTE this pattern matches no values because `Void1` is uninhabited //~| NOTE matches no values because `Void1` is uninhabited
//~| NOTE to learn more about uninhabited types, see
_ => {} _ => {}
} }
if let (0 if let (0
//~^ NOTE matches all the values already //~^ NOTE matches all the relevant values
| 0, _) = (0, 0) {} | 0, _) = (0, 0) {}
//~^ ERROR unreachable pattern //~^ ERROR unreachable pattern
//~| NOTE unreachable pattern //~| NOTE no value can reach this
match (true, true) { match (true, true) {
(_, true) if false => {} // Guarded patterns don't cover others (_, true) if false => {} // Guarded patterns don't cover others
@ -69,20 +91,20 @@ fn main() {
//~^ NOTE matches some of the same values //~^ NOTE matches some of the same values
(_, true) => {} (_, true) => {}
//~^ ERROR unreachable pattern //~^ ERROR unreachable pattern
//~| NOTE unreachable pattern //~| NOTE no value can reach this
//~| NOTE these patterns collectively make the last one unreachable //~| NOTE multiple earlier patterns match some of the same values
//~| NOTE collectively making this unreachable //~| NOTE collectively making this unreachable
} }
match (true, true) { match (true, true) {
(true, _) => {} (true, _) => {}
//~^ NOTE matches all the values already //~^ NOTE matches all the relevant values
(false, _) => {} (false, _) => {}
#[allow(unreachable_patterns)] #[allow(unreachable_patterns)]
(_, true) => {} // Doesn't cover below because it's already unreachable. (_, true) => {} // Doesn't cover below because it's already unreachable.
(true, true) => {} (true, true) => {}
//~^ ERROR unreachable pattern //~^ ERROR unreachable pattern
//~| NOTE unreachable pattern //~| NOTE no value can reach this
} }
// Despite skipping some irrelevant cases, we still report a set of rows that covers the // Despite skipping some irrelevant cases, we still report a set of rows that covers the
@ -90,11 +112,11 @@ fn main() {
match (true, true, 0) { match (true, true, 0) {
(true, _, _) => {} (true, _, _) => {}
(_, true, 0..10) => {} (_, true, 0..10) => {}
//~^ NOTE matches all the values already //~^ NOTE matches all the relevant values
(_, true, 10..) => {} (_, true, 10..) => {}
(_, true, 3) => {} (_, true, 3) => {}
//~^ ERROR unreachable pattern //~^ ERROR unreachable pattern
//~| NOTE unreachable pattern //~| NOTE no value can reach this
_ => {} _ => {}
} }
} }

View File

@ -2,10 +2,10 @@ error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:10:9 --> $DIR/explain-unreachable-pats.rs:10:9
| |
LL | (1 | 2,) => {} LL | (1 | 2,) => {}
| -------- matches all the values already | -------- matches all the relevant values
LL | LL |
LL | (2,) => {} LL | (2,) => {}
| ^^^^ unreachable pattern | ^^^^ no value can reach this
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/explain-unreachable-pats.rs:2:9 --> $DIR/explain-unreachable-pats.rs:2:9
@ -17,9 +17,9 @@ error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:21:9 --> $DIR/explain-unreachable-pats.rs:21:9
| |
LL | (1 | 2,) => {} LL | (1 | 2,) => {}
| ^^^^^^^^ unreachable pattern | ^^^^^^^^ no value can reach this
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/explain-unreachable-pats.rs:21:9 --> $DIR/explain-unreachable-pats.rs:21:9
| |
LL | (1,) => {} LL | (1,) => {}
@ -32,46 +32,70 @@ LL | (1 | 2,) => {}
| ^^^^^^^^ collectively making this unreachable | ^^^^^^^^ collectively making this unreachable
error: unreachable pattern error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:32:9 --> $DIR/explain-unreachable-pats.rs:40:9
| |
LL | Err(_) => {} LL | 1 ..= 6 => {}
| ^^^^^^ | ^^^^^^^ no value can reach this
| |
= note: this pattern matches no values because `!` is uninhabited note: multiple earlier patterns match some of the same values
--> $DIR/explain-unreachable-pats.rs:40:9
error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:45:9
| |
LL | (Err(_), Err(_)) => {} LL | 1 => {}
| ^^^^^^^^^^^^^^^^ | - matches some of the same values
| LL |
= note: this pattern matches no values because `Void2` is uninhabited LL | 2 => {}
| - matches some of the same values
LL |
LL | 3 => {}
| - matches some of the same values
LL |
LL | 4 => {}
| - matches some of the same values
...
LL | 1 ..= 6 => {}
| ^^^^^^^ ...and 2 other patterns collectively make this unreachable
error: unreachable pattern error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:51:9 --> $DIR/explain-unreachable-pats.rs:51:9
| |
LL | (Err(_), Err(_)) => {} LL | Err(_) => {}
| ^^^^^^^^^^^^^^^^ | ^^^^^^ matches no values because `!` is uninhabited
| |
= note: this pattern matches no values because `Void1` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:60:11 --> $DIR/explain-unreachable-pats.rs:65:9
|
LL | (Err(_), Err(_)) => {}
| ^^^^^^^^^^^^^^^^ matches no values because `Void2` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:72:9
|
LL | (Err(_), Err(_)) => {}
| ^^^^^^^^^^^^^^^^ matches no values because `Void1` is uninhabited
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:82:11
| |
LL | if let (0 LL | if let (0
| - matches all the values already | - matches all the relevant values
LL | LL |
LL | | 0, _) = (0, 0) {} LL | | 0, _) = (0, 0) {}
| ^ unreachable pattern | ^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:70:9 --> $DIR/explain-unreachable-pats.rs:92:9
| |
LL | (_, true) => {} LL | (_, true) => {}
| ^^^^^^^^^ unreachable pattern | ^^^^^^^^^ no value can reach this
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/explain-unreachable-pats.rs:70:9 --> $DIR/explain-unreachable-pats.rs:92:9
| |
LL | (true, _) => {} LL | (true, _) => {}
| --------- matches some of the same values | --------- matches some of the same values
@ -83,22 +107,22 @@ LL | (_, true) => {}
| ^^^^^^^^^ collectively making this unreachable | ^^^^^^^^^ collectively making this unreachable
error: unreachable pattern error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:83:9 --> $DIR/explain-unreachable-pats.rs:105:9
| |
LL | (true, _) => {} LL | (true, _) => {}
| --------- matches all the values already | --------- matches all the relevant values
... ...
LL | (true, true) => {} LL | (true, true) => {}
| ^^^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:95:9 --> $DIR/explain-unreachable-pats.rs:117:9
| |
LL | (_, true, 0..10) => {} LL | (_, true, 0..10) => {}
| ---------------- matches all the values already | ---------------- matches all the relevant values
... ...
LL | (_, true, 3) => {} LL | (_, true, 3) => {}
| ^^^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^^^ no value can reach this
error: aborting due to 9 previous errors error: aborting due to 10 previous errors

View File

@ -15,9 +15,9 @@ error: unreachable pattern
--> $DIR/floats.rs:18:9 --> $DIR/floats.rs:18:9
| |
LL | 0.01f16..=6.5f16 => {} LL | 0.01f16..=6.5f16 => {}
| ---------------- matches all the values already | ---------------- matches all the relevant values
LL | 0.01f16 => {} LL | 0.01f16 => {}
| ^^^^^^^ unreachable pattern | ^^^^^^^ no value can reach this
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/floats.rs:1:9 --> $DIR/floats.rs:1:9
@ -29,117 +29,117 @@ error: unreachable pattern
--> $DIR/floats.rs:19:9 --> $DIR/floats.rs:19:9
| |
LL | 0.01f16..=6.5f16 => {} LL | 0.01f16..=6.5f16 => {}
| ---------------- matches all the values already | ---------------- matches all the relevant values
LL | 0.01f16 => {} LL | 0.01f16 => {}
LL | 0.02f16 => {} LL | 0.02f16 => {}
| ^^^^^^^ unreachable pattern | ^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/floats.rs:20:9 --> $DIR/floats.rs:20:9
| |
LL | 0.01f16..=6.5f16 => {} LL | 0.01f16..=6.5f16 => {}
| ---------------- matches all the values already | ---------------- matches all the relevant values
... ...
LL | 6.5f16 => {} LL | 6.5f16 => {}
| ^^^^^^ unreachable pattern | ^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/floats.rs:31:9 --> $DIR/floats.rs:31:9
| |
LL | 0.01f32..=6.5f32 => {} LL | 0.01f32..=6.5f32 => {}
| ---------------- matches all the values already | ---------------- matches all the relevant values
LL | 0.01f32 => {} LL | 0.01f32 => {}
| ^^^^^^^ unreachable pattern | ^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/floats.rs:32:9 --> $DIR/floats.rs:32:9
| |
LL | 0.01f32..=6.5f32 => {} LL | 0.01f32..=6.5f32 => {}
| ---------------- matches all the values already | ---------------- matches all the relevant values
LL | 0.01f32 => {} LL | 0.01f32 => {}
LL | 0.02f32 => {} LL | 0.02f32 => {}
| ^^^^^^^ unreachable pattern | ^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/floats.rs:33:9 --> $DIR/floats.rs:33:9
| |
LL | 0.01f32..=6.5f32 => {} LL | 0.01f32..=6.5f32 => {}
| ---------------- matches all the values already | ---------------- matches all the relevant values
... ...
LL | 6.5f32 => {} LL | 6.5f32 => {}
| ^^^^^^ unreachable pattern | ^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/floats.rs:45:9 --> $DIR/floats.rs:45:9
| |
LL | 0.01f64..=6.5f64 => {} LL | 0.01f64..=6.5f64 => {}
| ---------------- matches all the values already | ---------------- matches all the relevant values
LL | 0.005f64 => {} LL | 0.005f64 => {}
LL | 0.01f64 => {} LL | 0.01f64 => {}
| ^^^^^^^ unreachable pattern | ^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/floats.rs:46:9 --> $DIR/floats.rs:46:9
| |
LL | 0.01f64..=6.5f64 => {} LL | 0.01f64..=6.5f64 => {}
| ---------------- matches all the values already | ---------------- matches all the relevant values
... ...
LL | 0.02f64 => {} LL | 0.02f64 => {}
| ^^^^^^^ unreachable pattern | ^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/floats.rs:47:9 --> $DIR/floats.rs:47:9
| |
LL | 0.01f64..=6.5f64 => {} LL | 0.01f64..=6.5f64 => {}
| ---------------- matches all the values already | ---------------- matches all the relevant values
... ...
LL | 6.5f64 => {} LL | 6.5f64 => {}
| ^^^^^^ unreachable pattern | ^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/floats.rs:49:9 --> $DIR/floats.rs:49:9
| |
LL | 0.01f64..=6.5f64 => {} LL | 0.01f64..=6.5f64 => {}
| ---------------- matches all the values already | ---------------- matches all the relevant values
... ...
LL | 1.0f64..=4.0f64 => {} LL | 1.0f64..=4.0f64 => {}
| ^^^^^^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/floats.rs:62:9 --> $DIR/floats.rs:62:9
| |
LL | 0.01f128..=6.5f128 => {} LL | 0.01f128..=6.5f128 => {}
| ------------------ matches all the values already | ------------------ matches all the relevant values
LL | 0.005f128 => {} LL | 0.005f128 => {}
LL | 0.01f128 => {} LL | 0.01f128 => {}
| ^^^^^^^^ unreachable pattern | ^^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/floats.rs:63:9 --> $DIR/floats.rs:63:9
| |
LL | 0.01f128..=6.5f128 => {} LL | 0.01f128..=6.5f128 => {}
| ------------------ matches all the values already | ------------------ matches all the relevant values
... ...
LL | 0.02f128 => {} LL | 0.02f128 => {}
| ^^^^^^^^ unreachable pattern | ^^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/floats.rs:64:9 --> $DIR/floats.rs:64:9
| |
LL | 0.01f128..=6.5f128 => {} LL | 0.01f128..=6.5f128 => {}
| ------------------ matches all the values already | ------------------ matches all the relevant values
... ...
LL | 6.5f128 => {} LL | 6.5f128 => {}
| ^^^^^^^ unreachable pattern | ^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/floats.rs:66:9 --> $DIR/floats.rs:66:9
| |
LL | 0.01f128..=6.5f128 => {} LL | 0.01f128..=6.5f128 => {}
| ------------------ matches all the values already | ------------------ matches all the relevant values
... ...
LL | 1.0f128..=4.0f128 => {} LL | 1.0f128..=4.0f128 => {}
| ^^^^^^^^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^^^^^^^^ no value can reach this
error: aborting due to 15 previous errors error: aborting due to 15 previous errors

View File

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/impl-trait.rs:16:13 --> $DIR/impl-trait.rs:16:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `Void` is uninhabited
| |
= note: this pattern matches no values because `Void` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here note: the lint level is defined here
--> $DIR/impl-trait.rs:4:9 --> $DIR/impl-trait.rs:4:9
| |
@ -15,49 +15,49 @@ error: unreachable pattern
--> $DIR/impl-trait.rs:30:13 --> $DIR/impl-trait.rs:30:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `Void` is uninhabited
| |
= note: this pattern matches no values because `Void` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:44:13 --> $DIR/impl-trait.rs:44:13
| |
LL | Some(_) => {} LL | Some(_) => {}
| ^^^^^^^ | ^^^^^^^ matches no values because `Void` is uninhabited
| |
= note: this pattern matches no values because `Void` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:48:13 --> $DIR/impl-trait.rs:48:13
| |
LL | None => {} LL | None => {}
| ---- matches all the values already | ---- matches all the relevant values
LL | _ => {} LL | _ => {}
| ^ unreachable pattern | ^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:58:13 --> $DIR/impl-trait.rs:58:13
| |
LL | Some(_) => {} LL | Some(_) => {}
| ^^^^^^^ | ^^^^^^^ matches no values because `Void` is uninhabited
| |
= note: this pattern matches no values because `Void` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:62:13 --> $DIR/impl-trait.rs:62:13
| |
LL | None => {} LL | None => {}
| ---- matches all the values already | ---- matches all the relevant values
LL | _ => {} LL | _ => {}
| ^ unreachable pattern | ^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:75:9 --> $DIR/impl-trait.rs:75:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `Void` is uninhabited
| |
= note: this pattern matches no values because `Void` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:85:9 --> $DIR/impl-trait.rs:85:9
@ -65,23 +65,23 @@ error: unreachable pattern
LL | _ => {} LL | _ => {}
| - matches any value | - matches any value
LL | Some((a, b)) => {} LL | Some((a, b)) => {}
| ^^^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:93:13 --> $DIR/impl-trait.rs:93:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `Void` is uninhabited
| |
= note: this pattern matches no values because `Void` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:104:9 --> $DIR/impl-trait.rs:104:9
| |
LL | Some((a, b)) => {} LL | Some((a, b)) => {}
| ------------ matches all the values already | ------------ matches all the relevant values
LL | Some((mut x, mut y)) => { LL | Some((mut x, mut y)) => {
| ^^^^^^^^^^^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^^^^^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:123:13 --> $DIR/impl-trait.rs:123:13
@ -89,23 +89,23 @@ error: unreachable pattern
LL | _ => {} LL | _ => {}
| - matches any value | - matches any value
LL | Rec { n: 0, w: Some(Rec { n: 0, w: _ }) } => {} LL | Rec { n: 0, w: Some(Rec { n: 0, w: _ }) } => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:137:13 --> $DIR/impl-trait.rs:137:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `SecretelyVoid` is uninhabited
| |
= note: this pattern matches no values because `SecretelyVoid` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:150:13 --> $DIR/impl-trait.rs:150:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^ matches no values because `SecretelyDoubleVoid` is uninhabited
| |
= note: this pattern matches no values because `SecretelyDoubleVoid` is uninhabited = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error[E0004]: non-exhaustive patterns: type `impl Copy` is non-empty error[E0004]: non-exhaustive patterns: type `impl Copy` is non-empty
--> $DIR/impl-trait.rs:22:11 --> $DIR/impl-trait.rs:22:11

View File

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/reachability.rs:18:17 --> $DIR/reachability.rs:18:17
| |
LL | m!(0u8, 42, 42); LL | m!(0u8, 42, 42);
| -- ^^ unreachable pattern | -- ^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/reachability.rs:3:9 --> $DIR/reachability.rs:3:9
@ -16,129 +16,129 @@ error: unreachable pattern
--> $DIR/reachability.rs:22:22 --> $DIR/reachability.rs:22:22
| |
LL | m!(0u8, 20..=30, 20); LL | m!(0u8, 20..=30, 20);
| ------- ^^ unreachable pattern | ------- ^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:23:22 --> $DIR/reachability.rs:23:22
| |
LL | m!(0u8, 20..=30, 21); LL | m!(0u8, 20..=30, 21);
| ------- ^^ unreachable pattern | ------- ^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:24:22 --> $DIR/reachability.rs:24:22
| |
LL | m!(0u8, 20..=30, 25); LL | m!(0u8, 20..=30, 25);
| ------- ^^ unreachable pattern | ------- ^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:25:22 --> $DIR/reachability.rs:25:22
| |
LL | m!(0u8, 20..=30, 29); LL | m!(0u8, 20..=30, 29);
| ------- ^^ unreachable pattern | ------- ^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:26:22 --> $DIR/reachability.rs:26:22
| |
LL | m!(0u8, 20..=30, 30); LL | m!(0u8, 20..=30, 30);
| ------- ^^ unreachable pattern | ------- ^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:29:21 --> $DIR/reachability.rs:29:21
| |
LL | m!(0u8, 20..30, 20); LL | m!(0u8, 20..30, 20);
| ------ ^^ unreachable pattern | ------ ^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:30:21 --> $DIR/reachability.rs:30:21
| |
LL | m!(0u8, 20..30, 21); LL | m!(0u8, 20..30, 21);
| ------ ^^ unreachable pattern | ------ ^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:31:21 --> $DIR/reachability.rs:31:21
| |
LL | m!(0u8, 20..30, 25); LL | m!(0u8, 20..30, 25);
| ------ ^^ unreachable pattern | ------ ^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:32:21 --> $DIR/reachability.rs:32:21
| |
LL | m!(0u8, 20..30, 29); LL | m!(0u8, 20..30, 29);
| ------ ^^ unreachable pattern | ------ ^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:36:22 --> $DIR/reachability.rs:36:22
| |
LL | m!(0u8, 20..=30, 20..=30); LL | m!(0u8, 20..=30, 20..=30);
| ------- ^^^^^^^ unreachable pattern | ------- ^^^^^^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:37:22 --> $DIR/reachability.rs:37:22
| |
LL | m!(0u8, 20.. 30, 20.. 30); LL | m!(0u8, 20.. 30, 20.. 30);
| ------- ^^^^^^^ unreachable pattern | ------- ^^^^^^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:38:22 --> $DIR/reachability.rs:38:22
| |
LL | m!(0u8, 20..=30, 20.. 30); LL | m!(0u8, 20..=30, 20.. 30);
| ------- ^^^^^^^ unreachable pattern | ------- ^^^^^^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:40:22 --> $DIR/reachability.rs:40:22
| |
LL | m!(0u8, 20..=30, 21..=30); LL | m!(0u8, 20..=30, 21..=30);
| ------- ^^^^^^^ unreachable pattern | ------- ^^^^^^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:41:22 --> $DIR/reachability.rs:41:22
| |
LL | m!(0u8, 20..=30, 20..=29); LL | m!(0u8, 20..=30, 20..=29);
| ------- ^^^^^^^ unreachable pattern | ------- ^^^^^^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:43:24 --> $DIR/reachability.rs:43:24
| |
LL | m!('a', 'A'..='z', 'a'..='z'); LL | m!('a', 'A'..='z', 'a'..='z');
| --------- ^^^^^^^^^ unreachable pattern | --------- ^^^^^^^^^ no value can reach this
| | | |
| matches all the values already | matches all the relevant values
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:50:9 --> $DIR/reachability.rs:50:9
| |
LL | 5..=8 => {}, LL | 5..=8 => {},
| ^^^^^ unreachable pattern | ^^^^^ no value can reach this
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/reachability.rs:50:9 --> $DIR/reachability.rs:50:9
| |
LL | 5 => {}, LL | 5 => {},
@ -156,9 +156,9 @@ error: unreachable pattern
--> $DIR/reachability.rs:56:9 --> $DIR/reachability.rs:56:9
| |
LL | 5..15 => {}, LL | 5..15 => {},
| ^^^^^ unreachable pattern | ^^^^^ no value can reach this
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/reachability.rs:56:9 --> $DIR/reachability.rs:56:9
| |
LL | 0..10 => {}, LL | 0..10 => {},
@ -172,9 +172,9 @@ error: unreachable pattern
--> $DIR/reachability.rs:63:9 --> $DIR/reachability.rs:63:9
| |
LL | 5..25 => {}, LL | 5..25 => {},
| ^^^^^ unreachable pattern | ^^^^^ no value can reach this
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/reachability.rs:63:9 --> $DIR/reachability.rs:63:9
| |
LL | 0..10 => {}, LL | 0..10 => {},
@ -190,9 +190,9 @@ error: unreachable pattern
--> $DIR/reachability.rs:71:9 --> $DIR/reachability.rs:71:9
| |
LL | 5..25 => {}, LL | 5..25 => {},
| ^^^^^ unreachable pattern | ^^^^^ no value can reach this
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/reachability.rs:71:9 --> $DIR/reachability.rs:71:9
| |
LL | 0..10 => {}, LL | 0..10 => {},
@ -210,9 +210,9 @@ error: unreachable pattern
--> $DIR/reachability.rs:77:9 --> $DIR/reachability.rs:77:9
| |
LL | 5..15 => {}, LL | 5..15 => {},
| ^^^^^ unreachable pattern | ^^^^^ no value can reach this
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/reachability.rs:77:9 --> $DIR/reachability.rs:77:9
| |
LL | 0..10 => {}, LL | 0..10 => {},
@ -228,15 +228,15 @@ error: unreachable pattern
LL | _ => {}, LL | _ => {},
| - matches any value | - matches any value
LL | '\u{D7FF}'..='\u{E000}' => {}, LL | '\u{D7FF}'..='\u{E000}' => {},
| ^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:89:9 --> $DIR/reachability.rs:89:9
| |
LL | '\u{D7FF}'..='\u{E000}' => {}, LL | '\u{D7FF}'..='\u{E000}' => {},
| ^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this
| |
note: these patterns collectively make the last one unreachable note: multiple earlier patterns match some of the same values
--> $DIR/reachability.rs:89:9 --> $DIR/reachability.rs:89:9
| |
LL | '\u{0}'..='\u{D7FF}' => {}, LL | '\u{0}'..='\u{D7FF}' => {},
@ -250,18 +250,18 @@ error: unreachable pattern
--> $DIR/reachability.rs:105:9 --> $DIR/reachability.rs:105:9
| |
LL | &42 => {} LL | &42 => {}
| --- matches all the values already | --- matches all the relevant values
LL | &FOO => {} LL | &FOO => {}
| ^^^^ unreachable pattern | ^^^^ no value can reach this
error: unreachable pattern error: unreachable pattern
--> $DIR/reachability.rs:106:9 --> $DIR/reachability.rs:106:9
| |
LL | &42 => {} LL | &42 => {}
| --- matches all the values already | --- matches all the relevant values
LL | &FOO => {} LL | &FOO => {}
LL | BAR => {} LL | BAR => {}
| ^^^ unreachable pattern | ^^^ no value can reach this
error: aborting due to 25 previous errors error: aborting due to 25 previous errors

View File

@ -2,9 +2,9 @@ error: unreachable pattern
--> $DIR/issue-12116.rs:15:9 --> $DIR/issue-12116.rs:15:9
| |
LL | &IntList::Cons(val, box ref next_list) => tail(next_list), LL | &IntList::Cons(val, box ref next_list) => tail(next_list),
| -------------------------------------- matches all the values already | -------------------------------------- matches all the relevant values
LL | &IntList::Cons(val, box IntList::Nil) => IntList::Cons(val, Box::new(IntList::Nil)), LL | &IntList::Cons(val, box IntList::Nil) => IntList::Cons(val, Box::new(IntList::Nil)),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/issue-12116.rs:4:9 --> $DIR/issue-12116.rs:4:9

Some files were not shown because too many files have changed in this diff Show More