diff --git a/compiler/rustc_builtin_macros/src/asm.rs b/compiler/rustc_builtin_macros/src/asm.rs
index d67d872b884a5..768cb99510fda 100644
--- a/compiler/rustc_builtin_macros/src/asm.rs
+++ b/compiler/rustc_builtin_macros/src/asm.rs
@@ -8,13 +8,14 @@ use rustc_expand::base::{self, *};
use rustc_parse::parser::Parser;
use rustc_parse_format as parse;
use rustc_session::lint;
+use rustc_session::parse::ParseSess;
use rustc_span::symbol::Ident;
use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::{InnerSpan, Span};
use rustc_target::asm::InlineAsmArch;
use smallvec::smallvec;
-struct AsmArgs {
+pub struct AsmArgs {
templates: Vec
>,
operands: Vec<(ast::InlineAsmOperand, Span)>,
named_args: FxHashMap,
@@ -31,15 +32,28 @@ fn parse_args<'a>(
is_global_asm: bool,
) -> Result> {
let mut p = ecx.new_parser_from_tts(tts);
+ let sess = &ecx.sess.parse_sess;
+ parse_asm_args(&mut p, sess, sp, is_global_asm)
+}
+
+// Primarily public for rustfmt consumption.
+// Internal consumers should continue to leverage `expand_asm`/`expand__global_asm`
+pub fn parse_asm_args<'a>(
+ p: &mut Parser<'a>,
+ sess: &'a ParseSess,
+ sp: Span,
+ is_global_asm: bool,
+) -> Result> {
+ let diag = &sess.span_diagnostic;
if p.token == token::Eof {
- return Err(ecx.struct_span_err(sp, "requires at least a template string argument"));
+ return Err(diag.struct_span_err(sp, "requires at least a template string argument"));
}
// Detect use of the legacy llvm_asm! syntax (which used to be called asm!)
if !is_global_asm && p.look_ahead(1, |t| *t == token::Colon || *t == token::ModSep) {
let mut err =
- ecx.struct_span_err(sp, "the legacy LLVM-style asm! syntax is no longer supported");
+ diag.struct_span_err(sp, "the legacy LLVM-style asm! syntax is no longer supported");
err.note("consider migrating to the new asm! syntax specified in RFC 2873");
err.note("alternatively, switch to llvm_asm! to keep your code working as it is");
return Err(err);
@@ -61,7 +75,7 @@ fn parse_args<'a>(
if !p.eat(&token::Comma) {
if allow_templates {
// After a template string, we always expect *only* a comma...
- let mut err = ecx.struct_span_err(p.token.span, "expected token: `,`");
+ let mut err = diag.struct_span_err(p.token.span, "expected token: `,`");
err.span_label(p.token.span, "expected `,`");
p.maybe_annotate_with_ascription(&mut err, false);
return Err(err);
@@ -76,14 +90,14 @@ fn parse_args<'a>(
// Parse clobber_abi
if p.eat_keyword(sym::clobber_abi) {
- parse_clobber_abi(&mut p, &mut args)?;
+ parse_clobber_abi(p, &mut args)?;
allow_templates = false;
continue;
}
// Parse options
if p.eat_keyword(sym::options) {
- parse_options(&mut p, &mut args, is_global_asm)?;
+ parse_options(p, &mut args, is_global_asm)?;
allow_templates = false;
continue;
}
@@ -103,25 +117,25 @@ fn parse_args<'a>(
let mut explicit_reg = false;
let op = if !is_global_asm && p.eat_keyword(kw::In) {
- let reg = parse_reg(&mut p, &mut explicit_reg)?;
+ let reg = parse_reg(p, &mut explicit_reg)?;
if p.eat_keyword(kw::Underscore) {
- let err = ecx.struct_span_err(p.token.span, "_ cannot be used for input operands");
+ let err = diag.struct_span_err(p.token.span, "_ cannot be used for input operands");
return Err(err);
}
let expr = p.parse_expr()?;
ast::InlineAsmOperand::In { reg, expr }
} else if !is_global_asm && p.eat_keyword(sym::out) {
- let reg = parse_reg(&mut p, &mut explicit_reg)?;
+ let reg = parse_reg(p, &mut explicit_reg)?;
let expr = if p.eat_keyword(kw::Underscore) { None } else { Some(p.parse_expr()?) };
ast::InlineAsmOperand::Out { reg, expr, late: false }
} else if !is_global_asm && p.eat_keyword(sym::lateout) {
- let reg = parse_reg(&mut p, &mut explicit_reg)?;
+ let reg = parse_reg(p, &mut explicit_reg)?;
let expr = if p.eat_keyword(kw::Underscore) { None } else { Some(p.parse_expr()?) };
ast::InlineAsmOperand::Out { reg, expr, late: true }
} else if !is_global_asm && p.eat_keyword(sym::inout) {
- let reg = parse_reg(&mut p, &mut explicit_reg)?;
+ let reg = parse_reg(p, &mut explicit_reg)?;
if p.eat_keyword(kw::Underscore) {
- let err = ecx.struct_span_err(p.token.span, "_ cannot be used for input operands");
+ let err = diag.struct_span_err(p.token.span, "_ cannot be used for input operands");
return Err(err);
}
let expr = p.parse_expr()?;
@@ -133,9 +147,9 @@ fn parse_args<'a>(
ast::InlineAsmOperand::InOut { reg, expr, late: false }
}
} else if !is_global_asm && p.eat_keyword(sym::inlateout) {
- let reg = parse_reg(&mut p, &mut explicit_reg)?;
+ let reg = parse_reg(p, &mut explicit_reg)?;
if p.eat_keyword(kw::Underscore) {
- let err = ecx.struct_span_err(p.token.span, "_ cannot be used for input operands");
+ let err = diag.struct_span_err(p.token.span, "_ cannot be used for input operands");
return Err(err);
}
let expr = p.parse_expr()?;
@@ -154,7 +168,7 @@ fn parse_args<'a>(
match expr.kind {
ast::ExprKind::Path(..) => {}
_ => {
- let err = ecx
+ let err = diag
.struct_span_err(expr.span, "argument to `sym` must be a path expression");
return Err(err);
}
@@ -173,7 +187,7 @@ fn parse_args<'a>(
} else {
"expected operand, clobber_abi, options, or additional template string"
};
- let mut err = ecx.struct_span_err(template.span, errstr);
+ let mut err = diag.struct_span_err(template.span, errstr);
err.span_label(template.span, errstr);
return Err(err);
}
@@ -193,31 +207,31 @@ fn parse_args<'a>(
// clobber_abi/options. We do this at the end once we have the full span
// of the argument available.
if !args.options_spans.is_empty() {
- ecx.struct_span_err(span, "arguments are not allowed after options")
+ diag.struct_span_err(span, "arguments are not allowed after options")
.span_labels(args.options_spans.clone(), "previous options")
.span_label(span, "argument")
.emit();
} else if let Some((_, abi_span)) = args.clobber_abis.last() {
- ecx.struct_span_err(span, "arguments are not allowed after clobber_abi")
+ diag.struct_span_err(span, "arguments are not allowed after clobber_abi")
.span_label(*abi_span, "clobber_abi")
.span_label(span, "argument")
.emit();
}
if explicit_reg {
if name.is_some() {
- ecx.struct_span_err(span, "explicit register arguments cannot have names").emit();
+ diag.struct_span_err(span, "explicit register arguments cannot have names").emit();
}
args.reg_args.insert(slot);
} else if let Some(name) = name {
if let Some(&prev) = args.named_args.get(&name) {
- ecx.struct_span_err(span, &format!("duplicate argument named `{}`", name))
+ diag.struct_span_err(span, &format!("duplicate argument named `{}`", name))
.span_label(args.operands[prev].1, "previously here")
.span_label(span, "duplicate argument")
.emit();
continue;
}
if !args.reg_args.is_empty() {
- let mut err = ecx.struct_span_err(
+ let mut err = diag.struct_span_err(
span,
"named arguments cannot follow explicit register arguments",
);
@@ -230,7 +244,7 @@ fn parse_args<'a>(
args.named_args.insert(name, slot);
} else {
if !args.named_args.is_empty() || !args.reg_args.is_empty() {
- let mut err = ecx.struct_span_err(
+ let mut err = diag.struct_span_err(
span,
"positional arguments cannot follow named arguments \
or explicit register arguments",
@@ -251,21 +265,21 @@ fn parse_args<'a>(
&& args.options.contains(ast::InlineAsmOptions::READONLY)
{
let spans = args.options_spans.clone();
- ecx.struct_span_err(spans, "the `nomem` and `readonly` options are mutually exclusive")
+ diag.struct_span_err(spans, "the `nomem` and `readonly` options are mutually exclusive")
.emit();
}
if args.options.contains(ast::InlineAsmOptions::PURE)
&& args.options.contains(ast::InlineAsmOptions::NORETURN)
{
let spans = args.options_spans.clone();
- ecx.struct_span_err(spans, "the `pure` and `noreturn` options are mutually exclusive")
+ diag.struct_span_err(spans, "the `pure` and `noreturn` options are mutually exclusive")
.emit();
}
if args.options.contains(ast::InlineAsmOptions::PURE)
&& !args.options.intersects(ast::InlineAsmOptions::NOMEM | ast::InlineAsmOptions::READONLY)
{
let spans = args.options_spans.clone();
- ecx.struct_span_err(
+ diag.struct_span_err(
spans,
"the `pure` option must be combined with either `nomem` or `readonly`",
)
@@ -296,14 +310,14 @@ fn parse_args<'a>(
}
}
if args.options.contains(ast::InlineAsmOptions::PURE) && !have_real_output {
- ecx.struct_span_err(
+ diag.struct_span_err(
args.options_spans.clone(),
"asm with the `pure` option must have at least one output",
)
.emit();
}
if args.options.contains(ast::InlineAsmOptions::NORETURN) && !outputs_sp.is_empty() {
- let err = ecx
+ let err = diag
.struct_span_err(outputs_sp, "asm outputs are not allowed with the `noreturn` option");
// Bail out now since this is likely to confuse MIR
@@ -312,7 +326,7 @@ fn parse_args<'a>(
if args.clobber_abis.len() > 0 {
if is_global_asm {
- let err = ecx.struct_span_err(
+ let err = diag.struct_span_err(
args.clobber_abis.iter().map(|(_, span)| *span).collect::>(),
"`clobber_abi` cannot be used with `global_asm!`",
);
@@ -321,7 +335,7 @@ fn parse_args<'a>(
return Err(err);
}
if !regclass_outputs.is_empty() {
- ecx.struct_span_err(
+ diag.struct_span_err(
regclass_outputs.clone(),
"asm with `clobber_abi` must specify explicit registers for outputs",
)
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
index cc39332d198f0..c2c815c2b7848 100644
--- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
+++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
@@ -1036,14 +1036,25 @@ pub fn compile_unit_metadata(
None => PathBuf::from(&*tcx.crate_name(LOCAL_CRATE).as_str()),
};
- // The OSX linker has an idiosyncrasy where it will ignore some debuginfo
- // if multiple object files with the same `DW_AT_name` are linked together.
- // As a workaround we generate unique names for each object file. Those do
- // not correspond to an actual source file but that is harmless.
- if tcx.sess.target.is_like_osx {
- name_in_debuginfo.push("@");
- name_in_debuginfo.push(codegen_unit_name);
- }
+ // To avoid breaking split DWARF, we need to ensure that each codegen unit
+ // has a unique `DW_AT_name`. This is because there's a remote chance that
+ // different codegen units for the same module will have entirely
+ // identical DWARF entries for the purpose of the DWO ID, which would
+ // violate Appendix F ("Split Dwarf Object Files") of the DWARF 5
+ // specification. LLVM uses the algorithm specified in section 7.32 "Type
+ // Signature Computation" to compute the DWO ID, which does not include
+ // any fields that would distinguish compilation units. So we must embed
+ // the codegen unit name into the `DW_AT_name`. (Issue #88521.)
+ //
+ // Additionally, the OSX linker has an idiosyncrasy where it will ignore
+ // some debuginfo if multiple object files with the same `DW_AT_name` are
+ // linked together.
+ //
+ // As a workaround for these two issues, we generate unique names for each
+ // object file. Those do not correspond to an actual source file but that
+ // is harmless.
+ name_in_debuginfo.push("@");
+ name_in_debuginfo.push(codegen_unit_name);
debug!("compile_unit_metadata: {:?}", name_in_debuginfo);
let rustc_producer =
diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs
index d768f06c4f00d..d9faa6777eae9 100644
--- a/compiler/rustc_const_eval/src/interpret/eval_context.rs
+++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs
@@ -616,19 +616,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
match self.size_and_align_of(metadata, &field)? {
Some(size_and_align) => size_and_align,
None => {
- // A field with extern type. If this field is at offset 0, we behave
- // like the underlying extern type.
- // FIXME: Once we have made decisions for how to handle size and alignment
- // of `extern type`, this should be adapted. It is just a temporary hack
- // to get some code to work that probably ought to work.
- if sized_size == Size::ZERO {
- return Ok(None);
- } else {
- span_bug!(
- self.cur_span(),
- "Fields cannot be extern types, unless they are at offset 0"
- )
- }
+ // A field with an extern type. We don't know the actual dynamic size
+ // or the alignment.
+ return Ok(None);
}
};
diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs
index 851c2a6bb2e39..818b95b7fc4f3 100644
--- a/compiler/rustc_const_eval/src/interpret/place.rs
+++ b/compiler/rustc_const_eval/src/interpret/place.rs
@@ -362,21 +362,15 @@ where
// Re-use parent metadata to determine dynamic field layout.
// With custom DSTS, this *will* execute user-defined code, but the same
// happens at run-time so that's okay.
- let align = match self.size_and_align_of(&base.meta, &field_layout)? {
- Some((_, align)) => align,
- None if offset == Size::ZERO => {
- // An extern type at offset 0, we fall back to its static alignment.
- // FIXME: Once we have made decisions for how to handle size and alignment
- // of `extern type`, this should be adapted. It is just a temporary hack
- // to get some code to work that probably ought to work.
- field_layout.align.abi
+ match self.size_and_align_of(&base.meta, &field_layout)? {
+ Some((_, align)) => (base.meta, offset.align_to(align)),
+ None => {
+ // For unsized types with an extern type tail we perform no adjustments.
+ // NOTE: keep this in sync with `PlaceRef::project_field` in the codegen backend.
+ assert!(matches!(base.meta, MemPlaceMeta::None));
+ (base.meta, offset)
}
- None => span_bug!(
- self.cur_span(),
- "cannot compute offset for extern type field at non-0 offset"
- ),
- };
- (base.meta, offset.align_to(align))
+ }
} else {
// base.meta could be present; we might be accessing a sized field of an unsized
// struct.
diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs
index da1edcf6fe3b4..ed24b94e2fd3b 100644
--- a/compiler/rustc_lint/src/unused.rs
+++ b/compiler/rustc_lint/src/unused.rs
@@ -169,7 +169,9 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
}
if !(type_permits_lack_of_use || fn_warned || op_warned) {
- cx.struct_span_lint(UNUSED_RESULTS, s.span, |lint| lint.build("unused result").emit());
+ cx.struct_span_lint(UNUSED_RESULTS, s.span, |lint| {
+ lint.build(&format!("unused result of type `{}`", ty)).emit()
+ });
}
// Returns whether an error has been emitted (and thus another does not need to be later).
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index 78e33544655f0..e2de9f12aaa71 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -771,11 +771,24 @@ rustc_queries! {
desc { |tcx| "type-checking `{}`", tcx.def_path_str(key.to_def_id()) }
cache_on_disk_if { true }
load_cached(tcx, id) {
- let typeck_results: Option> = tcx
- .on_disk_cache().as_ref()
- .and_then(|c| c.try_load_query_result(*tcx, id));
+ #[cfg(bootstrap)]
+ {
+ match match tcx.on_disk_cache().as_ref() {
+ Some(c) => c.try_load_query_result(*tcx, id),
+ None => None,
+ } {
+ Some(x) => Some(&*tcx.arena.alloc(x)),
+ None => None,
+ }
+ }
+ #[cfg(not(bootstrap))]
+ {
+ let typeck_results: Option> = tcx
+ .on_disk_cache().as_ref()
+ .and_then(|c| c.try_load_query_result(*tcx, id));
- typeck_results.map(|x| &*tcx.arena.alloc(x))
+ typeck_results.map(|x| &*tcx.arena.alloc(x))
+ }
}
}
diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
index d74c53fae533b..370fea9be075c 100644
--- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
+++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
@@ -17,7 +17,7 @@ use rustc_session::lint::builtin::{
BINDINGS_WITH_VARIANT_NAME, IRREFUTABLE_LET_PATTERNS, UNREACHABLE_PATTERNS,
};
use rustc_session::Session;
-use rustc_span::{DesugaringKind, ExpnKind, Span};
+use rustc_span::{DesugaringKind, ExpnKind, MultiSpan, Span};
crate fn check_match(tcx: TyCtxt<'_>, def_id: DefId) {
let body_id = match def_id.as_local() {
@@ -63,7 +63,9 @@ impl<'tcx> Visitor<'tcx> for MatchVisitor<'_, '_, 'tcx> {
fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) {
intravisit::walk_expr(self, ex);
match &ex.kind {
- hir::ExprKind::Match(scrut, arms, source) => self.check_match(scrut, arms, *source),
+ hir::ExprKind::Match(scrut, arms, source) => {
+ self.check_match(scrut, arms, *source, ex.span)
+ }
hir::ExprKind::Let(pat, scrut, span) => self.check_let(pat, scrut, *span),
_ => {}
}
@@ -160,6 +162,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
scrut: &hir::Expr<'_>,
hir_arms: &'tcx [hir::Arm<'tcx>],
source: hir::MatchSource,
+ expr_span: Span,
) {
let mut cx = self.new_cx(scrut.hir_id);
@@ -205,7 +208,6 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
}
// Check if the match is exhaustive.
- let is_empty_match = arms.is_empty();
let witnesses = report.non_exhaustiveness_witnesses;
if !witnesses.is_empty() {
if source == hir::MatchSource::ForLoopDesugar && hir_arms.len() == 2 {
@@ -213,7 +215,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
let pat = hir_arms[1].pat.for_loop_some().unwrap();
self.check_irrefutable(pat, "`for` loop binding", None);
} else {
- non_exhaustive_match(&cx, scrut_ty, scrut.span, witnesses, is_empty_match);
+ non_exhaustive_match(&cx, scrut_ty, scrut.span, witnesses, hir_arms, expr_span);
}
}
}
@@ -496,8 +498,10 @@ fn non_exhaustive_match<'p, 'tcx>(
scrut_ty: Ty<'tcx>,
sp: Span,
witnesses: Vec>,
- is_empty_match: bool,
+ arms: &[hir::Arm<'tcx>],
+ expr_span: Span,
) {
+ let is_empty_match = arms.is_empty();
let non_empty_enum = match scrut_ty.kind() {
ty::Adt(def, _) => def.is_enum() && !def.variants.is_empty(),
_ => false,
@@ -505,12 +509,14 @@ fn non_exhaustive_match<'p, 'tcx>(
// In the case of an empty match, replace the '`_` not covered' diagnostic with something more
// informative.
let mut err;
+ let pattern;
if is_empty_match && !non_empty_enum {
err = create_e0004(
cx.tcx.sess,
sp,
format!("non-exhaustive patterns: type `{}` is non-empty", scrut_ty),
);
+ pattern = "_".to_string();
} else {
let joined_patterns = joined_uncovered_patterns(cx, &witnesses);
err = create_e0004(
@@ -519,6 +525,15 @@ fn non_exhaustive_match<'p, 'tcx>(
format!("non-exhaustive patterns: {} not covered", joined_patterns),
);
err.span_label(sp, pattern_not_covered_label(&witnesses, &joined_patterns));
+ pattern = if witnesses.len() < 4 {
+ witnesses
+ .iter()
+ .map(|witness| witness.to_pat(cx).to_string())
+ .collect::>()
+ .join(" | ")
+ } else {
+ "_".to_string()
+ };
};
let is_variant_list_non_exhaustive = match scrut_ty.kind() {
@@ -527,10 +542,6 @@ fn non_exhaustive_match<'p, 'tcx>(
};
adt_defined_here(cx, &mut err, scrut_ty, &witnesses);
- err.help(
- "ensure that all possible cases are being handled, \
- possibly by adding wildcards or more match arms",
- );
err.note(&format!(
"the matched value is of type `{}`{}",
scrut_ty,
@@ -542,14 +553,14 @@ fn non_exhaustive_match<'p, 'tcx>(
&& matches!(witnesses[0].ctor(), Constructor::NonExhaustive)
{
err.note(&format!(
- "`{}` does not have a fixed maximum value, \
- so a wildcard `_` is necessary to match exhaustively",
+ "`{}` does not have a fixed maximum value, so a wildcard `_` is necessary to match \
+ exhaustively",
scrut_ty,
));
if cx.tcx.sess.is_nightly_build() {
err.help(&format!(
- "add `#![feature(precise_pointer_size_matching)]` \
- to the crate attributes to enable precise `{}` matching",
+ "add `#![feature(precise_pointer_size_matching)]` to the crate attributes to \
+ enable precise `{}` matching",
scrut_ty,
));
}
@@ -559,6 +570,67 @@ fn non_exhaustive_match<'p, 'tcx>(
err.note("references are always considered inhabited");
}
}
+
+ let mut suggestion = None;
+ let sm = cx.tcx.sess.source_map();
+ match arms {
+ [] if sp.ctxt() == expr_span.ctxt() => {
+ // Get the span for the empty match body `{}`.
+ let (indentation, more) = if let Some(snippet) = sm.indentation_before(sp) {
+ (format!("\n{}", snippet), " ")
+ } else {
+ (" ".to_string(), "")
+ };
+ suggestion = Some((
+ sp.shrink_to_hi().with_hi(expr_span.hi()),
+ format!(
+ " {{{indentation}{more}{pattern} => todo!(),{indentation}}}",
+ indentation = indentation,
+ more = more,
+ pattern = pattern,
+ ),
+ ));
+ }
+ [only] => {
+ let pre_indentation = if let (Some(snippet), true) = (
+ sm.indentation_before(only.span),
+ sm.is_multiline(sp.shrink_to_hi().with_hi(only.span.lo())),
+ ) {
+ format!("\n{}", snippet)
+ } else {
+ " ".to_string()
+ };
+ let comma = if matches!(only.body.kind, hir::ExprKind::Block(..)) { "" } else { "," };
+ suggestion = Some((
+ only.span.shrink_to_hi(),
+ format!("{}{}{} => todo!()", comma, pre_indentation, pattern),
+ ));
+ }
+ [.., prev, last] if prev.span.ctxt() == last.span.ctxt() => {
+ if let Ok(snippet) = sm.span_to_snippet(prev.span.between(last.span)) {
+ let comma =
+ if matches!(last.body.kind, hir::ExprKind::Block(..)) { "" } else { "," };
+ suggestion = Some((
+ last.span.shrink_to_hi(),
+ format!(
+ "{}{}{} => todo!()",
+ comma,
+ snippet.strip_prefix(",").unwrap_or(&snippet),
+ pattern
+ ),
+ ));
+ }
+ }
+ _ => {}
+ }
+
+ let msg = "ensure that all possible cases are being handled, possibly by adding wildcards \
+ or more match arms";
+ if let Some((span, sugg)) = suggestion {
+ err.span_suggestion_verbose(span, msg, sugg, Applicability::HasPlaceholders);
+ } else {
+ err.help(msg);
+ }
err.emit();
}
@@ -599,15 +671,27 @@ fn adt_defined_here<'p, 'tcx>(
) {
let ty = ty.peel_refs();
if let ty::Adt(def, _) = ty.kind() {
- if let Some(sp) = cx.tcx.hir().span_if_local(def.did) {
- err.span_label(sp, format!("`{}` defined here", ty));
- }
-
- if witnesses.len() < 4 {
+ let mut spans = vec![];
+ if witnesses.len() < 5 {
for sp in maybe_point_at_variant(cx, def, witnesses.iter()) {
- err.span_label(sp, "not covered");
+ spans.push(sp);
}
}
+ let def_span = cx
+ .tcx
+ .hir()
+ .get_if_local(def.did)
+ .and_then(|node| node.ident())
+ .map(|ident| ident.span)
+ .unwrap_or_else(|| cx.tcx.def_span(def.did));
+ let mut span: MultiSpan =
+ if spans.is_empty() { def_span.into() } else { spans.clone().into() };
+
+ span.push_span_label(def_span, String::new());
+ for pat in spans {
+ span.push_span_label(pat, "not covered".to_string());
+ }
+ err.span_note(span, &format!("`{}` defined here", ty));
}
}
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs
index da1baa36d6eae..67f77f14a6e6b 100644
--- a/library/core/src/lib.rs
+++ b/library/core/src/lib.rs
@@ -123,6 +123,7 @@
#![feature(const_num_from_num)]
#![feature(const_ops)]
#![feature(const_option)]
+#![feature(const_option_ext)]
#![feature(const_pin)]
#![feature(const_replace)]
#![feature(const_ptr_is_null)]
diff --git a/library/core/src/option.rs b/library/core/src/option.rs
index 015366ed490c7..8969c6f617130 100644
--- a/library/core/src/option.rs
+++ b/library/core/src/option.rs
@@ -589,12 +589,13 @@ impl Option {
#[must_use]
#[inline]
#[unstable(feature = "option_result_contains", issue = "62358")]
- pub fn contains(&self, x: &U) -> bool
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn contains(&self, x: &U) -> bool
where
- U: PartialEq,
+ U: ~const PartialEq,
{
match self {
- Some(y) => x == y,
+ Some(y) => x.eq(y),
None => false,
}
}
@@ -660,10 +661,14 @@ impl Option {
#[inline]
#[must_use]
#[stable(feature = "pin", since = "1.33.0")]
- pub fn as_pin_ref(self: Pin<&Self>) -> Option> {
- // SAFETY: `x` is guaranteed to be pinned because it comes from `self`
- // which is pinned.
- unsafe { Pin::get_ref(self).as_ref().map(|x| Pin::new_unchecked(x)) }
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn as_pin_ref(self: Pin<&Self>) -> Option> {
+ match Pin::get_ref(self).as_ref() {
+ // SAFETY: `x` is guaranteed to be pinned because it comes from `self`
+ // which is pinned.
+ Some(x) => unsafe { Some(Pin::new_unchecked(x)) },
+ None => None,
+ }
}
/// Converts from [Pin]<[&mut] Option\>
to Option<[Pin]<[&mut] T>>
.
@@ -672,10 +677,16 @@ impl Option {
#[inline]
#[must_use]
#[stable(feature = "pin", since = "1.33.0")]
- pub fn as_pin_mut(self: Pin<&mut Self>) -> Option> {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn as_pin_mut(self: Pin<&mut Self>) -> Option> {
// SAFETY: `get_unchecked_mut` is never used to move the `Option` inside `self`.
// `x` is guaranteed to be pinned because it comes from `self` which is pinned.
- unsafe { Pin::get_unchecked_mut(self).as_mut().map(|x| Pin::new_unchecked(x)) }
+ unsafe {
+ match Pin::get_unchecked_mut(self).as_mut() {
+ Some(x) => Some(Pin::new_unchecked(x)),
+ None => None,
+ }
+ }
}
/////////////////////////////////////////////////////////////////////////
@@ -764,7 +775,11 @@ impl Option {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- pub fn unwrap_or(self, default: T) -> T {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn unwrap_or(self, default: T) -> T
+ where
+ T: ~const Drop,
+ {
match self {
Some(x) => x,
None => default,
@@ -782,7 +797,12 @@ impl Option {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- pub fn unwrap_or_else T>(self, f: F) -> T {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn unwrap_or_else(self, f: F) -> T
+ where
+ F: ~const FnOnce() -> T,
+ F: ~const Drop,
+ {
match self {
Some(x) => x,
None => f(),
@@ -812,7 +832,8 @@ impl Option {
#[inline]
#[track_caller]
#[stable(feature = "option_result_unwrap_unchecked", since = "1.58.0")]
- pub unsafe fn unwrap_unchecked(self) -> T {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const unsafe fn unwrap_unchecked(self) -> T {
debug_assert!(self.is_some());
match self {
Some(val) => val,
@@ -842,7 +863,12 @@ impl Option {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- pub fn map U>(self, f: F) -> Option {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn map(self, f: F) -> Option
+ where
+ F: ~const FnOnce(T) -> U,
+ F: ~const Drop,
+ {
match self {
Some(x) => Some(f(x)),
None => None,
@@ -866,7 +892,12 @@ impl Option {
/// ```
#[inline]
#[unstable(feature = "result_option_inspect", issue = "91345")]
- pub fn inspect(self, f: F) -> Self {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn inspect(self, f: F) -> Self
+ where
+ F: ~const FnOnce(&T),
+ F: ~const Drop,
+ {
if let Some(ref x) = self {
f(x);
}
@@ -894,7 +925,13 @@ impl Option {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- pub fn map_or U>(self, default: U, f: F) -> U {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn map_or(self, default: U, f: F) -> U
+ where
+ F: ~const FnOnce(T) -> U,
+ F: ~const Drop,
+ U: ~const Drop,
+ {
match self {
Some(t) => f(t),
None => default,
@@ -917,7 +954,14 @@ impl Option {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- pub fn map_or_else U, F: FnOnce(T) -> U>(self, default: D, f: F) -> U {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn map_or_else(self, default: D, f: F) -> U
+ where
+ D: ~const FnOnce() -> U,
+ D: ~const Drop,
+ F: ~const FnOnce(T) -> U,
+ F: ~const Drop,
+ {
match self {
Some(t) => f(t),
None => default(),
@@ -947,7 +991,11 @@ impl Option {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- pub fn ok_or(self, err: E) -> Result {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn ok_or(self, err: E) -> Result
+ where
+ E: ~const Drop,
+ {
match self {
Some(v) => Ok(v),
None => Err(err),
@@ -972,7 +1020,12 @@ impl Option {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- pub fn ok_or_else E>(self, err: F) -> Result {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn ok_or_else(self, err: F) -> Result
+ where
+ F: ~const FnOnce() -> E,
+ F: ~const Drop,
+ {
match self {
Some(v) => Ok(v),
None => Err(err()),
@@ -1049,7 +1102,12 @@ impl Option {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- pub fn and(self, optb: Option) -> Option {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn and(self, optb: Option) -> Option
+ where
+ T: ~const Drop,
+ U: ~const Drop,
+ {
match self {
Some(_) => optb,
None => None,
@@ -1074,7 +1132,12 @@ impl Option {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- pub fn and_then Option>(self, f: F) -> Option {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn and_then(self, f: F) -> Option
+ where
+ F: ~const FnOnce(T) -> Option,
+ F: ~const Drop,
+ {
match self {
Some(x) => f(x),
None => None,
@@ -1107,7 +1170,13 @@ impl Option {
/// [`Some(t)`]: Some
#[inline]
#[stable(feature = "option_filter", since = "1.27.0")]
- pub fn filter bool>(self, predicate: P) -> Self {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn filter(self, predicate: P) -> Self
+ where
+ T: ~const Drop,
+ P: ~const FnOnce(&T) -> bool,
+ P: ~const Drop,
+ {
if let Some(x) = self {
if predicate(&x) {
return Some(x);
@@ -1145,9 +1214,13 @@ impl Option {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- pub fn or(self, optb: Option) -> Option {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn or(self, optb: Option) -> Option
+ where
+ T: ~const Drop,
+ {
match self {
- Some(_) => self,
+ Some(x) => Some(x),
None => optb,
}
}
@@ -1167,9 +1240,14 @@ impl Option {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- pub fn or_else Option>(self, f: F) -> Option {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn or_else(self, f: F) -> Option
+ where
+ F: ~const FnOnce() -> Option,
+ F: ~const Drop,
+ {
match self {
- Some(_) => self,
+ Some(x) => Some(x),
None => f(),
}
}
@@ -1197,7 +1275,11 @@ impl Option {
/// ```
#[inline]
#[stable(feature = "option_xor", since = "1.37.0")]
- pub fn xor(self, optb: Option) -> Option {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn xor(self, optb: Option) -> Option
+ where
+ T: ~const Drop,
+ {
match (self, optb) {
(Some(a), None) => Some(a),
(None, Some(b)) => Some(b),
@@ -1231,7 +1313,11 @@ impl Option {
#[must_use = "if you intended to set a value, consider assignment instead"]
#[inline]
#[stable(feature = "option_insert", since = "1.53.0")]
- pub fn insert(&mut self, value: T) -> &mut T {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn insert(&mut self, value: T) -> &mut T
+ where
+ T: ~const Drop,
+ {
*self = Some(value);
// SAFETY: the code above just filled the option
@@ -1260,8 +1346,18 @@ impl Option {
/// ```
#[inline]
#[stable(feature = "option_entry", since = "1.20.0")]
- pub fn get_or_insert(&mut self, value: T) -> &mut T {
- self.get_or_insert_with(|| value)
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn get_or_insert(&mut self, value: T) -> &mut T
+ where
+ T: ~const Drop,
+ {
+ if let None = *self {
+ *self = Some(value);
+ }
+
+ // SAFETY: a `None` variant for `self` would have been replaced by a `Some`
+ // variant in the code above.
+ unsafe { self.as_mut().unwrap_unchecked() }
}
/// Inserts the default value into the option if it is [`None`], then
@@ -1285,11 +1381,17 @@ impl Option {
/// ```
#[inline]
#[unstable(feature = "option_get_or_insert_default", issue = "82901")]
- pub fn get_or_insert_default(&mut self) -> &mut T
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn get_or_insert_default(&mut self) -> &mut T
where
- T: Default,
+ T: ~const Default,
{
- self.get_or_insert_with(Default::default)
+ #[rustc_allow_const_fn_unstable(const_fn_trait_bound)]
+ const fn default() -> T {
+ T::default()
+ }
+
+ self.get_or_insert_with(default)
}
/// Inserts a value computed from `f` into the option if it is [`None`],
@@ -1311,17 +1413,21 @@ impl Option {
/// ```
#[inline]
#[stable(feature = "option_entry", since = "1.20.0")]
- pub fn get_or_insert_with T>(&mut self, f: F) -> &mut T {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn get_or_insert_with(&mut self, f: F) -> &mut T
+ where
+ F: ~const FnOnce() -> T,
+ F: ~const Drop,
+ {
if let None = *self {
- *self = Some(f());
+ // the compiler isn't smart enough to know that we are not dropping a `T`
+ // here and wants us to ensure `T` can be dropped at compile time.
+ mem::forget(mem::replace(self, Some(f())))
}
- match self {
- Some(v) => v,
- // SAFETY: a `None` variant for `self` would have been replaced by a `Some`
- // variant in the code above.
- None => unsafe { hint::unreachable_unchecked() },
- }
+ // SAFETY: a `None` variant for `self` would have been replaced by a `Some`
+ // variant in the code above.
+ unsafe { self.as_mut().unwrap_unchecked() }
}
/////////////////////////////////////////////////////////////////////////
@@ -1391,7 +1497,12 @@ impl Option {
/// assert_eq!(x.zip(z), None);
/// ```
#[stable(feature = "option_zip_option", since = "1.46.0")]
- pub fn zip(self, other: Option) -> Option<(T, U)> {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn zip(self, other: Option) -> Option<(T, U)>
+ where
+ T: ~const Drop,
+ U: ~const Drop,
+ {
match (self, other) {
(Some(a), Some(b)) => Some((a, b)),
_ => None,
@@ -1427,11 +1538,18 @@ impl Option {
/// assert_eq!(x.zip_with(None, Point::new), None);
/// ```
#[unstable(feature = "option_zip", issue = "70086")]
- pub fn zip_with(self, other: Option, f: F) -> Option
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn zip_with(self, other: Option, f: F) -> Option
where
- F: FnOnce(T, U) -> R,
+ F: ~const FnOnce(T, U) -> R,
+ F: ~const Drop,
+ T: ~const Drop,
+ U: ~const Drop,
{
- Some(f(self?, other?))
+ match (self, other) {
+ (Some(a), Some(b)) => Some(f(a, b)),
+ _ => None,
+ }
}
}
@@ -1503,8 +1621,12 @@ impl Option<&mut T> {
/// ```
#[must_use = "`self` will be dropped if the result is not used"]
#[stable(feature = "copied", since = "1.35.0")]
- pub fn copied(self) -> Option {
- self.map(|&mut t| t)
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn copied(self) -> Option {
+ match self {
+ Some(&mut t) => Some(t),
+ None => None,
+ }
}
}
@@ -1591,7 +1713,11 @@ impl Option {
/// [`FromStr`]: crate::str::FromStr
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- pub fn unwrap_or_default(self) -> T {
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn unwrap_or_default(self) -> T
+ where
+ T: ~const Default,
+ {
match self {
Some(x) => x,
None => Default::default(),
@@ -1615,8 +1741,15 @@ impl Option {
/// assert_eq!(x.as_deref(), None);
/// ```
#[stable(feature = "option_deref", since = "1.40.0")]
- pub fn as_deref(&self) -> Option<&T::Target> {
- self.as_ref().map(|t| t.deref())
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn as_deref(&self) -> Option<&T::Target>
+ where
+ T: ~const Deref,
+ {
+ match self.as_ref() {
+ Some(t) => Some(t.deref()),
+ None => None,
+ }
}
}
@@ -1636,8 +1769,15 @@ impl Option {
/// }), Some("HEY".to_owned().as_mut_str()));
/// ```
#[stable(feature = "option_deref", since = "1.40.0")]
- pub fn as_deref_mut(&mut self) -> Option<&mut T::Target> {
- self.as_mut().map(|t| t.deref_mut())
+ #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
+ pub const fn as_deref_mut(&mut self) -> Option<&mut T::Target>
+ where
+ T: ~const DerefMut,
+ {
+ match self.as_mut() {
+ Some(t) => Some(t.deref_mut()),
+ None => None,
+ }
}
}
diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
index dacb33619f8c3..21562acf3d766 100644
--- a/library/core/tests/lib.rs
+++ b/library/core/tests/lib.rs
@@ -70,8 +70,10 @@
#![feature(portable_simd)]
#![feature(ptr_metadata)]
#![feature(once_cell)]
+#![feature(option_result_contains)]
#![feature(unsized_tuple_coercion)]
#![feature(const_option)]
+#![feature(const_option_ext)]
#![feature(const_result)]
#![feature(integer_atomics)]
#![feature(int_roundings)]
diff --git a/library/core/tests/option.rs b/library/core/tests/option.rs
index cd07d6c52c2ad..da692461261fc 100644
--- a/library/core/tests/option.rs
+++ b/library/core/tests/option.rs
@@ -86,17 +86,49 @@ fn test_and() {
let x: Option = None;
assert_eq!(x.and(Some(2)), None);
assert_eq!(x.and(None::), None);
+
+ const FOO: Option = Some(1);
+ const A: Option = FOO.and(Some(2));
+ const B: Option = FOO.and(None);
+ assert_eq!(A, Some(2));
+ assert_eq!(B, None);
+
+ const BAR: Option = None;
+ const C: Option = BAR.and(Some(2));
+ const D: Option = BAR.and(None);
+ assert_eq!(C, None);
+ assert_eq!(D, None);
}
#[test]
fn test_and_then() {
+ const fn plus_one(x: isize) -> Option {
+ Some(x + 1)
+ }
+
+ const fn none(_: isize) -> Option {
+ None
+ }
+
let x: Option = Some(1);
- assert_eq!(x.and_then(|x| Some(x + 1)), Some(2));
- assert_eq!(x.and_then(|_| None::), None);
+ assert_eq!(x.and_then(plus_one), Some(2));
+ assert_eq!(x.and_then(none), None);
let x: Option = None;
- assert_eq!(x.and_then(|x| Some(x + 1)), None);
- assert_eq!(x.and_then(|_| None::), None);
+ assert_eq!(x.and_then(plus_one), None);
+ assert_eq!(x.and_then(none), None);
+
+ const FOO: Option = Some(1);
+ const A: Option = FOO.and_then(plus_one);
+ const B: Option = FOO.and_then(none);
+ assert_eq!(A, Some(2));
+ assert_eq!(B, None);
+
+ const BAR: Option = None;
+ const C: Option = BAR.and_then(plus_one);
+ const D: Option = BAR.and_then(none);
+ assert_eq!(C, None);
+ assert_eq!(D, None);
}
#[test]
@@ -108,17 +140,49 @@ fn test_or() {
let x: Option = None;
assert_eq!(x.or(Some(2)), Some(2));
assert_eq!(x.or(None), None);
+
+ const FOO: Option = Some(1);
+ const A: Option = FOO.or(Some(2));
+ const B: Option = FOO.or(None);
+ assert_eq!(A, Some(1));
+ assert_eq!(B, Some(1));
+
+ const BAR: Option = None;
+ const C: Option = BAR.or(Some(2));
+ const D: Option = BAR.or(None);
+ assert_eq!(C, Some(2));
+ assert_eq!(D, None);
}
#[test]
fn test_or_else() {
+ const fn two() -> Option {
+ Some(2)
+ }
+
+ const fn none() -> Option {
+ None
+ }
+
let x: Option = Some(1);
- assert_eq!(x.or_else(|| Some(2)), Some(1));
- assert_eq!(x.or_else(|| None), Some(1));
+ assert_eq!(x.or_else(two), Some(1));
+ assert_eq!(x.or_else(none), Some(1));
let x: Option = None;
- assert_eq!(x.or_else(|| Some(2)), Some(2));
- assert_eq!(x.or_else(|| None), None);
+ assert_eq!(x.or_else(two), Some(2));
+ assert_eq!(x.or_else(none), None);
+
+ const FOO: Option = Some(1);
+ const A: Option = FOO.or_else(two);
+ const B: Option = FOO.or_else(none);
+ assert_eq!(A, Some(1));
+ assert_eq!(B, Some(1));
+
+ const BAR: Option = None;
+ const C: Option = BAR.or_else(two);
+ const D: Option = BAR.or_else(none);
+ assert_eq!(C, Some(2));
+ assert_eq!(D, None);
}
#[test]
@@ -149,15 +213,29 @@ fn test_unwrap_or() {
let x: Option = None;
assert_eq!(x.unwrap_or(2), 2);
+
+ const A: isize = Some(1).unwrap_or(2);
+ const B: isize = None.unwrap_or(2);
+ assert_eq!(A, 1);
+ assert_eq!(B, 2);
}
#[test]
fn test_unwrap_or_else() {
+ const fn two() -> isize {
+ 2
+ }
+
let x: Option = Some(1);
- assert_eq!(x.unwrap_or_else(|| 2), 1);
+ assert_eq!(x.unwrap_or_else(two), 1);
let x: Option = None;
- assert_eq!(x.unwrap_or_else(|| 2), 2);
+ assert_eq!(x.unwrap_or_else(two), 2);
+
+ const A: isize = Some(1).unwrap_or_else(two);
+ const B: isize = None.unwrap_or_else(two);
+ assert_eq!(A, 1);
+ assert_eq!(B, 2);
}
#[test]
diff --git a/library/std/src/os/unix/net/ancillary.rs b/library/std/src/os/unix/net/ancillary.rs
index a29008140f784..6e6f5212b4651 100644
--- a/library/std/src/os/unix/net/ancillary.rs
+++ b/library/std/src/os/unix/net/ancillary.rs
@@ -16,8 +16,6 @@ mod libc {
pub use libc::c_int;
pub struct ucred;
pub struct cmsghdr;
- #[cfg(target_os = "dragonfly")]
- pub struct cmsgcred;
pub type pid_t = i32;
pub type gid_t = u32;
pub type uid_t = u32;
@@ -185,11 +183,6 @@ impl<'a, T> Iterator for AncillaryDataIter<'a, T> {
#[derive(Clone)]
pub struct SocketCred(libc::ucred);
-#[cfg(target_os = "dragonfly")]
-#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
-#[derive(Clone)]
-pub struct SocketCred(libc::cmsgcred);
-
#[cfg(any(doc, target_os = "android", target_os = "linux",))]
impl SocketCred {
/// Create a Unix credential struct.
@@ -241,57 +234,6 @@ impl SocketCred {
}
}
-#[cfg(target_os = "dragonfly")]
-impl SocketCred {
- /// Create a Unix credential struct.
- ///
- /// PID, UID and GID is set to 0.
- #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
- #[must_use]
- pub fn new() -> SocketCred {
- SocketCred(libc::cmsgcred { cmsgcred_pid: 0, cmsgcred_uid: 0, cmsgcred_gid: 0 })
- }
-
- /// Set the PID.
- #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
- pub fn set_pid(&mut self, pid: libc::pid_t) {
- self.0.cmsgcred_pid = pid;
- }
-
- /// Get the current PID.
- #[must_use]
- #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
- pub fn get_pid(&self) -> libc::pid_t {
- self.0.cmsgcred_pid
- }
-
- /// Set the UID.
- #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
- pub fn set_uid(&mut self, uid: libc::uid_t) {
- self.0.cmsgcred_uid = uid;
- }
-
- /// Get the current UID.
- #[must_use]
- #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
- pub fn get_uid(&self) -> libc::uid_t {
- self.0.cmsgcred_uid
- }
-
- /// Set the GID.
- #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
- pub fn set_gid(&mut self, gid: libc::gid_t) {
- self.0.cmsgcred_gid = gid;
- }
-
- /// Get the current GID.
- #[must_use]
- #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
- pub fn get_gid(&self) -> libc::gid_t {
- self.0.cmsgcred_gid
- }
-}
-
/// This control message contains file descriptors.
///
/// The level is equal to `SOL_SOCKET` and the type is equal to `SCM_RIGHTS`.
@@ -314,11 +256,7 @@ impl<'a> Iterator for ScmRights<'a> {
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
pub struct ScmCredentials<'a>(AncillaryDataIter<'a, libc::ucred>);
-#[cfg(target_os = "dragonfly")]
-#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
-pub struct ScmCredentials<'a>(AncillaryDataIter<'a, libc::cmsgcred>);
-
-#[cfg(any(doc, target_os = "android", target_os = "linux", target_os = "dragonfly",))]
+#[cfg(any(doc, target_os = "android", target_os = "linux",))]
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
impl<'a> Iterator for ScmCredentials<'a> {
type Item = SocketCred;
@@ -362,7 +300,7 @@ impl<'a> AncillaryData<'a> {
/// # Safety
///
/// `data` must contain a valid control message and the control message must be type of
- /// `SOL_SOCKET` and level of `SCM_CREDENTIALS` or `SCM_CREDS`.
+ /// `SOL_SOCKET` and level of `SCM_CREDENTIALS` or `SCM_CREDENTIALS`.
#[cfg(any(doc, target_os = "android", target_os = "linux",))]
unsafe fn as_credentials(data: &'a [u8]) -> Self {
let ancillary_data_iter = AncillaryDataIter::new(data);
@@ -382,9 +320,6 @@ impl<'a> AncillaryData<'a> {
libc::SCM_RIGHTS => Ok(AncillaryData::as_rights(data)),
#[cfg(any(target_os = "android", target_os = "linux",))]
libc::SCM_CREDENTIALS => Ok(AncillaryData::as_credentials(data)),
- #[cfg(target_os = "dragonfly")]
- libc::SCM_CREDS => Ok(AncillaryData::as_credentials(data)),
-
cmsg_type => {
Err(AncillaryError::Unknown { cmsg_level: libc::SOL_SOCKET, cmsg_type })
}
@@ -609,19 +544,6 @@ impl<'a> SocketAncillary<'a> {
)
}
- #[cfg(target_os = "dragonfly")]
- #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
- pub fn add_creds(&mut self, creds: &[SocketCred]) -> bool {
- self.truncated = false;
- add_to_ancillary_data(
- &mut self.buffer,
- &mut self.length,
- creds,
- libc::SOL_SOCKET,
- libc::SCM_CREDS,
- )
- }
-
/// Clears the ancillary data, removing all values.
///
/// # Example
diff --git a/library/std/src/os/unix/net/datagram.rs b/library/std/src/os/unix/net/datagram.rs
index f23f8f94a242f..a2caccc784917 100644
--- a/library/std/src/os/unix/net/datagram.rs
+++ b/library/std/src/os/unix/net/datagram.rs
@@ -854,14 +854,8 @@ impl UnixDatagram {
///
/// # Examples
///
- #[cfg_attr(
- any(target_os = "android", target_os = "linux", target_os = "dragonfly"),
- doc = "```no_run"
- )]
- #[cfg_attr(
- not(any(target_os = "android", target_os = "linux", target_os = "dragonfly")),
- doc = "```ignore"
- )]
+ #[cfg_attr(any(target_os = "android", target_os = "linux"), doc = "```no_run")]
+ #[cfg_attr(not(any(target_os = "android", target_os = "linux")), doc = "```ignore")]
/// #![feature(unix_socket_ancillary_data)]
/// use std::os::unix::net::UnixDatagram;
///
@@ -871,7 +865,7 @@ impl UnixDatagram {
/// Ok(())
/// }
/// ```
- #[cfg(any(doc, target_os = "android", target_os = "linux", target_os = "dragonfly",))]
+ #[cfg(any(doc, target_os = "android", target_os = "linux",))]
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
pub fn set_passcred(&self, passcred: bool) -> io::Result<()> {
self.0.set_passcred(passcred)
@@ -883,7 +877,7 @@ impl UnixDatagram {
/// Get the socket option `SO_PASSCRED`.
///
/// [`set_passcred`]: UnixDatagram::set_passcred
- #[cfg(any(doc, target_os = "android", target_os = "linux", target_os = "dragonfly",))]
+ #[cfg(any(doc, target_os = "android", target_os = "linux",))]
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
pub fn passcred(&self) -> io::Result {
self.0.passcred()
diff --git a/library/std/src/sys/unix/net.rs b/library/std/src/sys/unix/net.rs
index 15d0dbe07fe7e..a82a0172126d4 100644
--- a/library/std/src/sys/unix/net.rs
+++ b/library/std/src/sys/unix/net.rs
@@ -408,12 +408,12 @@ impl Socket {
Ok(raw != 0)
}
- #[cfg(any(target_os = "android", target_os = "linux", target_os = "dragonfly",))]
+ #[cfg(any(target_os = "android", target_os = "linux",))]
pub fn set_passcred(&self, passcred: bool) -> io::Result<()> {
setsockopt(self, libc::SOL_SOCKET, libc::SO_PASSCRED, passcred as libc::c_int)
}
- #[cfg(any(target_os = "android", target_os = "linux", target_os = "dragonfly",))]
+ #[cfg(any(target_os = "android", target_os = "linux",))]
pub fn passcred(&self) -> io::Result {
let passcred: libc::c_int = getsockopt(self, libc::SOL_SOCKET, libc::SO_PASSCRED)?;
Ok(passcred != 0)
diff --git a/src/test/ui/closures/2229_closure_analysis/match/issue-88331.stderr b/src/test/ui/closures/2229_closure_analysis/match/issue-88331.stderr
index f02d23464f168..205a0e7c6fd47 100644
--- a/src/test/ui/closures/2229_closure_analysis/match/issue-88331.stderr
+++ b/src/test/ui/closures/2229_closure_analysis/match/issue-88331.stderr
@@ -1,26 +1,38 @@
error[E0004]: non-exhaustive patterns: `Opcode(0_u8)` and `Opcode(2_u8..=u8::MAX)` not covered
--> $DIR/issue-88331.rs:11:20
|
-LL | pub struct Opcode(pub u8);
- | -------------------------- `Opcode` defined here
-...
LL | move |i| match msg_type {
| ^^^^^^^^ patterns `Opcode(0_u8)` and `Opcode(2_u8..=u8::MAX)` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `Opcode` defined here
+ --> $DIR/issue-88331.rs:4:12
+ |
+LL | pub struct Opcode(pub u8);
+ | ^^^^^^
= note: the matched value is of type `Opcode`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ Opcode::OP1 => unimplemented!(),
+LL ~ Opcode(0_u8) | Opcode(2_u8..=u8::MAX) => todo!(),
+ |
error[E0004]: non-exhaustive patterns: `Opcode2(Opcode(0_u8))` and `Opcode2(Opcode(2_u8..=u8::MAX))` not covered
--> $DIR/issue-88331.rs:27:20
|
-LL | pub struct Opcode2(Opcode);
- | --------------------------- `Opcode2` defined here
-...
LL | move |i| match msg_type {
| ^^^^^^^^ patterns `Opcode2(Opcode(0_u8))` and `Opcode2(Opcode(2_u8..=u8::MAX))` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `Opcode2` defined here
+ --> $DIR/issue-88331.rs:18:12
+ |
+LL | pub struct Opcode2(Opcode);
+ | ^^^^^^^
= note: the matched value is of type `Opcode2`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ Opcode2::OP2=> unimplemented!(),
+LL ~ Opcode2(Opcode(0_u8)) | Opcode2(Opcode(2_u8..=u8::MAX)) => todo!(),
+ |
error: aborting due to 2 previous errors
diff --git a/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr b/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr
index 91ffe1a47f413..02bd60893eb6b 100644
--- a/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr
+++ b/src/test/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr
@@ -1,17 +1,19 @@
error[E0004]: non-exhaustive patterns: `B` not covered
--> $DIR/non-exhaustive-match.rs:26:25
|
-LL | enum L1 { A, B }
- | ----------------
- | | |
- | | not covered
- | `L1` defined here
-...
LL | let _b = || { match l1 { L1::A => () } };
| ^^ pattern `B` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `L1` defined here
+ --> $DIR/non-exhaustive-match.rs:12:14
+ |
+LL | enum L1 { A, B }
+ | -- ^ not covered
= note: the matched value is of type `L1`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL | let _b = || { match l1 { L1::A => (), B => todo!() } };
+ | ++++++++++++++
error[E0004]: non-exhaustive patterns: type `E1` is non-empty
--> $DIR/non-exhaustive-match.rs:37:25
@@ -19,8 +21,18 @@ error[E0004]: non-exhaustive patterns: type `E1` is non-empty
LL | let _d = || { match e1 {} };
| ^^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `E1` defined here
+ --> $DIR/auxiliary/match_non_exhaustive_lib.rs:2:1
+ |
+LL | pub enum E1 {}
+ | ^^^^^^^^^^^^^^
= note: the matched value is of type `E1`, which is marked as non-exhaustive
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ let _d = || { match e1 {
+LL + _ => todo!(),
+LL ~ } };
+ |
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/non-exhaustive-match.rs:39:25
@@ -28,8 +40,16 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | let _e = || { match e2 { E2::A => (), E2::B => () } };
| ^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `E2` defined here
+ --> $DIR/auxiliary/match_non_exhaustive_lib.rs:5:1
+ |
+LL | pub enum E2 { A, B }
+ | ^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `E2`, which is marked as non-exhaustive
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL | let _e = || { match e2 { E2::A => (), E2::B => (), _ => todo!() } };
+ | ++++++++++++++
error[E0505]: cannot move out of `e3` because it is borrowed
--> $DIR/non-exhaustive-match.rs:46:22
diff --git a/src/test/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.stderr b/src/test/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.stderr
index 45641ea3de3e0..44b3c559e5e5d 100644
--- a/src/test/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.stderr
+++ b/src/test/ui/closures/2229_closure_analysis/match/pattern-matching-should-fail.stderr
@@ -4,8 +4,13 @@ error[E0004]: non-exhaustive patterns: type `u8` is non-empty
LL | let c1 = || match x { };
| ^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ let c1 = || match x {
+LL + _ => todo!(),
+LL ~ };
+ |
error[E0381]: use of possibly-uninitialized variable: `x`
--> $DIR/pattern-matching-should-fail.rs:8:23
diff --git a/src/test/ui/closures/closure-expected.stderr b/src/test/ui/closures/closure-expected.stderr
index 8b38d5ff4592c..7ffe3c1ef954a 100644
--- a/src/test/ui/closures/closure-expected.stderr
+++ b/src/test/ui/closures/closure-expected.stderr
@@ -11,8 +11,8 @@ LL | let y = x.or_else(4);
note: required by a bound in `Option::::or_else`
--> $SRC_DIR/core/src/option.rs:LL:COL
|
-LL | pub fn or_else Option>(self, f: F) -> Option {
- | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::::or_else`
+LL | F: ~const FnOnce() -> Option,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::::or_else`
error: aborting due to previous error
diff --git a/src/test/ui/closures/coerce-unsafe-to-closure.stderr b/src/test/ui/closures/coerce-unsafe-to-closure.stderr
index 24db272534730..883348eb98c70 100644
--- a/src/test/ui/closures/coerce-unsafe-to-closure.stderr
+++ b/src/test/ui/closures/coerce-unsafe-to-closure.stderr
@@ -10,8 +10,8 @@ LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute);
note: required by a bound in `Option::::map`
--> $SRC_DIR/core/src/option.rs:LL:COL
|
-LL | pub fn map U>(self, f: F) -> Option {
- | ^^^^^^^^^^^^^^ required by this bound in `Option::::map`
+LL | F: ~const FnOnce(T) -> U,
+ | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::::map`
error: aborting due to previous error
diff --git a/src/test/ui/consts/const-eval/issue-91827-extern-types.rs b/src/test/ui/consts/const-eval/issue-91827-extern-types.rs
new file mode 100644
index 0000000000000..d5576ebfd0296
--- /dev/null
+++ b/src/test/ui/consts/const-eval/issue-91827-extern-types.rs
@@ -0,0 +1,58 @@
+// run-pass
+//
+// Test that we can handle unsized types with an extern type tail part.
+// Regression test for issue #91827.
+
+#![feature(const_ptr_offset_from)]
+#![feature(const_slice_from_raw_parts)]
+#![feature(extern_types)]
+
+use std::ptr::addr_of;
+
+extern "C" {
+ type Opaque;
+}
+
+unsafe impl Sync for Opaque {}
+
+#[repr(C)]
+pub struct List {
+ len: usize,
+ data: [T; 0],
+ tail: Opaque,
+}
+
+#[repr(C)]
+pub struct ListImpl {
+ len: usize,
+ data: [T; N],
+}
+
+impl List {
+ const fn as_slice(&self) -> &[T] {
+ unsafe { std::slice::from_raw_parts(self.data.as_ptr(), self.len) }
+ }
+}
+
+impl ListImpl {
+ const fn as_list(&self) -> &List {
+ unsafe { std::mem::transmute(self) }
+ }
+}
+
+pub static A: ListImpl = ListImpl {
+ len: 3,
+ data: [5, 6, 7],
+};
+pub static A_REF: &'static List = A.as_list();
+pub static A_TAIL_OFFSET: isize = tail_offset(A.as_list());
+
+const fn tail_offset(list: &List) -> isize {
+ unsafe { (addr_of!(list.tail) as *const u8).offset_from(list as *const List as *const u8) }
+}
+
+fn main() {
+ assert_eq!(A_REF.as_slice(), &[5, 6, 7]);
+ // Check that interpreter and code generation agree about the position of the tail field.
+ assert_eq!(A_TAIL_OFFSET, tail_offset(A_REF));
+}
diff --git a/src/test/ui/empty/empty-never-array.stderr b/src/test/ui/empty/empty-never-array.stderr
index 64d640c0e9dbc..8dd0f377533ce 100644
--- a/src/test/ui/empty/empty-never-array.stderr
+++ b/src/test/ui/empty/empty-never-array.stderr
@@ -1,19 +1,18 @@
error[E0005]: refutable pattern in local binding: `T(_, _)` not covered
--> $DIR/empty-never-array.rs:10:9
|
-LL | / enum Helper {
-LL | | T(T, [!; 0]),
- | | - not covered
-LL | | #[allow(dead_code)]
-LL | | U(U),
-LL | | }
- | |_- `Helper` defined here
-...
-LL | let Helper::U(u) = Helper::T(t, []);
- | ^^^^^^^^^^^^ pattern `T(_, _)` not covered
+LL | let Helper::U(u) = Helper::T(t, []);
+ | ^^^^^^^^^^^^ pattern `T(_, _)` not covered
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
+note: `Helper` defined here
+ --> $DIR/empty-never-array.rs:4:5
+ |
+LL | enum Helper {
+ | ------
+LL | T(T, [!; 0]),
+ | ^ not covered
= note: the matched value is of type `Helper`
help: you might want to use `if let` to ignore the variant that isn't matched
|
diff --git a/src/test/ui/error-codes/E0004-2.stderr b/src/test/ui/error-codes/E0004-2.stderr
index fd0215e72ee24..3dfa1fed48faa 100644
--- a/src/test/ui/error-codes/E0004-2.stderr
+++ b/src/test/ui/error-codes/E0004-2.stderr
@@ -4,16 +4,27 @@ error[E0004]: non-exhaustive patterns: `None` and `Some(_)` not covered
LL | match x { }
| ^ patterns `None` and `Some(_)` not covered
|
- ::: $SRC_DIR/core/src/option.rs:LL:COL
+note: `Option` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
|
-LL | None,
- | ---- not covered
-...
-LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
- | ---- not covered
- |
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+LL | / pub enum Option {
+LL | | /// No value.
+LL | | #[lang = "None"]
+LL | | #[stable(feature = "rust1", since = "1.0.0")]
+LL | | None,
+ | | ^^^^ not covered
+... |
+LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
+ | | ^^^^ not covered
+LL | | }
+ | |_-
= note: the matched value is of type `Option`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match x {
+LL + None | Some(_) => todo!(),
+LL ~ }
+ |
error: aborting due to previous error
diff --git a/src/test/ui/error-codes/E0004.stderr b/src/test/ui/error-codes/E0004.stderr
index 5bf375a64843a..98cc08adf7f78 100644
--- a/src/test/ui/error-codes/E0004.stderr
+++ b/src/test/ui/error-codes/E0004.stderr
@@ -1,18 +1,22 @@
error[E0004]: non-exhaustive patterns: `HastaLaVistaBaby` not covered
--> $DIR/E0004.rs:9:11
|
-LL | / enum Terminator {
-LL | | HastaLaVistaBaby,
- | | ---------------- not covered
-LL | | TalkToMyHand,
-LL | | }
- | |_- `Terminator` defined here
-...
-LL | match x {
- | ^ pattern `HastaLaVistaBaby` not covered
+LL | match x {
+ | ^ pattern `HastaLaVistaBaby` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `Terminator` defined here
+ --> $DIR/E0004.rs:2:5
+ |
+LL | enum Terminator {
+ | ----------
+LL | HastaLaVistaBaby,
+ | ^^^^^^^^^^^^^^^^ not covered
= note: the matched value is of type `Terminator`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ Terminator::TalkToMyHand => {}
+LL + HastaLaVistaBaby => todo!()
+ |
error: aborting due to previous error
diff --git a/src/test/ui/error-codes/E0005.stderr b/src/test/ui/error-codes/E0005.stderr
index b95dcbd8935b3..208c625a53e95 100644
--- a/src/test/ui/error-codes/E0005.stderr
+++ b/src/test/ui/error-codes/E0005.stderr
@@ -4,13 +4,21 @@ error[E0005]: refutable pattern in local binding: `None` not covered
LL | let Some(y) = x;
| ^^^^^^^ pattern `None` not covered
|
- ::: $SRC_DIR/core/src/option.rs:LL:COL
- |
-LL | None,
- | ---- not covered
- |
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
+note: `Option` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ |
+LL | / pub enum Option {
+LL | | /// No value.
+LL | | #[lang = "None"]
+LL | | #[stable(feature = "rust1", since = "1.0.0")]
+LL | | None,
+ | | ^^^^ not covered
+... |
+LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
+LL | | }
+ | |_-
= note: the matched value is of type `Option`
help: you might want to use `if let` to ignore the variant that isn't matched
|
diff --git a/src/test/ui/error-codes/E0297.stderr b/src/test/ui/error-codes/E0297.stderr
index 957e79a9f3981..95d95003c616f 100644
--- a/src/test/ui/error-codes/E0297.stderr
+++ b/src/test/ui/error-codes/E0297.stderr
@@ -4,11 +4,19 @@ error[E0005]: refutable pattern in `for` loop binding: `None` not covered
LL | for Some(x) in xs {}
| ^^^^^^^ pattern `None` not covered
|
- ::: $SRC_DIR/core/src/option.rs:LL:COL
- |
-LL | None,
- | ---- not covered
+note: `Option` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
|
+LL | / pub enum Option {
+LL | | /// No value.
+LL | | #[lang = "None"]
+LL | | #[stable(feature = "rust1", since = "1.0.0")]
+LL | | None,
+ | | ^^^^ not covered
+... |
+LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
+LL | | }
+ | |_-
= note: the matched value is of type `Option`
error: aborting due to previous error
diff --git a/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr b/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr
index 53924e24e4638..9db9cfc7ff024 100644
--- a/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr
+++ b/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr
@@ -23,8 +23,8 @@ LL | | });
note: required by a bound in `Option::::and_then`
--> $SRC_DIR/core/src/option.rs:LL:COL
|
-LL | pub fn and_then Option>(self, f: F) -> Option {
- | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::::and_then`
+LL | F: ~const FnOnce(T) -> Option,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::::and_then`
error: aborting due to 2 previous errors
diff --git a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr
index c5ffa55ebec6f..c2ffda6bb72d2 100644
--- a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr
+++ b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr
@@ -4,13 +4,20 @@ error[E0005]: refutable pattern in local binding: `Err(_)` not covered
LL | let Ok(_x) = foo();
| ^^^^^^ pattern `Err(_)` not covered
|
- ::: $SRC_DIR/core/src/result.rs:LL:COL
- |
-LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
- | --- not covered
- |
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
+note: `Result` defined here
+ --> $SRC_DIR/core/src/result.rs:LL:COL
+ |
+LL | / pub enum Result {
+LL | | /// Contains the success value
+LL | | #[lang = "Ok"]
+LL | | #[stable(feature = "rust1", since = "1.0.0")]
+... |
+LL | | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
+ | | ^^^ not covered
+LL | | }
+ | |_-
= note: the matched value is of type `Result`
help: you might want to use `if let` to ignore the variant that isn't matched
|
diff --git a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr
index 9895646fc2ba4..945afffee3733 100644
--- a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr
+++ b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr
@@ -4,10 +4,14 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match 0usize {
| ^^^^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `usize`
= note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ 0..=usize::MAX => {}
+LL + _ => todo!()
+ |
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/feature-gate-precise_pointer_size_matching.rs:10:11
@@ -15,10 +19,14 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match 0isize {
| ^^^^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `isize`
= note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ isize::MIN..=isize::MAX => {}
+LL + _ => todo!()
+ |
error: aborting due to 2 previous errors
diff --git a/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr b/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr
index 14dbca60b78f2..1cf267cf99a91 100644
--- a/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr
+++ b/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr
@@ -4,8 +4,12 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | m!(0f32, f32::NEG_INFINITY..);
| ^^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `f32`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ _ => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:17:8
@@ -13,8 +17,12 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | m!(0f32, ..f32::INFINITY);
| ^^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `f32`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ _ => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `'\u{10ffff}'` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:26:8
@@ -22,8 +30,12 @@ error[E0004]: non-exhaustive patterns: `'\u{10ffff}'` not covered
LL | m!('a', ..core::char::MAX);
| ^^^ pattern `'\u{10ffff}'` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `char`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ '\u{10ffff}' => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `'\u{10fffe}'..='\u{10ffff}'` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:27:8
@@ -31,8 +43,12 @@ error[E0004]: non-exhaustive patterns: `'\u{10fffe}'..='\u{10ffff}'` not covered
LL | m!('a', ..ALMOST_MAX);
| ^^^ pattern `'\u{10fffe}'..='\u{10ffff}'` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `char`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ '\u{10fffe}'..='\u{10ffff}' => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `'\u{0}'` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:28:8
@@ -40,8 +56,12 @@ error[E0004]: non-exhaustive patterns: `'\u{0}'` not covered
LL | m!('a', ALMOST_MIN..);
| ^^^ pattern `'\u{0}'` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `char`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ '\u{0}' => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `'\u{10ffff}'` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:29:8
@@ -49,8 +69,12 @@ error[E0004]: non-exhaustive patterns: `'\u{10ffff}'` not covered
LL | m!('a', ..=ALMOST_MAX);
| ^^^ pattern `'\u{10ffff}'` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `char`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ '\u{10ffff}' => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `'b'` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:30:8
@@ -58,8 +82,12 @@ error[E0004]: non-exhaustive patterns: `'b'` not covered
LL | m!('a', ..=VAL | VAL_2..);
| ^^^ pattern `'b'` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `char`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 'b' => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `'b'` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:31:8
@@ -67,8 +95,12 @@ error[E0004]: non-exhaustive patterns: `'b'` not covered
LL | m!('a', ..VAL_1 | VAL_2..);
| ^^^ pattern `'b'` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `char`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 'b' => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `u8::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:41:12
@@ -76,8 +108,12 @@ error[E0004]: non-exhaustive patterns: `u8::MAX` not covered
LL | m!(0, ..u8::MAX);
| ^ pattern `u8::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ u8::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `254_u8..=u8::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:42:12
@@ -85,8 +121,12 @@ error[E0004]: non-exhaustive patterns: `254_u8..=u8::MAX` not covered
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `254_u8..=u8::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 254_u8..=u8::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `0_u8` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:43:12
@@ -94,8 +134,12 @@ error[E0004]: non-exhaustive patterns: `0_u8` not covered
LL | m!(0, ALMOST_MIN..);
| ^ pattern `0_u8` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 0_u8 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `u8::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:44:12
@@ -103,8 +147,12 @@ error[E0004]: non-exhaustive patterns: `u8::MAX` not covered
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `u8::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ u8::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_u8` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:45:12
@@ -112,8 +160,12 @@ error[E0004]: non-exhaustive patterns: `43_u8` not covered
LL | m!(0, ..=VAL | VAL_2..);
| ^ pattern `43_u8` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_u8 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_u8` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:46:12
@@ -121,8 +173,12 @@ error[E0004]: non-exhaustive patterns: `43_u8` not covered
LL | m!(0, ..VAL_1 | VAL_2..);
| ^ pattern `43_u8` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_u8 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `u16::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:54:12
@@ -130,8 +186,12 @@ error[E0004]: non-exhaustive patterns: `u16::MAX` not covered
LL | m!(0, ..u16::MAX);
| ^ pattern `u16::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u16`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ u16::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `65534_u16..=u16::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:55:12
@@ -139,8 +199,12 @@ error[E0004]: non-exhaustive patterns: `65534_u16..=u16::MAX` not covered
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `65534_u16..=u16::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u16`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 65534_u16..=u16::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `0_u16` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:56:12
@@ -148,8 +212,12 @@ error[E0004]: non-exhaustive patterns: `0_u16` not covered
LL | m!(0, ALMOST_MIN..);
| ^ pattern `0_u16` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u16`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 0_u16 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `u16::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:57:12
@@ -157,8 +225,12 @@ error[E0004]: non-exhaustive patterns: `u16::MAX` not covered
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `u16::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u16`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ u16::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_u16` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:58:12
@@ -166,8 +238,12 @@ error[E0004]: non-exhaustive patterns: `43_u16` not covered
LL | m!(0, ..=VAL | VAL_2..);
| ^ pattern `43_u16` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u16`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_u16 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_u16` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:59:12
@@ -175,8 +251,12 @@ error[E0004]: non-exhaustive patterns: `43_u16` not covered
LL | m!(0, ..VAL_1 | VAL_2..);
| ^ pattern `43_u16` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u16`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_u16 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `u32::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:67:12
@@ -184,8 +264,12 @@ error[E0004]: non-exhaustive patterns: `u32::MAX` not covered
LL | m!(0, ..u32::MAX);
| ^ pattern `u32::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u32`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ u32::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `4294967294_u32..=u32::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:68:12
@@ -193,8 +277,12 @@ error[E0004]: non-exhaustive patterns: `4294967294_u32..=u32::MAX` not covered
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `4294967294_u32..=u32::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u32`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 4294967294_u32..=u32::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `0_u32` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:69:12
@@ -202,8 +290,12 @@ error[E0004]: non-exhaustive patterns: `0_u32` not covered
LL | m!(0, ALMOST_MIN..);
| ^ pattern `0_u32` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u32`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 0_u32 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `u32::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:70:12
@@ -211,8 +303,12 @@ error[E0004]: non-exhaustive patterns: `u32::MAX` not covered
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `u32::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u32`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ u32::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_u32` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:71:12
@@ -220,8 +316,12 @@ error[E0004]: non-exhaustive patterns: `43_u32` not covered
LL | m!(0, ..=VAL | VAL_2..);
| ^ pattern `43_u32` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u32`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_u32 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_u32` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:72:12
@@ -229,8 +329,12 @@ error[E0004]: non-exhaustive patterns: `43_u32` not covered
LL | m!(0, ..VAL_1 | VAL_2..);
| ^ pattern `43_u32` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u32`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_u32 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `u64::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:80:12
@@ -238,8 +342,12 @@ error[E0004]: non-exhaustive patterns: `u64::MAX` not covered
LL | m!(0, ..u64::MAX);
| ^ pattern `u64::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u64`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ u64::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `18446744073709551614_u64..=u64::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:81:12
@@ -247,8 +355,12 @@ error[E0004]: non-exhaustive patterns: `18446744073709551614_u64..=u64::MAX` not
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `18446744073709551614_u64..=u64::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u64`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 18446744073709551614_u64..=u64::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `0_u64` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:82:12
@@ -256,8 +368,12 @@ error[E0004]: non-exhaustive patterns: `0_u64` not covered
LL | m!(0, ALMOST_MIN..);
| ^ pattern `0_u64` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u64`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 0_u64 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `u64::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:83:12
@@ -265,8 +381,12 @@ error[E0004]: non-exhaustive patterns: `u64::MAX` not covered
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `u64::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u64`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ u64::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_u64` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:84:12
@@ -274,8 +394,12 @@ error[E0004]: non-exhaustive patterns: `43_u64` not covered
LL | m!(0, ..=VAL | VAL_2..);
| ^ pattern `43_u64` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u64`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_u64 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_u64` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:85:12
@@ -283,8 +407,12 @@ error[E0004]: non-exhaustive patterns: `43_u64` not covered
LL | m!(0, ..VAL_1 | VAL_2..);
| ^ pattern `43_u64` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u64`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_u64 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `u128::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:93:12
@@ -292,8 +420,12 @@ error[E0004]: non-exhaustive patterns: `u128::MAX` not covered
LL | m!(0, ..u128::MAX);
| ^ pattern `u128::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ u128::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211454_u128..=u128::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:94:12
@@ -301,8 +433,12 @@ error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211454_
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `340282366920938463463374607431768211454_u128..=u128::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 340282366920938463463374607431768211454_u128..=u128::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `0_u128` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:95:12
@@ -310,8 +446,12 @@ error[E0004]: non-exhaustive patterns: `0_u128` not covered
LL | m!(0, ALMOST_MIN..);
| ^ pattern `0_u128` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 0_u128 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `u128::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:96:12
@@ -319,8 +459,12 @@ error[E0004]: non-exhaustive patterns: `u128::MAX` not covered
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `u128::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ u128::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_u128` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:97:12
@@ -328,8 +472,12 @@ error[E0004]: non-exhaustive patterns: `43_u128` not covered
LL | m!(0, ..=VAL | VAL_2..);
| ^ pattern `43_u128` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_u128 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_u128` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:98:12
@@ -337,8 +485,12 @@ error[E0004]: non-exhaustive patterns: `43_u128` not covered
LL | m!(0, ..VAL_1 | VAL_2..);
| ^ pattern `43_u128` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_u128 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i8::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:109:12
@@ -346,8 +498,12 @@ error[E0004]: non-exhaustive patterns: `i8::MAX` not covered
LL | m!(0, ..i8::MAX);
| ^ pattern `i8::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i8::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `126_i8..=i8::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:110:12
@@ -355,8 +511,12 @@ error[E0004]: non-exhaustive patterns: `126_i8..=i8::MAX` not covered
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `126_i8..=i8::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 126_i8..=i8::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i8::MIN` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:111:12
@@ -364,8 +524,12 @@ error[E0004]: non-exhaustive patterns: `i8::MIN` not covered
LL | m!(0, ALMOST_MIN..);
| ^ pattern `i8::MIN` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i8::MIN => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i8::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:112:12
@@ -373,8 +537,12 @@ error[E0004]: non-exhaustive patterns: `i8::MAX` not covered
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `i8::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i8::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_i8` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:113:12
@@ -382,8 +550,12 @@ error[E0004]: non-exhaustive patterns: `43_i8` not covered
LL | m!(0, ..=VAL | VAL_2..);
| ^ pattern `43_i8` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_i8 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_i8` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:114:12
@@ -391,8 +563,12 @@ error[E0004]: non-exhaustive patterns: `43_i8` not covered
LL | m!(0, ..VAL_1 | VAL_2..);
| ^ pattern `43_i8` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_i8 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i16::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:122:12
@@ -400,8 +576,12 @@ error[E0004]: non-exhaustive patterns: `i16::MAX` not covered
LL | m!(0, ..i16::MAX);
| ^ pattern `i16::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i16`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i16::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `32766_i16..=i16::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:123:12
@@ -409,8 +589,12 @@ error[E0004]: non-exhaustive patterns: `32766_i16..=i16::MAX` not covered
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `32766_i16..=i16::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i16`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 32766_i16..=i16::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i16::MIN` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:124:12
@@ -418,8 +602,12 @@ error[E0004]: non-exhaustive patterns: `i16::MIN` not covered
LL | m!(0, ALMOST_MIN..);
| ^ pattern `i16::MIN` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i16`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i16::MIN => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i16::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:125:12
@@ -427,8 +615,12 @@ error[E0004]: non-exhaustive patterns: `i16::MAX` not covered
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `i16::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i16`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i16::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_i16` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:126:12
@@ -436,8 +628,12 @@ error[E0004]: non-exhaustive patterns: `43_i16` not covered
LL | m!(0, ..=VAL | VAL_2..);
| ^ pattern `43_i16` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i16`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_i16 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_i16` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:127:12
@@ -445,8 +641,12 @@ error[E0004]: non-exhaustive patterns: `43_i16` not covered
LL | m!(0, ..VAL_1 | VAL_2..);
| ^ pattern `43_i16` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i16`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_i16 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i32::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:135:12
@@ -454,8 +654,12 @@ error[E0004]: non-exhaustive patterns: `i32::MAX` not covered
LL | m!(0, ..i32::MAX);
| ^ pattern `i32::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i32`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i32::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `2147483646_i32..=i32::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:136:12
@@ -463,8 +667,12 @@ error[E0004]: non-exhaustive patterns: `2147483646_i32..=i32::MAX` not covered
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `2147483646_i32..=i32::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i32`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 2147483646_i32..=i32::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i32::MIN` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:137:12
@@ -472,8 +680,12 @@ error[E0004]: non-exhaustive patterns: `i32::MIN` not covered
LL | m!(0, ALMOST_MIN..);
| ^ pattern `i32::MIN` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i32`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i32::MIN => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i32::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:138:12
@@ -481,8 +693,12 @@ error[E0004]: non-exhaustive patterns: `i32::MAX` not covered
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `i32::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i32`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i32::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_i32` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:139:12
@@ -490,8 +706,12 @@ error[E0004]: non-exhaustive patterns: `43_i32` not covered
LL | m!(0, ..=VAL | VAL_2..);
| ^ pattern `43_i32` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i32`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_i32 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_i32` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:140:12
@@ -499,8 +719,12 @@ error[E0004]: non-exhaustive patterns: `43_i32` not covered
LL | m!(0, ..VAL_1 | VAL_2..);
| ^ pattern `43_i32` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i32`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_i32 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i64::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:148:12
@@ -508,8 +732,12 @@ error[E0004]: non-exhaustive patterns: `i64::MAX` not covered
LL | m!(0, ..i64::MAX);
| ^ pattern `i64::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i64`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i64::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `9223372036854775806_i64..=i64::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:149:12
@@ -517,8 +745,12 @@ error[E0004]: non-exhaustive patterns: `9223372036854775806_i64..=i64::MAX` not
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `9223372036854775806_i64..=i64::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i64`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 9223372036854775806_i64..=i64::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i64::MIN` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:150:12
@@ -526,8 +758,12 @@ error[E0004]: non-exhaustive patterns: `i64::MIN` not covered
LL | m!(0, ALMOST_MIN..);
| ^ pattern `i64::MIN` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i64`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i64::MIN => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i64::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:151:12
@@ -535,8 +771,12 @@ error[E0004]: non-exhaustive patterns: `i64::MAX` not covered
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `i64::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i64`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i64::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_i64` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:152:12
@@ -544,8 +784,12 @@ error[E0004]: non-exhaustive patterns: `43_i64` not covered
LL | m!(0, ..=VAL | VAL_2..);
| ^ pattern `43_i64` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i64`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_i64 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_i64` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:153:12
@@ -553,8 +797,12 @@ error[E0004]: non-exhaustive patterns: `43_i64` not covered
LL | m!(0, ..VAL_1 | VAL_2..);
| ^ pattern `43_i64` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i64`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_i64 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i128::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:161:12
@@ -562,8 +810,12 @@ error[E0004]: non-exhaustive patterns: `i128::MAX` not covered
LL | m!(0, ..i128::MAX);
| ^ pattern `i128::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i128`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i128::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `170141183460469231731687303715884105726_i128..=i128::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:162:12
@@ -571,8 +823,12 @@ error[E0004]: non-exhaustive patterns: `170141183460469231731687303715884105726_
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `170141183460469231731687303715884105726_i128..=i128::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i128`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 170141183460469231731687303715884105726_i128..=i128::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i128::MIN` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:163:12
@@ -580,8 +836,12 @@ error[E0004]: non-exhaustive patterns: `i128::MIN` not covered
LL | m!(0, ALMOST_MIN..);
| ^ pattern `i128::MIN` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i128`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i128::MIN => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i128::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:164:12
@@ -589,8 +849,12 @@ error[E0004]: non-exhaustive patterns: `i128::MAX` not covered
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `i128::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i128`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i128::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_i128` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:165:12
@@ -598,8 +862,12 @@ error[E0004]: non-exhaustive patterns: `43_i128` not covered
LL | m!(0, ..=VAL | VAL_2..);
| ^ pattern `43_i128` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i128`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_i128 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `43_i128` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:166:12
@@ -607,8 +875,12 @@ error[E0004]: non-exhaustive patterns: `43_i128` not covered
LL | m!(0, ..VAL_1 | VAL_2..);
| ^ pattern `43_i128` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i128`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 43_i128 => todo!() }
+ |
error: aborting due to 68 previous errors
diff --git a/src/test/ui/issues/issue-47706-trait.stderr b/src/test/ui/issues/issue-47706-trait.stderr
index eb0c80f8f0d1e..d596b4a69f34a 100644
--- a/src/test/ui/issues/issue-47706-trait.stderr
+++ b/src/test/ui/issues/issue-47706-trait.stderr
@@ -11,8 +11,8 @@ LL | None::<()>.map(Self::f);
note: required by a bound in `Option::::map`
--> $SRC_DIR/core/src/option.rs:LL:COL
|
-LL | pub fn map U>(self, f: F) -> Option {
- | ^^^^^^^^^^^^^^ required by this bound in `Option::::map`
+LL | F: ~const FnOnce(T) -> U,
+ | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::::map`
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-47706.stderr b/src/test/ui/issues/issue-47706.stderr
index 237b2b9e79859..0b4f84a330a54 100644
--- a/src/test/ui/issues/issue-47706.stderr
+++ b/src/test/ui/issues/issue-47706.stderr
@@ -12,8 +12,8 @@ LL | self.foo.map(Foo::new)
note: required by a bound in `Option::::map`
--> $SRC_DIR/core/src/option.rs:LL:COL
|
-LL | pub fn map U>(self, f: F) -> Option {
- | ^^^^^^^^^^^^^^ required by this bound in `Option::::map`
+LL | F: ~const FnOnce(T) -> U,
+ | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::::map`
error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
--> $DIR/issue-47706.rs:27:9
diff --git a/src/test/ui/lint/unused/unused-result.rs b/src/test/ui/lint/unused/unused-result.rs
index a65e98990dceb..e283eaa88dd13 100644
--- a/src/test/ui/lint/unused/unused-result.rs
+++ b/src/test/ui/lint/unused/unused-result.rs
@@ -31,7 +31,7 @@ fn test2() {
}
fn main() {
- foo::(); //~ ERROR: unused result
+ foo::(); //~ ERROR: unused result of type `isize`
foo::(); //~ ERROR: unused `MustUse` that must be used
foo::(); //~ ERROR: unused `MustUseMsg` that must be used
//~^ NOTE: some message
diff --git a/src/test/ui/lint/unused/unused-result.stderr b/src/test/ui/lint/unused/unused-result.stderr
index 1b1dcab3a1bc9..087e06341cdde 100644
--- a/src/test/ui/lint/unused/unused-result.stderr
+++ b/src/test/ui/lint/unused/unused-result.stderr
@@ -18,7 +18,7 @@ LL | foo::();
|
= note: some message
-error: unused result
+error: unused result of type `isize`
--> $DIR/unused-result.rs:34:5
|
LL | foo::();
diff --git a/src/test/ui/match/match_non_exhaustive.stderr b/src/test/ui/match/match_non_exhaustive.stderr
index 5debfe1c566c4..52edb5b67a879 100644
--- a/src/test/ui/match/match_non_exhaustive.stderr
+++ b/src/test/ui/match/match_non_exhaustive.stderr
@@ -1,17 +1,19 @@
error[E0004]: non-exhaustive patterns: `B` not covered
--> $DIR/match_non_exhaustive.rs:23:11
|
-LL | enum L { A, B }
- | ---------------
- | | |
- | | not covered
- | `L` defined here
-...
LL | match l { L::A => () };
| ^ pattern `B` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `L` defined here
+ --> $DIR/match_non_exhaustive.rs:10:13
+ |
+LL | enum L { A, B }
+ | - ^ not covered
= note: the matched value is of type `L`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL | match l { L::A => (), B => todo!() };
+ | ++++++++++++++
error[E0004]: non-exhaustive patterns: type `E1` is non-empty
--> $DIR/match_non_exhaustive.rs:28:11
@@ -19,8 +21,18 @@ error[E0004]: non-exhaustive patterns: type `E1` is non-empty
LL | match e1 {};
| ^^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `E1` defined here
+ --> $DIR/auxiliary/match_non_exhaustive_lib.rs:2:1
+ |
+LL | pub enum E1 {}
+ | ^^^^^^^^^^^^^^
= note: the matched value is of type `E1`, which is marked as non-exhaustive
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match e1 {
+LL + _ => todo!(),
+LL ~ };
+ |
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/match_non_exhaustive.rs:30:11
@@ -28,8 +40,16 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match e2 { E2::A => (), E2::B => () };
| ^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `E2` defined here
+ --> $DIR/auxiliary/match_non_exhaustive_lib.rs:5:1
+ |
+LL | pub enum E2 { A, B }
+ | ^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `E2`, which is marked as non-exhaustive
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL | match e2 { E2::A => (), E2::B => (), _ => todo!() };
+ | ++++++++++++++
error: aborting due to 3 previous errors
diff --git a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr
index 44f334eee9386..c99a6fd2533df 100644
--- a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr
+++ b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr
@@ -4,8 +4,12 @@ error[E0004]: non-exhaustive patterns: `(2_u8..=u8::MAX, _)` not covered
LL | match (0u8, 0u8) {
| ^^^^^^^^^^ pattern `(2_u8..=u8::MAX, _)` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(u8, u8)`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ (0 | 1, 2 | 3) => {}
+LL + (2_u8..=u8::MAX, _) => todo!()
+ |
error[E0004]: non-exhaustive patterns: `((4_u8..=u8::MAX))` not covered
--> $DIR/exhaustiveness-non-exhaustive.rs:9:11
@@ -13,8 +17,12 @@ error[E0004]: non-exhaustive patterns: `((4_u8..=u8::MAX))` not covered
LL | match ((0u8,),) {
| ^^^^^^^^^ pattern `((4_u8..=u8::MAX))` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `((u8,),)`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ ((0 | 1,) | (2 | 3,),) => {}
+LL + ((4_u8..=u8::MAX)) => todo!()
+ |
error[E0004]: non-exhaustive patterns: `(Some(2_u8..=u8::MAX))` not covered
--> $DIR/exhaustiveness-non-exhaustive.rs:13:11
@@ -22,8 +30,12 @@ error[E0004]: non-exhaustive patterns: `(Some(2_u8..=u8::MAX))` not covered
LL | match (Some(0u8),) {
| ^^^^^^^^^^^^ pattern `(Some(2_u8..=u8::MAX))` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(Option,)`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ (None | Some(0 | 1),) => {}
+LL + (Some(2_u8..=u8::MAX)) => todo!()
+ |
error: aborting due to 3 previous errors
diff --git a/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr b/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr
index 8e6964e30623d..c38e3088d2e51 100644
--- a/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr
+++ b/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr
@@ -18,8 +18,12 @@ error[E0004]: non-exhaustive patterns: `i32::MIN..=-1_i32` and `3_i32..=i32::MAX
LL | match 0 {
| ^ patterns `i32::MIN..=-1_i32` and `3_i32..=i32::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i32`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ 0 | (1 | 2) => {}
+LL + i32::MIN..=-1_i32 | 3_i32..=i32::MAX => todo!()
+ |
error: aborting due to 2 previous errors
diff --git a/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr b/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr
index 2ca774a48b66b..4b24e11881a80 100644
--- a/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr
+++ b/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr
@@ -4,23 +4,33 @@ error[E0004]: non-exhaustive patterns: type `&!` is non-empty
LL | match uninhab_ref() {
| ^^^^^^^^^^^^^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `&!`
= note: references are always considered inhabited
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match uninhab_ref() {
+LL + _ => todo!(),
+LL + }
+ |
error[E0004]: non-exhaustive patterns: type `Foo` is non-empty
--> $DIR/always-inhabited-union-ref.rs:27:11
|
-LL | / pub union Foo {
-LL | | foo: !,
-LL | | }
- | |_- `Foo` defined here
-...
-LL | match uninhab_union() {
- | ^^^^^^^^^^^^^^^
+LL | match uninhab_union() {
+ | ^^^^^^^^^^^^^^^
+ |
+note: `Foo` defined here
+ --> $DIR/always-inhabited-union-ref.rs:10:11
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+LL | pub union Foo {
+ | ^^^
= note: the matched value is of type `Foo`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match uninhab_union() {
+LL + _ => todo!(),
+LL + }
+ |
error: aborting due to 2 previous errors
diff --git a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
index 6c9539822b3dd..5a2c3c1447f41 100644
--- a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
+++ b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
@@ -4,8 +4,22 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match Foo::A {
| ^^^^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `Foo` defined here
+ --> $DIR/auxiliary/hidden.rs:1:1
+ |
+LL | / pub enum Foo {
+LL | | A,
+LL | | B,
+LL | | #[doc(hidden)]
+LL | | C,
+LL | | }
+ | |_^
= note: the matched value is of type `Foo`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ Foo::B => {}
+LL + _ => todo!()
+ |
error[E0004]: non-exhaustive patterns: `B` not covered
--> $DIR/doc-hidden-non-exhaustive.rs:14:11
@@ -13,13 +27,23 @@ error[E0004]: non-exhaustive patterns: `B` not covered
LL | match Foo::A {
| ^^^^^^ pattern `B` not covered
|
- ::: $DIR/auxiliary/hidden.rs:3:5
+note: `Foo` defined here
+ --> $DIR/auxiliary/hidden.rs:3:5
|
-LL | B,
- | - not covered
- |
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+LL | / pub enum Foo {
+LL | | A,
+LL | | B,
+ | | ^ not covered
+LL | | #[doc(hidden)]
+LL | | C,
+LL | | }
+ | |_-
= note: the matched value is of type `Foo`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ Foo::C => {}
+LL + B => todo!()
+ |
error[E0004]: non-exhaustive patterns: `B` and `_` not covered
--> $DIR/doc-hidden-non-exhaustive.rs:20:11
@@ -27,13 +51,23 @@ error[E0004]: non-exhaustive patterns: `B` and `_` not covered
LL | match Foo::A {
| ^^^^^^ patterns `B` and `_` not covered
|
- ::: $DIR/auxiliary/hidden.rs:3:5
+note: `Foo` defined here
+ --> $DIR/auxiliary/hidden.rs:3:5
|
-LL | B,
- | - not covered
- |
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+LL | / pub enum Foo {
+LL | | A,
+LL | | B,
+ | | ^ not covered
+LL | | #[doc(hidden)]
+LL | | C,
+LL | | }
+ | |_-
= note: the matched value is of type `Foo`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ Foo::A => {}
+LL + B | _ => todo!()
+ |
error[E0004]: non-exhaustive patterns: `Some(B)` and `Some(_)` not covered
--> $DIR/doc-hidden-non-exhaustive.rs:25:11
@@ -41,13 +75,24 @@ error[E0004]: non-exhaustive patterns: `Some(B)` and `Some(_)` not covered
LL | match None {
| ^^^^ patterns `Some(B)` and `Some(_)` not covered
|
- ::: $SRC_DIR/core/src/option.rs:LL:COL
+note: `Option` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
|
-LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
- | ---- not covered
- |
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+LL | / pub enum Option {
+LL | | /// No value.
+LL | | #[lang = "None"]
+LL | | #[stable(feature = "rust1", since = "1.0.0")]
+... |
+LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
+ | | ^^^^ not covered
+LL | | }
+ | |_-
= note: the matched value is of type `Option`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ Some(Foo::A) => {}
+LL + Some(B) | Some(_) => todo!()
+ |
error: aborting due to 4 previous errors
diff --git a/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr b/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr
index b99386e74020e..f8976960adc6a 100644
--- a/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr
+++ b/src/test/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr
@@ -46,107 +46,112 @@ error[E0004]: non-exhaustive patterns: type `u8` is non-empty
LL | match_no_arms!(0u8);
| ^^^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `NonEmptyStruct1` is non-empty
--> $DIR/empty-match.rs:79:20
|
-LL | struct NonEmptyStruct1;
- | ----------------------- `NonEmptyStruct1` defined here
-...
LL | match_no_arms!(NonEmptyStruct1);
| ^^^^^^^^^^^^^^^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyStruct1` defined here
+ --> $DIR/empty-match.rs:14:8
+ |
+LL | struct NonEmptyStruct1;
+ | ^^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyStruct1`
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `NonEmptyStruct2` is non-empty
--> $DIR/empty-match.rs:80:20
|
-LL | struct NonEmptyStruct2(bool);
- | ----------------------------- `NonEmptyStruct2` defined here
-...
LL | match_no_arms!(NonEmptyStruct2(true));
| ^^^^^^^^^^^^^^^^^^^^^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyStruct2` defined here
+ --> $DIR/empty-match.rs:15:8
+ |
+LL | struct NonEmptyStruct2(bool);
+ | ^^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyStruct2`
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `NonEmptyUnion1` is non-empty
--> $DIR/empty-match.rs:81:20
|
-LL | / union NonEmptyUnion1 {
-LL | | foo: (),
-LL | | }
- | |_- `NonEmptyUnion1` defined here
-...
-LL | match_no_arms!((NonEmptyUnion1 { foo: () }));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | match_no_arms!((NonEmptyUnion1 { foo: () }));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyUnion1` defined here
+ --> $DIR/empty-match.rs:16:7
+ |
+LL | union NonEmptyUnion1 {
+ | ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion1`
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `NonEmptyUnion2` is non-empty
--> $DIR/empty-match.rs:82:20
|
-LL | / union NonEmptyUnion2 {
-LL | | foo: (),
-LL | | bar: (),
-LL | | }
- | |_- `NonEmptyUnion2` defined here
-...
-LL | match_no_arms!((NonEmptyUnion2 { foo: () }));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | match_no_arms!((NonEmptyUnion2 { foo: () }));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyUnion2` defined here
+ --> $DIR/empty-match.rs:19:7
+ |
+LL | union NonEmptyUnion2 {
+ | ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion2`
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: `Foo(_)` not covered
--> $DIR/empty-match.rs:83:20
|
-LL | / enum NonEmptyEnum1 {
-LL | | Foo(bool),
- | | --- not covered
-LL | | }
- | |_- `NonEmptyEnum1` defined here
-...
-LL | match_no_arms!(NonEmptyEnum1::Foo(true));
- | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered
+LL | match_no_arms!(NonEmptyEnum1::Foo(true));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyEnum1` defined here
+ --> $DIR/empty-match.rs:24:5
+ |
+LL | enum NonEmptyEnum1 {
+ | -------------
+LL | Foo(bool),
+ | ^^^ not covered
= note: the matched value is of type `NonEmptyEnum1`
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered
--> $DIR/empty-match.rs:84:20
|
-LL | / enum NonEmptyEnum2 {
-LL | | Foo(bool),
- | | --- not covered
-LL | | Bar,
- | | --- not covered
-LL | | }
- | |_- `NonEmptyEnum2` defined here
-...
-LL | match_no_arms!(NonEmptyEnum2::Foo(true));
- | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered
+LL | match_no_arms!(NonEmptyEnum2::Foo(true));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyEnum2` defined here
+ --> $DIR/empty-match.rs:27:5
+ |
+LL | enum NonEmptyEnum2 {
+ | -------------
+LL | Foo(bool),
+ | ^^^ not covered
+LL | Bar,
+ | ^^^ not covered
= note: the matched value is of type `NonEmptyEnum2`
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered
--> $DIR/empty-match.rs:85:20
|
-LL | / enum NonEmptyEnum5 {
-LL | | V1, V2, V3, V4, V5,
-LL | | }
- | |_- `NonEmptyEnum5` defined here
-...
-LL | match_no_arms!(NonEmptyEnum5::V1);
- | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered
+LL | match_no_arms!(NonEmptyEnum5::V1);
+ | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyEnum5` defined here
+ --> $DIR/empty-match.rs:30:6
+ |
+LL | enum NonEmptyEnum5 {
+ | ^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyEnum5`
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/empty-match.rs:87:24
@@ -154,107 +159,144 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match_guarded_arm!(0u8);
| ^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ _ if false => {}
+LL + _ => todo!()
+ |
error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered
--> $DIR/empty-match.rs:88:24
|
-LL | struct NonEmptyStruct1;
- | ----------------------- `NonEmptyStruct1` defined here
-...
LL | match_guarded_arm!(NonEmptyStruct1);
| ^^^^^^^^^^^^^^^ pattern `NonEmptyStruct1` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyStruct1` defined here
+ --> $DIR/empty-match.rs:14:8
+ |
+LL | struct NonEmptyStruct1;
+ | ^^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyStruct1`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ _ if false => {}
+LL + NonEmptyStruct1 => todo!()
+ |
error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered
--> $DIR/empty-match.rs:89:24
|
-LL | struct NonEmptyStruct2(bool);
- | ----------------------------- `NonEmptyStruct2` defined here
-...
LL | match_guarded_arm!(NonEmptyStruct2(true));
| ^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct2(_)` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyStruct2` defined here
+ --> $DIR/empty-match.rs:15:8
+ |
+LL | struct NonEmptyStruct2(bool);
+ | ^^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyStruct2`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ _ if false => {}
+LL + NonEmptyStruct2(_) => todo!()
+ |
error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered
--> $DIR/empty-match.rs:90:24
|
-LL | / union NonEmptyUnion1 {
-LL | | foo: (),
-LL | | }
- | |_- `NonEmptyUnion1` defined here
-...
-LL | match_guarded_arm!((NonEmptyUnion1 { foo: () }));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered
+LL | match_guarded_arm!((NonEmptyUnion1 { foo: () }));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyUnion1` defined here
+ --> $DIR/empty-match.rs:16:7
+ |
+LL | union NonEmptyUnion1 {
+ | ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion1`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ _ if false => {}
+LL + NonEmptyUnion1 { .. } => todo!()
+ |
error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered
--> $DIR/empty-match.rs:91:24
|
-LL | / union NonEmptyUnion2 {
-LL | | foo: (),
-LL | | bar: (),
-LL | | }
- | |_- `NonEmptyUnion2` defined here
-...
-LL | match_guarded_arm!((NonEmptyUnion2 { foo: () }));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered
+LL | match_guarded_arm!((NonEmptyUnion2 { foo: () }));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyUnion2` defined here
+ --> $DIR/empty-match.rs:19:7
+ |
+LL | union NonEmptyUnion2 {
+ | ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion2`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ _ if false => {}
+LL + NonEmptyUnion2 { .. } => todo!()
+ |
error[E0004]: non-exhaustive patterns: `Foo(_)` not covered
--> $DIR/empty-match.rs:92:24
|
-LL | / enum NonEmptyEnum1 {
-LL | | Foo(bool),
- | | --- not covered
-LL | | }
- | |_- `NonEmptyEnum1` defined here
-...
-LL | match_guarded_arm!(NonEmptyEnum1::Foo(true));
- | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered
+LL | match_guarded_arm!(NonEmptyEnum1::Foo(true));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyEnum1` defined here
+ --> $DIR/empty-match.rs:24:5
+ |
+LL | enum NonEmptyEnum1 {
+ | -------------
+LL | Foo(bool),
+ | ^^^ not covered
= note: the matched value is of type `NonEmptyEnum1`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ _ if false => {}
+LL + Foo(_) => todo!()
+ |
error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered
--> $DIR/empty-match.rs:93:24
|
-LL | / enum NonEmptyEnum2 {
-LL | | Foo(bool),
- | | --- not covered
-LL | | Bar,
- | | --- not covered
-LL | | }
- | |_- `NonEmptyEnum2` defined here
-...
-LL | match_guarded_arm!(NonEmptyEnum2::Foo(true));
- | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered
+LL | match_guarded_arm!(NonEmptyEnum2::Foo(true));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyEnum2` defined here
+ --> $DIR/empty-match.rs:27:5
+ |
+LL | enum NonEmptyEnum2 {
+ | -------------
+LL | Foo(bool),
+ | ^^^ not covered
+LL | Bar,
+ | ^^^ not covered
= note: the matched value is of type `NonEmptyEnum2`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ _ if false => {}
+LL + Foo(_) | Bar => todo!()
+ |
error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered
--> $DIR/empty-match.rs:94:24
|
-LL | / enum NonEmptyEnum5 {
-LL | | V1, V2, V3, V4, V5,
-LL | | }
- | |_- `NonEmptyEnum5` defined here
-...
-LL | match_guarded_arm!(NonEmptyEnum5::V1);
- | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered
+LL | match_guarded_arm!(NonEmptyEnum5::V1);
+ | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyEnum5` defined here
+ --> $DIR/empty-match.rs:30:6
+ |
+LL | enum NonEmptyEnum5 {
+ | ^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyEnum5`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ _ if false => {}
+LL + _ => todo!()
+ |
error: aborting due to 22 previous errors
diff --git a/src/test/ui/pattern/usefulness/empty-match.normal.stderr b/src/test/ui/pattern/usefulness/empty-match.normal.stderr
index b99386e74020e..f8976960adc6a 100644
--- a/src/test/ui/pattern/usefulness/empty-match.normal.stderr
+++ b/src/test/ui/pattern/usefulness/empty-match.normal.stderr
@@ -46,107 +46,112 @@ error[E0004]: non-exhaustive patterns: type `u8` is non-empty
LL | match_no_arms!(0u8);
| ^^^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `NonEmptyStruct1` is non-empty
--> $DIR/empty-match.rs:79:20
|
-LL | struct NonEmptyStruct1;
- | ----------------------- `NonEmptyStruct1` defined here
-...
LL | match_no_arms!(NonEmptyStruct1);
| ^^^^^^^^^^^^^^^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyStruct1` defined here
+ --> $DIR/empty-match.rs:14:8
+ |
+LL | struct NonEmptyStruct1;
+ | ^^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyStruct1`
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `NonEmptyStruct2` is non-empty
--> $DIR/empty-match.rs:80:20
|
-LL | struct NonEmptyStruct2(bool);
- | ----------------------------- `NonEmptyStruct2` defined here
-...
LL | match_no_arms!(NonEmptyStruct2(true));
| ^^^^^^^^^^^^^^^^^^^^^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyStruct2` defined here
+ --> $DIR/empty-match.rs:15:8
+ |
+LL | struct NonEmptyStruct2(bool);
+ | ^^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyStruct2`
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `NonEmptyUnion1` is non-empty
--> $DIR/empty-match.rs:81:20
|
-LL | / union NonEmptyUnion1 {
-LL | | foo: (),
-LL | | }
- | |_- `NonEmptyUnion1` defined here
-...
-LL | match_no_arms!((NonEmptyUnion1 { foo: () }));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | match_no_arms!((NonEmptyUnion1 { foo: () }));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyUnion1` defined here
+ --> $DIR/empty-match.rs:16:7
+ |
+LL | union NonEmptyUnion1 {
+ | ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion1`
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: type `NonEmptyUnion2` is non-empty
--> $DIR/empty-match.rs:82:20
|
-LL | / union NonEmptyUnion2 {
-LL | | foo: (),
-LL | | bar: (),
-LL | | }
- | |_- `NonEmptyUnion2` defined here
-...
-LL | match_no_arms!((NonEmptyUnion2 { foo: () }));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | match_no_arms!((NonEmptyUnion2 { foo: () }));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyUnion2` defined here
+ --> $DIR/empty-match.rs:19:7
+ |
+LL | union NonEmptyUnion2 {
+ | ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion2`
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: `Foo(_)` not covered
--> $DIR/empty-match.rs:83:20
|
-LL | / enum NonEmptyEnum1 {
-LL | | Foo(bool),
- | | --- not covered
-LL | | }
- | |_- `NonEmptyEnum1` defined here
-...
-LL | match_no_arms!(NonEmptyEnum1::Foo(true));
- | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered
+LL | match_no_arms!(NonEmptyEnum1::Foo(true));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyEnum1` defined here
+ --> $DIR/empty-match.rs:24:5
+ |
+LL | enum NonEmptyEnum1 {
+ | -------------
+LL | Foo(bool),
+ | ^^^ not covered
= note: the matched value is of type `NonEmptyEnum1`
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered
--> $DIR/empty-match.rs:84:20
|
-LL | / enum NonEmptyEnum2 {
-LL | | Foo(bool),
- | | --- not covered
-LL | | Bar,
- | | --- not covered
-LL | | }
- | |_- `NonEmptyEnum2` defined here
-...
-LL | match_no_arms!(NonEmptyEnum2::Foo(true));
- | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered
+LL | match_no_arms!(NonEmptyEnum2::Foo(true));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyEnum2` defined here
+ --> $DIR/empty-match.rs:27:5
+ |
+LL | enum NonEmptyEnum2 {
+ | -------------
+LL | Foo(bool),
+ | ^^^ not covered
+LL | Bar,
+ | ^^^ not covered
= note: the matched value is of type `NonEmptyEnum2`
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered
--> $DIR/empty-match.rs:85:20
|
-LL | / enum NonEmptyEnum5 {
-LL | | V1, V2, V3, V4, V5,
-LL | | }
- | |_- `NonEmptyEnum5` defined here
-...
-LL | match_no_arms!(NonEmptyEnum5::V1);
- | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered
+LL | match_no_arms!(NonEmptyEnum5::V1);
+ | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyEnum5` defined here
+ --> $DIR/empty-match.rs:30:6
+ |
+LL | enum NonEmptyEnum5 {
+ | ^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyEnum5`
+ = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/empty-match.rs:87:24
@@ -154,107 +159,144 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match_guarded_arm!(0u8);
| ^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ _ if false => {}
+LL + _ => todo!()
+ |
error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered
--> $DIR/empty-match.rs:88:24
|
-LL | struct NonEmptyStruct1;
- | ----------------------- `NonEmptyStruct1` defined here
-...
LL | match_guarded_arm!(NonEmptyStruct1);
| ^^^^^^^^^^^^^^^ pattern `NonEmptyStruct1` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyStruct1` defined here
+ --> $DIR/empty-match.rs:14:8
+ |
+LL | struct NonEmptyStruct1;
+ | ^^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyStruct1`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ _ if false => {}
+LL + NonEmptyStruct1 => todo!()
+ |
error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered
--> $DIR/empty-match.rs:89:24
|
-LL | struct NonEmptyStruct2(bool);
- | ----------------------------- `NonEmptyStruct2` defined here
-...
LL | match_guarded_arm!(NonEmptyStruct2(true));
| ^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct2(_)` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyStruct2` defined here
+ --> $DIR/empty-match.rs:15:8
+ |
+LL | struct NonEmptyStruct2(bool);
+ | ^^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyStruct2`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ _ if false => {}
+LL + NonEmptyStruct2(_) => todo!()
+ |
error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered
--> $DIR/empty-match.rs:90:24
|
-LL | / union NonEmptyUnion1 {
-LL | | foo: (),
-LL | | }
- | |_- `NonEmptyUnion1` defined here
-...
-LL | match_guarded_arm!((NonEmptyUnion1 { foo: () }));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered
+LL | match_guarded_arm!((NonEmptyUnion1 { foo: () }));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyUnion1` defined here
+ --> $DIR/empty-match.rs:16:7
+ |
+LL | union NonEmptyUnion1 {
+ | ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion1`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ _ if false => {}
+LL + NonEmptyUnion1 { .. } => todo!()
+ |
error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered
--> $DIR/empty-match.rs:91:24
|
-LL | / union NonEmptyUnion2 {
-LL | | foo: (),
-LL | | bar: (),
-LL | | }
- | |_- `NonEmptyUnion2` defined here
-...
-LL | match_guarded_arm!((NonEmptyUnion2 { foo: () }));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered
+LL | match_guarded_arm!((NonEmptyUnion2 { foo: () }));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyUnion2` defined here
+ --> $DIR/empty-match.rs:19:7
+ |
+LL | union NonEmptyUnion2 {
+ | ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion2`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ _ if false => {}
+LL + NonEmptyUnion2 { .. } => todo!()
+ |
error[E0004]: non-exhaustive patterns: `Foo(_)` not covered
--> $DIR/empty-match.rs:92:24
|
-LL | / enum NonEmptyEnum1 {
-LL | | Foo(bool),
- | | --- not covered
-LL | | }
- | |_- `NonEmptyEnum1` defined here
-...
-LL | match_guarded_arm!(NonEmptyEnum1::Foo(true));
- | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered
+LL | match_guarded_arm!(NonEmptyEnum1::Foo(true));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyEnum1` defined here
+ --> $DIR/empty-match.rs:24:5
+ |
+LL | enum NonEmptyEnum1 {
+ | -------------
+LL | Foo(bool),
+ | ^^^ not covered
= note: the matched value is of type `NonEmptyEnum1`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ _ if false => {}
+LL + Foo(_) => todo!()
+ |
error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered
--> $DIR/empty-match.rs:93:24
|
-LL | / enum NonEmptyEnum2 {
-LL | | Foo(bool),
- | | --- not covered
-LL | | Bar,
- | | --- not covered
-LL | | }
- | |_- `NonEmptyEnum2` defined here
-...
-LL | match_guarded_arm!(NonEmptyEnum2::Foo(true));
- | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered
+LL | match_guarded_arm!(NonEmptyEnum2::Foo(true));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyEnum2` defined here
+ --> $DIR/empty-match.rs:27:5
+ |
+LL | enum NonEmptyEnum2 {
+ | -------------
+LL | Foo(bool),
+ | ^^^ not covered
+LL | Bar,
+ | ^^^ not covered
= note: the matched value is of type `NonEmptyEnum2`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ _ if false => {}
+LL + Foo(_) | Bar => todo!()
+ |
error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered
--> $DIR/empty-match.rs:94:24
|
-LL | / enum NonEmptyEnum5 {
-LL | | V1, V2, V3, V4, V5,
-LL | | }
- | |_- `NonEmptyEnum5` defined here
-...
-LL | match_guarded_arm!(NonEmptyEnum5::V1);
- | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered
+LL | match_guarded_arm!(NonEmptyEnum5::V1);
+ | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `NonEmptyEnum5` defined here
+ --> $DIR/empty-match.rs:30:6
+ |
+LL | enum NonEmptyEnum5 {
+ | ^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyEnum5`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ _ if false => {}
+LL + _ => todo!()
+ |
error: aborting due to 22 previous errors
diff --git a/src/test/ui/pattern/usefulness/floats.stderr b/src/test/ui/pattern/usefulness/floats.stderr
index 464bfbdb2c3b2..bbeac5959f059 100644
--- a/src/test/ui/pattern/usefulness/floats.stderr
+++ b/src/test/ui/pattern/usefulness/floats.stderr
@@ -4,8 +4,12 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match 0.0 {
| ^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `f64`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ 0.0..=1.0 => {}
+LL + _ => todo!()
+ |
error: unreachable pattern
--> $DIR/floats.rs:16:7
diff --git a/src/test/ui/pattern/usefulness/guards.stderr b/src/test/ui/pattern/usefulness/guards.stderr
index 61f7facb330da..4a3b12d58facf 100644
--- a/src/test/ui/pattern/usefulness/guards.stderr
+++ b/src/test/ui/pattern/usefulness/guards.stderr
@@ -4,8 +4,12 @@ error[E0004]: non-exhaustive patterns: `128_u8..=u8::MAX` not covered
LL | match 0u8 {
| ^^^ pattern `128_u8..=u8::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ 128 ..= 255 if true => {}
+LL + 128_u8..=u8::MAX => todo!()
+ |
error: aborting due to previous error
diff --git a/src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr b/src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr
index b1440375494b1..f946c55bff564 100644
--- a/src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr
+++ b/src/test/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr
@@ -4,8 +4,12 @@ error[E0004]: non-exhaustive patterns: `u8::MAX` not covered
LL | m!(0u8, 0..255);
| ^^^ pattern `u8::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ u8::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `u8::MAX` not covered
--> $DIR/exhaustiveness.rs:49:8
@@ -13,8 +17,12 @@ error[E0004]: non-exhaustive patterns: `u8::MAX` not covered
LL | m!(0u8, 0..=254);
| ^^^ pattern `u8::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ u8::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `0_u8` not covered
--> $DIR/exhaustiveness.rs:50:8
@@ -22,8 +30,12 @@ error[E0004]: non-exhaustive patterns: `0_u8` not covered
LL | m!(0u8, 1..=255);
| ^^^ pattern `0_u8` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 0_u8 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `42_u8` not covered
--> $DIR/exhaustiveness.rs:51:8
@@ -31,8 +43,12 @@ error[E0004]: non-exhaustive patterns: `42_u8` not covered
LL | m!(0u8, 0..42 | 43..=255);
| ^^^ pattern `42_u8` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 42_u8 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i8::MAX` not covered
--> $DIR/exhaustiveness.rs:52:8
@@ -40,8 +56,12 @@ error[E0004]: non-exhaustive patterns: `i8::MAX` not covered
LL | m!(0i8, -128..127);
| ^^^ pattern `i8::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i8::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i8::MAX` not covered
--> $DIR/exhaustiveness.rs:53:8
@@ -49,8 +69,12 @@ error[E0004]: non-exhaustive patterns: `i8::MAX` not covered
LL | m!(0i8, -128..=126);
| ^^^ pattern `i8::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i8::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `i8::MIN` not covered
--> $DIR/exhaustiveness.rs:54:8
@@ -58,8 +82,12 @@ error[E0004]: non-exhaustive patterns: `i8::MIN` not covered
LL | m!(0i8, -127..=127);
| ^^^ pattern `i8::MIN` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ i8::MIN => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `0_i8` not covered
--> $DIR/exhaustiveness.rs:55:11
@@ -67,8 +95,12 @@ error[E0004]: non-exhaustive patterns: `0_i8` not covered
LL | match 0i8 {
| ^^^ pattern `0_i8` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ 1 ..= i8::MAX => {}
+LL + 0_i8 => todo!()
+ |
error[E0004]: non-exhaustive patterns: `u128::MAX` not covered
--> $DIR/exhaustiveness.rs:60:8
@@ -76,8 +108,12 @@ error[E0004]: non-exhaustive patterns: `u128::MAX` not covered
LL | m!(0u128, 0..=ALMOST_MAX);
| ^^^^^ pattern `u128::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ u128::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `5_u128..=u128::MAX` not covered
--> $DIR/exhaustiveness.rs:61:8
@@ -85,8 +121,12 @@ error[E0004]: non-exhaustive patterns: `5_u128..=u128::MAX` not covered
LL | m!(0u128, 0..=4);
| ^^^^^ pattern `5_u128..=u128::MAX` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 5_u128..=u128::MAX => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `0_u128` not covered
--> $DIR/exhaustiveness.rs:62:8
@@ -94,8 +134,12 @@ error[E0004]: non-exhaustive patterns: `0_u128` not covered
LL | m!(0u128, 1..=u128::MAX);
| ^^^^^ pattern `0_u128` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ 0_u128 => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `(126_u8..=127_u8, false)` not covered
--> $DIR/exhaustiveness.rs:70:11
@@ -103,8 +147,12 @@ error[E0004]: non-exhaustive patterns: `(126_u8..=127_u8, false)` not covered
LL | match (0u8, true) {
| ^^^^^^^^^^^ pattern `(126_u8..=127_u8, false)` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(u8, bool)`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ (0 ..= 255, true) => {}
+LL + (126_u8..=127_u8, false) => todo!()
+ |
error: aborting due to 12 previous errors
diff --git a/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr b/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr
index 2563293458379..23aed9d1cd66f 100644
--- a/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr
+++ b/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr
@@ -4,8 +4,13 @@ error[E0004]: non-exhaustive patterns: type `usize` is non-empty
LL | match 7usize {}
| ^^^^^^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `usize`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match 7usize {
+LL + _ => todo!(),
+LL + }
+ |
error: aborting due to previous error
diff --git a/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr b/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr
index e8ac9f3cfe156..11a3bf5b1778b 100644
--- a/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr
+++ b/src/test/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr
@@ -4,10 +4,14 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match 0usize {
| ^^^^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `usize`
= note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ 0 ..= usize::MAX => {}
+LL + _ => todo!()
+ |
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/pointer-sized-int.rs:17:11
@@ -15,10 +19,14 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match 0isize {
| ^^^^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `isize`
= note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ isize::MIN ..= isize::MAX => {}
+LL + _ => todo!()
+ |
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/pointer-sized-int.rs:22:8
@@ -26,10 +34,14 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | m!(0usize, 0..=usize::MAX);
| ^^^^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `usize`
= note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ _ => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/pointer-sized-int.rs:24:8
@@ -37,10 +49,14 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | m!(0usize, 0..5 | 5..=usize::MAX);
| ^^^^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `usize`
= note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ _ => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/pointer-sized-int.rs:26:8
@@ -48,10 +64,14 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | m!(0usize, 0..usize::MAX | usize::MAX);
| ^^^^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `usize`
= note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ _ => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `(_, _)` not covered
--> $DIR/pointer-sized-int.rs:28:8
@@ -59,8 +79,12 @@ error[E0004]: non-exhaustive patterns: `(_, _)` not covered
LL | m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize::MAX, false));
| ^^^^^^^^^^^^^^ pattern `(_, _)` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(usize, bool)`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ (_, _) => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/pointer-sized-int.rs:31:8
@@ -68,10 +92,14 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | m!(0isize, isize::MIN..=isize::MAX);
| ^^^^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `isize`
= note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ _ => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/pointer-sized-int.rs:33:8
@@ -79,10 +107,14 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | m!(0isize, isize::MIN..5 | 5..=isize::MAX);
| ^^^^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `isize`
= note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ _ => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/pointer-sized-int.rs:35:8
@@ -90,10 +122,14 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | m!(0isize, isize::MIN..isize::MAX | isize::MAX);
| ^^^^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `isize`
= note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ _ => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `(_, _)` not covered
--> $DIR/pointer-sized-int.rs:37:8
@@ -101,8 +137,12 @@ error[E0004]: non-exhaustive patterns: `(_, _)` not covered
LL | m!((0isize, true), (isize::MIN..5, true)
| ^^^^^^^^^^^^^^ pattern `(_, _)` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(isize, bool)`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match $s { $($t)+ => {}
+LL ~ (_, _) => todo!() }
+ |
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/pointer-sized-int.rs:41:11
@@ -110,10 +150,14 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match 0isize {
| ^^^^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `isize`
= note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ 1 ..= isize::MAX => {}
+LL + _ => todo!()
+ |
error[E0004]: non-exhaustive patterns: type `usize` is non-empty
--> $DIR/pointer-sized-int.rs:48:11
@@ -121,8 +165,13 @@ error[E0004]: non-exhaustive patterns: type `usize` is non-empty
LL | match 7usize {}
| ^^^^^^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `usize`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match 7usize {
+LL + _ => todo!(),
+LL + }
+ |
error: aborting due to 12 previous errors
diff --git a/src/test/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr b/src/test/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr
index 37e73a68f22bb..efef39c636f33 100644
--- a/src/test/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr
+++ b/src/test/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr
@@ -4,10 +4,14 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match 0usize {
| ^^^^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `usize`
= note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ 0..=usize::MAX => {}
+LL + _ => todo!()
+ |
error[E0004]: non-exhaustive patterns: `_` not covered
--> $DIR/precise_pointer_matching-message.rs:11:11
@@ -15,10 +19,14 @@ error[E0004]: non-exhaustive patterns: `_` not covered
LL | match 0isize {
| ^^^^^^ pattern `_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `isize`
= note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ isize::MIN..=isize::MAX => {}
+LL + _ => todo!()
+ |
error: aborting due to 2 previous errors
diff --git a/src/test/ui/pattern/usefulness/issue-15129.stderr b/src/test/ui/pattern/usefulness/issue-15129.stderr
index 79a77240937ac..5ee2f6825ff6f 100644
--- a/src/test/ui/pattern/usefulness/issue-15129.stderr
+++ b/src/test/ui/pattern/usefulness/issue-15129.stderr
@@ -4,8 +4,12 @@ error[E0004]: non-exhaustive patterns: `(T1(()), V2(_))` and `(T2(()), V1(_))` n
LL | match (T::T1(()), V::V2(true)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `(T1(()), V2(_))` and `(T2(()), V1(_))` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(T, V)`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ (T::T2(()), V::V2(b)) => (),
+LL ~ (T1(()), V2(_)) | (T2(()), V1(_)) => todo!(),
+ |
error: aborting due to previous error
diff --git a/src/test/ui/pattern/usefulness/issue-2111.stderr b/src/test/ui/pattern/usefulness/issue-2111.stderr
index 60d9b8514b7fb..ae02d7f7dfca3 100644
--- a/src/test/ui/pattern/usefulness/issue-2111.stderr
+++ b/src/test/ui/pattern/usefulness/issue-2111.stderr
@@ -4,8 +4,12 @@ error[E0004]: non-exhaustive patterns: `(None, None)` and `(Some(_), Some(_))` n
LL | match (a, b) {
| ^^^^^^ patterns `(None, None)` and `(Some(_), Some(_))` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(Option, Option)`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ (Some(_), None) | (None, Some(_)) => {}
+LL + (None, None) | (Some(_), Some(_)) => todo!()
+ |
error: aborting due to previous error
diff --git a/src/test/ui/pattern/usefulness/issue-30240.stderr b/src/test/ui/pattern/usefulness/issue-30240.stderr
index a2c58d6e051b5..1c25355b9c452 100644
--- a/src/test/ui/pattern/usefulness/issue-30240.stderr
+++ b/src/test/ui/pattern/usefulness/issue-30240.stderr
@@ -4,8 +4,12 @@ error[E0004]: non-exhaustive patterns: `&_` not covered
LL | match "world" {
| ^^^^^^^ pattern `&_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `&str`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ "hello" => {}
+LL + &_ => todo!()
+ |
error[E0004]: non-exhaustive patterns: `&_` not covered
--> $DIR/issue-30240.rs:6:11
@@ -13,8 +17,12 @@ error[E0004]: non-exhaustive patterns: `&_` not covered
LL | match "world" {
| ^^^^^^^ pattern `&_` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `&str`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ "hello" => {}
+LL + &_ => todo!()
+ |
error: aborting due to 2 previous errors
diff --git a/src/test/ui/pattern/usefulness/issue-3096-1.stderr b/src/test/ui/pattern/usefulness/issue-3096-1.stderr
index 97c34755189de..0d59b8db46715 100644
--- a/src/test/ui/pattern/usefulness/issue-3096-1.stderr
+++ b/src/test/ui/pattern/usefulness/issue-3096-1.stderr
@@ -4,8 +4,13 @@ error[E0004]: non-exhaustive patterns: type `()` is non-empty
LL | match () { }
| ^^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `()`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match () {
+LL + _ => todo!(),
+LL ~ }
+ |
error: aborting due to previous error
diff --git a/src/test/ui/pattern/usefulness/issue-3096-2.stderr b/src/test/ui/pattern/usefulness/issue-3096-2.stderr
index 472d1a91e6a15..e0a769bc027f4 100644
--- a/src/test/ui/pattern/usefulness/issue-3096-2.stderr
+++ b/src/test/ui/pattern/usefulness/issue-3096-2.stderr
@@ -4,8 +4,13 @@ error[E0004]: non-exhaustive patterns: type `*const Bottom` is non-empty
LL | match x { }
| ^
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `*const Bottom`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ match x {
+LL + _ => todo!(),
+LL ~ }
+ |
error: aborting due to previous error
diff --git a/src/test/ui/pattern/usefulness/issue-31561.stderr b/src/test/ui/pattern/usefulness/issue-31561.stderr
index 2f562b23692de..dffcfc016072f 100644
--- a/src/test/ui/pattern/usefulness/issue-31561.stderr
+++ b/src/test/ui/pattern/usefulness/issue-31561.stderr
@@ -1,20 +1,21 @@
error[E0005]: refutable pattern in local binding: `Bar` and `Baz` not covered
--> $DIR/issue-31561.rs:8:9
|
-LL | / enum Thing {
-LL | | Foo(u8),
-LL | | Bar,
- | | --- not covered
-LL | | Baz
- | | --- not covered
-LL | | }
- | |_- `Thing` defined here
-...
-LL | let Thing::Foo(y) = Thing::Foo(1);
- | ^^^^^^^^^^^^^ patterns `Bar` and `Baz` not covered
+LL | let Thing::Foo(y) = Thing::Foo(1);
+ | ^^^^^^^^^^^^^ patterns `Bar` and `Baz` not covered
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
+note: `Thing` defined here
+ --> $DIR/issue-31561.rs:3:5
+ |
+LL | enum Thing {
+ | -----
+LL | Foo(u8),
+LL | Bar,
+ | ^^^ not covered
+LL | Baz
+ | ^^^ not covered
= note: the matched value is of type `Thing`
help: you might want to use `if let` to ignore the variant that isn't matched
|
diff --git a/src/test/ui/pattern/usefulness/issue-35609.stderr b/src/test/ui/pattern/usefulness/issue-35609.stderr
index 0598c8d6f38c5..e5248ab985d62 100644
--- a/src/test/ui/pattern/usefulness/issue-35609.stderr
+++ b/src/test/ui/pattern/usefulness/issue-35609.stderr
@@ -4,8 +4,12 @@ error[E0004]: non-exhaustive patterns: `(B, _)`, `(C, _)`, `(D, _)` and 2 more n
LL | match (A, ()) {
| ^^^^^^^ patterns `(B, _)`, `(C, _)`, `(D, _)` and 2 more not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(Enum, ())`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ (A, _) => {}
+LL + _ => todo!()
+ |
error[E0004]: non-exhaustive patterns: `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered
--> $DIR/issue-35609.rs:14:11
@@ -13,8 +17,12 @@ error[E0004]: non-exhaustive patterns: `(_, B)`, `(_, C)`, `(_, D)` and 2 more n
LL | match (A, A) {
| ^^^^^^ patterns `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(Enum, Enum)`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ (_, A) => {}
+LL + _ => todo!()
+ |
error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered
--> $DIR/issue-35609.rs:18:11
@@ -22,8 +30,12 @@ error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _
LL | match ((A, ()), ()) {
| ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `((Enum, ()), ())`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ ((A, ()), _) => {}
+LL + _ => todo!()
+ |
error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered
--> $DIR/issue-35609.rs:22:11
@@ -31,8 +43,12 @@ error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _
LL | match ((A, ()), A) {
| ^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `((Enum, ()), Enum)`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ ((A, ()), _) => {}
+LL + _ => todo!()
+ |
error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered
--> $DIR/issue-35609.rs:26:11
@@ -40,32 +56,48 @@ error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _
LL | match ((A, ()), ()) {
| ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `((Enum, ()), ())`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ ((A, _), _) => {}
+LL + _ => todo!()
+ |
error[E0004]: non-exhaustive patterns: `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered
--> $DIR/issue-35609.rs:31:11
|
-LL | struct S(Enum, ());
- | ------------------- `S` defined here
-...
LL | match S(A, ()) {
| ^^^^^^^^ patterns `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `S` defined here
+ --> $DIR/issue-35609.rs:6:8
+ |
+LL | struct S(Enum, ());
+ | ^
= note: the matched value is of type `S`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ S(A, _) => {}
+LL + _ => todo!()
+ |
error[E0004]: non-exhaustive patterns: `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered
--> $DIR/issue-35609.rs:35:11
|
-LL | struct Sd { x: Enum, y: () }
- | ---------------------------- `Sd` defined here
-...
LL | match (Sd { x: A, y: () }) {
| ^^^^^^^^^^^^^^^^^^^^ patterns `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `Sd` defined here
+ --> $DIR/issue-35609.rs:7:8
+ |
+LL | struct Sd { x: Enum, y: () }
+ | ^^
= note: the matched value is of type `Sd`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ Sd { x: A, y: _ } => {}
+LL + _ => todo!()
+ |
error[E0004]: non-exhaustive patterns: `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered
--> $DIR/issue-35609.rs:39:11
@@ -73,8 +105,23 @@ error[E0004]: non-exhaustive patterns: `Some(B)`, `Some(C)`, `Some(D)` and 2 mor
LL | match Some(A) {
| ^^^^^^^ patterns `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `Option` defined here
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+ |
+LL | / pub enum Option {
+LL | | /// No value.
+LL | | #[lang = "None"]
+LL | | #[stable(feature = "rust1", since = "1.0.0")]
+... |
+LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
+LL | | }
+ | |_^
= note: the matched value is of type `Option`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ None => (),
+LL + _ => todo!()
+ |
error: aborting due to 8 previous errors
diff --git a/src/test/ui/pattern/usefulness/issue-3601.stderr b/src/test/ui/pattern/usefulness/issue-3601.stderr
index 48ed14915084a..84916504220ba 100644
--- a/src/test/ui/pattern/usefulness/issue-3601.stderr
+++ b/src/test/ui/pattern/usefulness/issue-3601.stderr
@@ -4,8 +4,20 @@ error[E0004]: non-exhaustive patterns: `box _` not covered
LL | box NodeKind::Element(ed) => match ed.kind {
| ^^^^^^^ pattern `box _` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `Box` defined here
+ --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
+ |
+LL | / pub struct Box<
+LL | | T: ?Sized,
+LL | | #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
+LL | | >(Unique, A);
+ | |________________^
= note: the matched value is of type `Box`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true }
+LL + box _ => todo!()
+ |
error: aborting due to previous error
diff --git a/src/test/ui/pattern/usefulness/issue-39362.stderr b/src/test/ui/pattern/usefulness/issue-39362.stderr
index 8c162e55619e0..f0f93af216abc 100644
--- a/src/test/ui/pattern/usefulness/issue-39362.stderr
+++ b/src/test/ui/pattern/usefulness/issue-39362.stderr
@@ -1,16 +1,22 @@
error[E0004]: non-exhaustive patterns: `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered
--> $DIR/issue-39362.rs:10:11
|
-LL | / enum Foo {
-LL | | Bar { bar: Bar, id: usize }
-LL | | }
- | |_- `Foo` defined here
-...
-LL | match f {
- | ^ patterns `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered
+LL | match f {
+ | ^ patterns `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `Foo` defined here
+ --> $DIR/issue-39362.rs:2:5
+ |
+LL | enum Foo {
+ | ---
+LL | Bar { bar: Bar, id: usize }
+ | ^^^ not covered
= note: the matched value is of type `Foo`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ Foo::Bar { bar: Bar::B, .. } => (),
+LL ~ _ => todo!(),
+ |
error: aborting due to previous error
diff --git a/src/test/ui/pattern/usefulness/issue-40221.stderr b/src/test/ui/pattern/usefulness/issue-40221.stderr
index 98efe805a0b34..ca2ac71b1e478 100644
--- a/src/test/ui/pattern/usefulness/issue-40221.stderr
+++ b/src/test/ui/pattern/usefulness/issue-40221.stderr
@@ -1,17 +1,22 @@
error[E0004]: non-exhaustive patterns: `C(QA)` not covered
--> $DIR/issue-40221.rs:11:11
|
-LL | / enum P {
-LL | | C(PC),
- | | - not covered
-LL | | }
- | |_- `P` defined here
-...
-LL | match proto {
- | ^^^^^ pattern `C(QA)` not covered
+LL | match proto {
+ | ^^^^^ pattern `C(QA)` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `P` defined here
+ --> $DIR/issue-40221.rs:2:5
+ |
+LL | enum P {
+ | -
+LL | C(PC),
+ | ^ not covered
= note: the matched value is of type `P`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ P::C(PC::Q) => (),
+LL ~ C(QA) => todo!(),
+ |
error: aborting due to previous error
diff --git a/src/test/ui/pattern/usefulness/issue-4321.stderr b/src/test/ui/pattern/usefulness/issue-4321.stderr
index 1e8852556b161..19ee7aaf9beff 100644
--- a/src/test/ui/pattern/usefulness/issue-4321.stderr
+++ b/src/test/ui/pattern/usefulness/issue-4321.stderr
@@ -4,8 +4,12 @@ error[E0004]: non-exhaustive patterns: `(true, false)` not covered
LL | println!("foo {:}", match tup {
| ^^^ pattern `(true, false)` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(bool, bool)`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ (true, true) => "baz",
+LL + (true, false) => todo!()
+ |
error: aborting due to previous error
diff --git a/src/test/ui/pattern/usefulness/issue-50900.stderr b/src/test/ui/pattern/usefulness/issue-50900.stderr
index d378b6e8efe37..6d437de8ceaa7 100644
--- a/src/test/ui/pattern/usefulness/issue-50900.stderr
+++ b/src/test/ui/pattern/usefulness/issue-50900.stderr
@@ -1,14 +1,20 @@
error[E0004]: non-exhaustive patterns: `Tag(Exif, _)` not covered
--> $DIR/issue-50900.rs:15:11
|
-LL | pub struct Tag(pub Context, pub u16);
- | ------------------------------------- `Tag` defined here
-...
LL | match Tag::ExifIFDPointer {
| ^^^^^^^^^^^^^^^^^^^ pattern `Tag(Exif, _)` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `Tag` defined here
+ --> $DIR/issue-50900.rs:2:12
+ |
+LL | pub struct Tag(pub Context, pub u16);
+ | ^^^
= note: the matched value is of type `Tag`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ Tag::ExifIFDPointer => {}
+LL + Tag(Exif, _) => todo!()
+ |
error: aborting due to previous error
diff --git a/src/test/ui/pattern/usefulness/issue-56379.stderr b/src/test/ui/pattern/usefulness/issue-56379.stderr
index 6a231b868c8c4..9d0ba0564a12b 100644
--- a/src/test/ui/pattern/usefulness/issue-56379.stderr
+++ b/src/test/ui/pattern/usefulness/issue-56379.stderr
@@ -1,21 +1,26 @@
error[E0004]: non-exhaustive patterns: `A(false)`, `B(false)` and `C(false)` not covered
--> $DIR/issue-56379.rs:8:11
|
-LL | / enum Foo {
-LL | | A(bool),
- | | - not covered
-LL | | B(bool),
- | | - not covered
-LL | | C(bool),
- | | - not covered
-LL | | }
- | |_- `Foo` defined here
-...
-LL | match Foo::A(true) {
- | ^^^^^^^^^^^^ patterns `A(false)`, `B(false)` and `C(false)` not covered
+LL | match Foo::A(true) {
+ | ^^^^^^^^^^^^ patterns `A(false)`, `B(false)` and `C(false)` not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `Foo` defined here
+ --> $DIR/issue-56379.rs:2:5
+ |
+LL | enum Foo {
+ | ---
+LL | A(bool),
+ | ^ not covered
+LL | B(bool),
+ | ^ not covered
+LL | C(bool),
+ | ^ not covered
= note: the matched value is of type `Foo`
+help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+ |
+LL ~ Foo::C(true) => {}
+LL + A(false) | B(false) | C(false) => todo!()
+ |
error: aborting due to previous error
diff --git a/src/test/ui/pattern/usefulness/issue-72377.stderr b/src/test/ui/pattern/usefulness/issue-72377.stderr
index b4a68333967b3..396595b26353f 100644
--- a/src/test/ui/pattern/usefulness/issue-72377.stderr
+++ b/src/test/ui/pattern/usefulness/issue-72377.stderr
@@ -4,8 +4,12 @@ error[E0004]: non-exhaustive patterns: `(A, Some(A))`, `(A, Some(B))`, `(B, Some
LL | match (x, y) {
| ^^^^^^ patterns `(A, Some(A))`, `(A, Some(B))`, `(B, Some(B))` and 2 more not covered
|
- = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(X, Option