Auto merge of #108504 - cjgillot:thir-pattern, r=compiler-errors,Nilstrieb

Check pattern refutability on THIR

The current `check_match` query is based on HIR, but partially re-lowers HIR into THIR.
This PR proposed to use the results of the `thir_body` query to check matches, instead of re-building THIR.

Most of the diagnostic changes are spans getting shorter, or commas/semicolons not getting removed.

This PR degrades the diagnostic for confusing constants in patterns (`let A = foo()` where `A` resolves to a `const A` somewhere): it does not point ot the definition of `const A` any more.
This commit is contained in:
bors 2023-04-06 12:42:01 +00:00
commit 0534655d9b
106 changed files with 1058 additions and 1499 deletions

View File

@ -2,7 +2,6 @@ use crate::def::{CtorOf, DefKind, Res};
use crate::def_id::DefId;
use crate::hir::{self, BindingAnnotation, ByRef, HirId, PatKind};
use rustc_data_structures::fx::FxHashSet;
use rustc_span::hygiene::DesugaringKind;
use rustc_span::symbol::Ident;
use rustc_span::Span;
@ -136,14 +135,4 @@ impl hir::Pat<'_> {
});
result
}
/// If the pattern is `Some(<pat>)` from a desugared for loop, returns the inner pattern
pub fn for_loop_some(&self) -> Option<&Self> {
if self.span.desugaring_kind() == Some(DesugaringKind::ForLoop) {
if let hir::PatKind::Struct(_, [pat_field], _) = self.kind {
return Some(pat_field.pat);
}
}
None
}
}

View File

@ -765,7 +765,7 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
parallel!(
{
sess.time("match_checking", || {
tcx.hir().par_body_owners(|def_id| tcx.ensure().check_match(def_id.to_def_id()))
tcx.hir().par_body_owners(|def_id| tcx.ensure().check_match(def_id))
});
},
{

View File

@ -94,7 +94,7 @@ impl<'tcx> DepContext for TyCtxt<'tcx> {
}
#[inline]
fn dep_kind_info(&self, dep_kind: DepKind) -> &DepKindStruct<'tcx> {
&self.query_kinds[dep_kind as usize]
fn dep_kind_info(&self, dk: DepKind) -> &DepKindStruct<'tcx> {
&self.query_kinds[dk as usize]
}
}

View File

@ -2001,6 +2001,13 @@ impl<'tcx> Rvalue<'tcx> {
}
impl BorrowKind {
pub fn mutability(&self) -> Mutability {
match *self {
BorrowKind::Shared | BorrowKind::Shallow | BorrowKind::Unique => Mutability::Not,
BorrowKind::Mut { .. } => Mutability::Mut,
}
}
pub fn allows_two_phase_borrow(&self) -> bool {
match *self {
BorrowKind::Shared | BorrowKind::Shallow | BorrowKind::Unique => false,

View File

@ -1114,9 +1114,9 @@ rustc_queries! {
desc { "converting literal to mir constant" }
}
query check_match(key: DefId) {
desc { |tcx| "match-checking `{}`", tcx.def_path_str(key) }
cache_on_disk_if { key.is_local() }
query check_match(key: LocalDefId) {
desc { |tcx| "match-checking `{}`", tcx.def_path_str(key.to_def_id()) }
cache_on_disk_if { true }
}
/// Performs part of the privacy check and computes effective visibilities.

View File

@ -227,6 +227,9 @@ pub enum StmtKind<'tcx> {
/// The lint level for this `let` statement.
lint_level: LintLevel,
/// Span of the `let <PAT> = <INIT>` part.
span: Span,
},
}
@ -594,6 +597,55 @@ impl<'tcx> Pat<'tcx> {
_ => None,
}
}
/// Call `f` on every "binding" in a pattern, e.g., on `a` in
/// `match foo() { Some(a) => (), None => () }`
pub fn each_binding(&self, mut f: impl FnMut(Symbol, BindingMode, Ty<'tcx>, Span)) {
self.walk_always(|p| {
if let PatKind::Binding { name, mode, ty, .. } = p.kind {
f(name, mode, ty, p.span);
}
});
}
/// Walk the pattern in left-to-right order.
///
/// If `it(pat)` returns `false`, the children are not visited.
pub fn walk(&self, mut it: impl FnMut(&Pat<'tcx>) -> bool) {
self.walk_(&mut it)
}
fn walk_(&self, it: &mut impl FnMut(&Pat<'tcx>) -> bool) {
if !it(self) {
return;
}
use PatKind::*;
match &self.kind {
Wild | Range(..) | Binding { subpattern: None, .. } | Constant { .. } => {}
AscribeUserType { subpattern, .. }
| Binding { subpattern: Some(subpattern), .. }
| Deref { subpattern } => subpattern.walk_(it),
Leaf { subpatterns } | Variant { subpatterns, .. } => {
subpatterns.iter().for_each(|field| field.pattern.walk_(it))
}
Or { pats } => pats.iter().for_each(|p| p.walk_(it)),
Array { box ref prefix, ref slice, box ref suffix }
| Slice { box ref prefix, ref slice, box ref suffix } => {
prefix.iter().chain(slice.iter()).chain(suffix.iter()).for_each(|p| p.walk_(it))
}
}
}
/// Walk the pattern in left-to-right order.
///
/// If you always want to recurse, prefer this method over `walk`.
pub fn walk_always(&self, mut it: impl FnMut(&Pat<'tcx>)) {
self.walk(|p| {
it(p);
true
})
}
}
impl<'tcx> IntoDiagnosticArg for Pat<'tcx> {
@ -879,7 +931,7 @@ mod size_asserts {
static_assert_size!(ExprKind<'_>, 40);
static_assert_size!(Pat<'_>, 72);
static_assert_size!(PatKind<'_>, 56);
static_assert_size!(Stmt<'_>, 48);
static_assert_size!(StmtKind<'_>, 40);
static_assert_size!(Stmt<'_>, 56);
static_assert_size!(StmtKind<'_>, 48);
// tidy-alphabetical-end
}

View File

@ -175,6 +175,7 @@ pub fn walk_stmt<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, stmt: &Stm
ref pattern,
lint_level: _,
else_block,
span: _,
} => {
if let Some(init) = initializer {
visitor.visit_expr(&visitor.thir()[*init]);

View File

@ -239,19 +239,9 @@ mir_build_trailing_irrefutable_let_patterns = trailing irrefutable {$count ->
} into the body
mir_build_bindings_with_variant_name =
pattern binding `{$ident}` is named the same as one of the variants of the type `{$ty_path}`
pattern binding `{$name}` is named the same as one of the variants of the type `{$ty_path}`
.suggestion = to match on the variant, qualify the path
mir_build_irrefutable_let_patterns_generic_let = irrefutable `let` {$count ->
[one] pattern
*[other] patterns
}
.note = {$count ->
[one] this pattern
*[other] these patterns
} will always match, so the `let` is useless
.help = consider removing `let`
mir_build_irrefutable_let_patterns_if_let = irrefutable `if let` {$count ->
[one] pattern
*[other] patterns
@ -357,15 +347,13 @@ mir_build_inform_irrefutable = `let` bindings require an "irrefutable pattern",
mir_build_more_information = for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
mir_build_res_defined_here = {$res} defined here
mir_build_adt_defined_here = `{$ty}` defined here
mir_build_variant_defined_here = not covered
mir_build_interpreted_as_const = introduce a variable instead
mir_build_confused = missing patterns are not covered because `{$variable}` is interpreted as {$article} {$res} pattern, not a new variable
mir_build_confused = missing patterns are not covered because `{$variable}` is interpreted as a constant pattern, not a new variable
mir_build_suggest_if_let = you might want to use `if let` to ignore the {$count ->
[one] variant that isn't

View File

@ -115,6 +115,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
initializer: Some(initializer),
lint_level,
else_block: Some(else_block),
span: _,
} => {
// When lowering the statement `let <pat> = <expr> else { <else> };`,
// the `<else>` block is nested in the parent scope enclosing this statement.
@ -278,6 +279,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
initializer,
lint_level,
else_block: None,
span: _,
} => {
let ignores_expr_result = matches!(pattern.kind, PatKind::Wild);
this.block_context.push(BlockFrame::Statement { ignores_expr_result });

View File

@ -58,6 +58,7 @@ fn mir_build(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> Body<'_
ty::WithOptConstParam { did, const_param_did: None } => {
tcx.ensure_with_value().thir_check_unsafety(did);
tcx.ensure_with_value().thir_abstract_const(did);
tcx.ensure_with_value().check_match(did);
}
}

View File

@ -6,11 +6,11 @@ use rustc_errors::{
error_code, AddToDiagnostic, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed,
Handler, IntoDiagnostic, MultiSpan, SubdiagnosticMessage,
};
use rustc_hir::def::Res;
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
use rustc_middle::thir::Pat;
use rustc_middle::ty::{self, Ty};
use rustc_span::{symbol::Ident, Span};
use rustc_span::symbol::Symbol;
use rustc_span::Span;
#[derive(LintDiagnostic)]
#[diag(mir_build_unconditional_recursion)]
@ -534,18 +534,10 @@ pub struct TrailingIrrefutableLetPatterns {
#[derive(LintDiagnostic)]
#[diag(mir_build_bindings_with_variant_name, code = "E0170")]
pub struct BindingsWithVariantName {
#[suggestion(code = "{ty_path}::{ident}", applicability = "machine-applicable")]
#[suggestion(code = "{ty_path}::{name}", applicability = "machine-applicable")]
pub suggestion: Option<Span>,
pub ty_path: String,
pub ident: Ident,
}
#[derive(LintDiagnostic)]
#[diag(mir_build_irrefutable_let_patterns_generic_let)]
#[note]
#[help]
pub struct IrrefutableLetPatternsGenericLet {
pub count: usize,
pub name: Symbol,
}
#[derive(LintDiagnostic)]
@ -584,13 +576,12 @@ pub struct IrrefutableLetPatternsWhileLet {
#[diag(mir_build_borrow_of_moved_value)]
pub struct BorrowOfMovedValue<'tcx> {
#[primary_span]
pub span: Span,
#[label]
#[label(mir_build_occurs_because_label)]
pub binding_span: Span,
#[label(mir_build_value_borrowed_label)]
pub conflicts_ref: Vec<Span>,
pub name: Ident,
pub name: Symbol,
pub ty: Ty<'tcx>,
#[suggestion(code = "ref ", applicability = "machine-applicable")]
pub suggest_borrowing: Option<Span>,
@ -638,19 +629,19 @@ pub enum Conflict {
Mut {
#[primary_span]
span: Span,
name: Ident,
name: Symbol,
},
#[label(mir_build_borrow)]
Ref {
#[primary_span]
span: Span,
name: Ident,
name: Symbol,
},
#[label(mir_build_moved)]
Moved {
#[primary_span]
span: Span,
name: Ident,
name: Symbol,
},
}
@ -802,8 +793,6 @@ pub(crate) struct PatternNotCovered<'s, 'tcx> {
pub let_suggestion: Option<SuggestLet>,
#[subdiagnostic]
pub misc_suggestion: Option<MiscPatternSuggestion>,
#[subdiagnostic]
pub res_defined_here: Option<ResDefinedHere>,
}
#[derive(Subdiagnostic)]
@ -837,14 +826,6 @@ impl<'tcx> AddToDiagnostic for AdtDefinedHere<'tcx> {
}
}
#[derive(Subdiagnostic)]
#[label(mir_build_res_defined_here)]
pub struct ResDefinedHere {
#[primary_span]
pub def_span: Span,
pub res: Res,
}
#[derive(Subdiagnostic)]
#[suggestion(
mir_build_interpreted_as_const,
@ -855,9 +836,7 @@ pub struct ResDefinedHere {
pub struct InterpretedAsConst {
#[primary_span]
pub span: Span,
pub article: &'static str,
pub variable: String,
pub res: Res,
}
#[derive(Subdiagnostic)]

View File

@ -105,6 +105,10 @@ impl<'tcx> Cx<'tcx> {
}
}
let span = match local.init {
Some(init) => local.span.with_hi(init.span.hi()),
None => local.span,
};
let stmt = Stmt {
kind: StmtKind::Let {
remainder_scope,
@ -116,6 +120,7 @@ impl<'tcx> Cx<'tcx> {
initializer: local.init.map(|init| self.mirror_expr(init)),
else_block,
lint_level: LintLevel::Explicit(local.hir_id),
span,
},
opt_destruction_scope: opt_dxn_ext,
};

File diff suppressed because it is too large Load Diff

View File

@ -59,8 +59,6 @@ struct ConstToPat<'tcx> {
// inference context used for checking `T: Structural` bounds.
infcx: InferCtxt<'tcx>,
include_lint_checks: bool,
treat_byte_string_as_slice: bool,
}
@ -93,7 +91,6 @@ impl<'tcx> ConstToPat<'tcx> {
span,
infcx,
param_env: pat_ctxt.param_env,
include_lint_checks: pat_ctxt.include_lint_checks,
saw_const_match_error: Cell::new(false),
saw_const_match_lint: Cell::new(false),
behind_reference: Cell::new(false),
@ -134,7 +131,7 @@ impl<'tcx> ConstToPat<'tcx> {
})
});
if self.include_lint_checks && !self.saw_const_match_error.get() {
if !self.saw_const_match_error.get() {
// If we were able to successfully convert the const to some pat,
// double-check that all types in the const implement `Structural`.
@ -239,21 +236,19 @@ impl<'tcx> ConstToPat<'tcx> {
let kind = match cv.ty().kind() {
ty::Float(_) => {
if self.include_lint_checks {
tcx.emit_spanned_lint(
lint::builtin::ILLEGAL_FLOATING_POINT_LITERAL_PATTERN,
id,
span,
FloatPattern,
);
}
PatKind::Constant { value: cv }
}
ty::Adt(adt_def, _) if adt_def.is_union() => {
// Matching on union fields is unsafe, we can't hide it in constants
self.saw_const_match_error.set(true);
let err = UnionPattern { span };
tcx.sess.create_err(err).emit_unless(!self.include_lint_checks);
tcx.sess.emit_err(err);
PatKind::Wild
}
ty::Adt(..)
@ -267,7 +262,7 @@ impl<'tcx> ConstToPat<'tcx> {
{
self.saw_const_match_error.set(true);
let err = TypeNotStructural { span, non_sm_ty };
tcx.sess.create_err(err).emit_unless(!self.include_lint_checks);
tcx.sess.emit_err(err);
PatKind::Wild
}
// If the type is not structurally comparable, just emit the constant directly,
@ -280,8 +275,7 @@ impl<'tcx> ConstToPat<'tcx> {
// Backwards compatibility hack because we can't cause hard errors on these
// types, so we compare them via `PartialEq::eq` at runtime.
ty::Adt(..) if !self.type_marked_structural(cv.ty()) && self.behind_reference.get() => {
if self.include_lint_checks
&& !self.saw_const_match_error.get()
if !self.saw_const_match_error.get()
&& !self.saw_const_match_lint.get()
{
self.saw_const_match_lint.set(true);
@ -305,7 +299,7 @@ impl<'tcx> ConstToPat<'tcx> {
);
self.saw_const_match_error.set(true);
let err = TypeNotStructural { span, non_sm_ty: cv.ty() };
tcx.sess.create_err(err).emit_unless(!self.include_lint_checks);
tcx.sess.emit_err(err);
PatKind::Wild
}
ty::Adt(adt_def, substs) if adt_def.is_enum() => {
@ -339,7 +333,7 @@ impl<'tcx> ConstToPat<'tcx> {
ty::Dynamic(..) => {
self.saw_const_match_error.set(true);
let err = InvalidPattern { span, non_sm_ty: cv.ty() };
tcx.sess.create_err(err).emit_unless(!self.include_lint_checks);
tcx.sess.emit_err(err);
PatKind::Wild
}
// `&str` is represented as `ConstValue::Slice`, let's keep using this
@ -406,8 +400,7 @@ impl<'tcx> ConstToPat<'tcx> {
// to figure out how to get a reference again.
ty::Adt(_, _) if !self.type_marked_structural(*pointee_ty) => {
if self.behind_reference.get() {
if self.include_lint_checks
&& !self.saw_const_match_error.get()
if !self.saw_const_match_error.get()
&& !self.saw_const_match_lint.get()
{
self.saw_const_match_lint.set(true);
@ -423,7 +416,7 @@ impl<'tcx> ConstToPat<'tcx> {
if !self.saw_const_match_error.get() {
self.saw_const_match_error.set(true);
let err = TypeNotStructural { span, non_sm_ty: *pointee_ty };
tcx.sess.create_err(err).emit_unless(!self.include_lint_checks);
tcx.sess.emit_err(err);
}
PatKind::Wild
}
@ -437,7 +430,7 @@ impl<'tcx> ConstToPat<'tcx> {
// (except slices, which are handled in a separate arm above).
let err = UnsizedPattern { span, non_sm_ty: *pointee_ty };
tcx.sess.create_err(err).emit_unless(!self.include_lint_checks);
tcx.sess.emit_err(err);
PatKind::Wild
} else {
@ -465,8 +458,7 @@ impl<'tcx> ConstToPat<'tcx> {
// compilation choices change the runtime behaviour of the match.
// See https://github.com/rust-lang/rust/issues/70861 for examples.
ty::FnPtr(..) | ty::RawPtr(..) => {
if self.include_lint_checks
&& !self.saw_const_match_error.get()
if !self.saw_const_match_error.get()
&& !self.saw_const_match_lint.get()
{
self.saw_const_match_lint.set(true);
@ -482,13 +474,12 @@ impl<'tcx> ConstToPat<'tcx> {
_ => {
self.saw_const_match_error.set(true);
let err = InvalidPattern { span, non_sm_ty: cv.ty() };
tcx.sess.create_err(err).emit_unless(!self.include_lint_checks);
tcx.sess.emit_err(err);
PatKind::Wild
}
};
if self.include_lint_checks
&& !self.saw_const_match_error.get()
if !self.saw_const_match_error.get()
&& !self.saw_const_match_lint.get()
&& mir_structural_match_violation
// FIXME(#73448): Find a way to bring const qualification into parity with

View File

@ -258,7 +258,7 @@ impl IntRange {
pcx: &PatCtxt<'_, 'p, 'tcx>,
pats: impl Iterator<Item = &'a DeconstructedPat<'p, 'tcx>>,
column_count: usize,
hir_id: HirId,
lint_root: HirId,
) {
if self.is_singleton() {
return;
@ -290,7 +290,7 @@ impl IntRange {
if !overlap.is_empty() {
pcx.cx.tcx.emit_spanned_lint(
lint::builtin::OVERLAPPING_RANGE_ENDPOINTS,
hir_id,
lint_root,
pcx.span,
OverlappingRangeEndpoints { overlap, range: pcx.span },
);

View File

@ -31,20 +31,10 @@ use rustc_target::abi::FieldIdx;
use std::cmp::Ordering;
#[derive(Clone, Debug)]
enum PatternError {
AssocConstInPattern(Span),
ConstParamInPattern(Span),
StaticInPattern(Span),
NonConstPath(Span),
}
struct PatCtxt<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
typeck_results: &'a ty::TypeckResults<'tcx>,
errors: Vec<PatternError>,
include_lint_checks: bool,
}
pub(super) fn pat_from_hir<'a, 'tcx>(
@ -53,30 +43,13 @@ pub(super) fn pat_from_hir<'a, 'tcx>(
typeck_results: &'a ty::TypeckResults<'tcx>,
pat: &'tcx hir::Pat<'tcx>,
) -> Box<Pat<'tcx>> {
let mut pcx = PatCtxt::new(tcx, param_env, typeck_results);
let mut pcx = PatCtxt { tcx, param_env, typeck_results };
let result = pcx.lower_pattern(pat);
if !pcx.errors.is_empty() {
let msg = format!("encountered errors lowering pattern: {:?}", pcx.errors);
tcx.sess.delay_span_bug(pat.span, &msg);
}
debug!("pat_from_hir({:?}) = {:?}", pat, result);
result
}
impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
fn new(
tcx: TyCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
typeck_results: &'a ty::TypeckResults<'tcx>,
) -> Self {
PatCtxt { tcx, param_env, typeck_results, errors: vec![], include_lint_checks: false }
}
fn include_lint_checks(&mut self) -> &mut Self {
self.include_lint_checks = true;
self
}
fn lower_pattern(&mut self, pat: &'tcx hir::Pat<'tcx>) -> Box<Pat<'tcx>> {
// When implicit dereferences have been inserted in this pattern, the unadjusted lowered
// pattern has the type that results *after* dereferencing. For example, in this code:
@ -473,12 +446,15 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
| Res::SelfTyAlias { .. }
| Res::SelfCtor(..) => PatKind::Leaf { subpatterns },
_ => {
let pattern_error = match res {
Res::Def(DefKind::ConstParam, _) => PatternError::ConstParamInPattern(span),
Res::Def(DefKind::Static(_), _) => PatternError::StaticInPattern(span),
_ => PatternError::NonConstPath(span),
match res {
Res::Def(DefKind::ConstParam, _) => {
self.tcx.sess.emit_err(ConstParamInPattern { span })
}
Res::Def(DefKind::Static(_), _) => {
self.tcx.sess.emit_err(StaticInPattern { span })
}
_ => self.tcx.sess.emit_err(NonConstPath { span }),
};
self.errors.push(pattern_error);
PatKind::Wild
}
};
@ -531,7 +507,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
// It should be assoc consts if there's no error but we cannot resolve it.
debug_assert!(is_associated_const);
self.errors.push(PatternError::AssocConstInPattern(span));
self.tcx.sess.emit_err(AssocConstInPattern { span });
return pat_from_kind(PatKind::Wild);
}
@ -609,7 +585,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
match value {
mir::ConstantKind::Ty(c) => match c.kind() {
ConstKind::Param(_) => {
self.errors.push(PatternError::ConstParamInPattern(span));
self.tcx.sess.emit_err(ConstParamInPattern { span });
return PatKind::Wild;
}
ConstKind::Error(_) => {

View File

@ -300,7 +300,6 @@ use rustc_arena::TypedArena;
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_hir::def_id::DefId;
use rustc_hir::HirId;
use rustc_hir::Node;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_session::lint::builtin::NON_EXHAUSTIVE_OMITTED_PATTERNS;
use rustc_span::{Span, DUMMY_SP};
@ -319,6 +318,8 @@ pub(crate) struct MatchCheckCtxt<'p, 'tcx> {
pub(crate) module: DefId,
pub(crate) param_env: ty::ParamEnv<'tcx>,
pub(crate) pattern_arena: &'p TypedArena<DeconstructedPat<'p, 'tcx>>,
/// Only produce `NON_EXHAUSTIVE_OMITTED_PATTERNS` lint on refutable patterns.
pub(crate) refutable: bool,
}
impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> {
@ -765,13 +766,13 @@ impl<'p, 'tcx> Witness<'p, 'tcx> {
/// `is_under_guard` is used to inform if the pattern has a guard. If it
/// has one it must not be inserted into the matrix. This shouldn't be
/// relied on for soundness.
#[instrument(level = "debug", skip(cx, matrix, hir_id), ret)]
#[instrument(level = "debug", skip(cx, matrix, lint_root), ret)]
fn is_useful<'p, 'tcx>(
cx: &MatchCheckCtxt<'p, 'tcx>,
matrix: &Matrix<'p, 'tcx>,
v: &PatStack<'p, 'tcx>,
witness_preference: ArmType,
hir_id: HirId,
lint_root: HirId,
is_under_guard: bool,
is_top_level: bool,
) -> Usefulness<'p, 'tcx> {
@ -804,7 +805,7 @@ fn is_useful<'p, 'tcx>(
for v in v.expand_or_pat() {
debug!(?v);
let usefulness = ensure_sufficient_stack(|| {
is_useful(cx, &matrix, &v, witness_preference, hir_id, is_under_guard, false)
is_useful(cx, &matrix, &v, witness_preference, lint_root, is_under_guard, false)
});
debug!(?usefulness);
ret.extend(usefulness);
@ -837,7 +838,7 @@ fn is_useful<'p, 'tcx>(
pcx,
matrix.heads(),
matrix.column_count().unwrap_or(0),
hir_id,
lint_root,
)
}
// We split the head constructor of `v`.
@ -852,7 +853,15 @@ fn is_useful<'p, 'tcx>(
let spec_matrix = start_matrix.specialize_constructor(pcx, &ctor);
let v = v.pop_head_constructor(pcx, &ctor);
let usefulness = ensure_sufficient_stack(|| {
is_useful(cx, &spec_matrix, &v, witness_preference, hir_id, is_under_guard, false)
is_useful(
cx,
&spec_matrix,
&v,
witness_preference,
lint_root,
is_under_guard,
false,
)
});
let usefulness = usefulness.apply_constructor(pcx, start_matrix, &ctor);
@ -860,6 +869,8 @@ fn is_useful<'p, 'tcx>(
// that has the potential to trigger the `non_exhaustive_omitted_patterns` lint.
// To understand the workings checkout `Constructor::split` and `SplitWildcard::new/into_ctors`
if is_non_exhaustive_and_wild
// Only emit a lint on refutable patterns.
&& cx.refutable
// We check that the match has a wildcard pattern and that wildcard is useful,
// meaning there are variants that are covered by the wildcard. Without the check
// for `witness_preference` the lint would trigger on `if let NonExhaustiveEnum::A = foo {}`
@ -868,8 +879,6 @@ fn is_useful<'p, 'tcx>(
&ctor,
Constructor::Missing { nonexhaustive_enum_missing_real_variants: true }
)
// We don't want to lint patterns which are function arguments or locals
&& !matches!(cx.tcx.hir().find_parent(hir_id), Some(Node::Param(_)|Node::Local(_)))
{
let patterns = {
let mut split_wildcard = SplitWildcard::new(pcx);
@ -896,7 +905,7 @@ fn is_useful<'p, 'tcx>(
// NB: The partner lint for structs lives in `compiler/rustc_hir_analysis/src/check/pat.rs`.
cx.tcx.emit_spanned_lint(
NON_EXHAUSTIVE_OMITTED_PATTERNS,
hir_id,
lint_root,
pcx.span,
NonExhaustiveOmittedPattern {
scrut_ty: pcx.ty,
@ -954,7 +963,7 @@ pub(crate) struct UsefulnessReport<'p, 'tcx> {
pub(crate) fn compute_match_usefulness<'p, 'tcx>(
cx: &MatchCheckCtxt<'p, 'tcx>,
arms: &[MatchArm<'p, 'tcx>],
scrut_hir_id: HirId,
lint_root: HirId,
scrut_ty: Ty<'tcx>,
) -> UsefulnessReport<'p, 'tcx> {
let mut matrix = Matrix::empty();
@ -979,7 +988,7 @@ pub(crate) fn compute_match_usefulness<'p, 'tcx>(
let wild_pattern = cx.pattern_arena.alloc(DeconstructedPat::wildcard(scrut_ty, DUMMY_SP));
let v = PatStack::from_pattern(wild_pattern);
let usefulness = is_useful(cx, &matrix, &v, FakeExtraWildcard, scrut_hir_id, false, true);
let usefulness = is_useful(cx, &matrix, &v, FakeExtraWildcard, lint_root, false, true);
let non_exhaustiveness_witnesses = match usefulness {
WithWitnesses(pats) => pats.into_iter().map(|w| w.single_pattern()).collect(),
NoWitnesses { .. } => bug!(),

View File

@ -151,6 +151,7 @@ impl<'a, 'tcx> ThirPrinter<'a, 'tcx> {
initializer,
else_block,
lint_level,
span,
} => {
print_indented!(self, "kind: Let {", depth_lvl + 1);
print_indented!(
@ -181,6 +182,7 @@ impl<'a, 'tcx> ThirPrinter<'a, 'tcx> {
}
print_indented!(self, format!("lint_level: {:?}", lint_level), depth_lvl + 2);
print_indented!(self, format!("span: {:?}", span), depth_lvl + 2);
print_indented!(self, "}", depth_lvl + 1);
}
}

View File

@ -7,10 +7,10 @@ promoted[0] in FOO: &[&i32; 1] = {
let mut _3: *const i32; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
bb0: {
_3 = const {alloc3: *const i32}; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
_3 = const {alloc2: *const i32}; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
// mir::Constant
// + span: $DIR/const_promotion_extern_static.rs:13:42: 13:43
// + literal: Const { ty: *const i32, val: Value(Scalar(alloc3)) }
// + literal: Const { ty: *const i32, val: Value(Scalar(alloc2)) }
_2 = &(*_3); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:41: +0:43
_1 = [move _2]; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:46
_0 = &_1; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
@ -18,4 +18,4 @@ promoted[0] in FOO: &[&i32; 1] = {
}
}
alloc3 (extern static: X)
alloc2 (extern static: X)

View File

@ -18,11 +18,11 @@
- StorageLive(_3); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:46
- StorageLive(_4); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:32: +0:45
- StorageLive(_5); // scope 1 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
- _5 = const {alloc3: *const i32}; // scope 1 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
- _5 = const {alloc2: *const i32}; // scope 1 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
+ _6 = const _; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
// mir::Constant
- // + span: $DIR/const_promotion_extern_static.rs:13:42: 13:43
- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc3)) }
- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc2)) }
- _4 = &(*_5); // scope 1 at $DIR/const_promotion_extern_static.rs:+0:41: +0:43
- _3 = [move _4]; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:46
- _2 = &_3; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
@ -50,5 +50,5 @@
}
}
-
- alloc3 (extern static: X)
- alloc2 (extern static: X)

View File

@ -2,18 +2,16 @@ error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:36:9
|
LL | ref foo @ [.., ref mut bar] => (),
| -------^^^^^^^^-----------^
| | |
| | value is mutably borrowed by `bar` here
| ^^^^^^^ ----------- value is mutably borrowed by `bar` here
| |
| value is borrowed by `foo` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:120:9
|
LL | ref foo @ Some(box ref mut s) => (),
| -------^^^^^^^^^^^^---------^
| | |
| | value is mutably borrowed by `s` here
| ^^^^^^^ --------- value is mutably borrowed by `s` here
| |
| value is borrowed by `foo` here
error[E0382]: borrow of moved value: `x`

View File

@ -14,14 +14,15 @@ LL | async fn foo(x: u32) -> u32 {
| ^^^query stack during panic:
#0 [typeck] type-checking `foo`
#1 [thir_body] building THIR for `foo`
#2 [mir_built] building MIR for `foo`
#3 [unsafety_check_result] unsafety-checking `foo`
#4 [mir_const] preparing `foo` for borrow checking
#5 [mir_promoted] processing MIR for `foo`
#6 [mir_borrowck] borrow-checking `foo`
#7 [type_of] computing type of `foo::{opaque#0}`
#8 [check_mod_item_types] checking item types in top-level module
#9 [analysis] running analysis passes on this crate
#2 [check_match] match-checking `foo`
#3 [mir_built] building MIR for `foo`
#4 [unsafety_check_result] unsafety-checking `foo`
#5 [mir_const] preparing `foo` for borrow checking
#6 [mir_promoted] processing MIR for `foo`
#7 [mir_borrowck] borrow-checking `foo`
#8 [type_of] computing type of `foo::{opaque#0}`
#9 [check_mod_item_types] checking item types in top-level module
#10 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

View File

@ -14,7 +14,6 @@ fn main() {
match -128i8 {
NEG_NEG_128 => println!("A"),
//~^ ERROR could not evaluate constant pattern
//~| ERROR could not evaluate constant pattern
_ => println!("B"),
}
}

View File

@ -10,12 +10,6 @@ error: could not evaluate constant pattern
LL | NEG_NEG_128 => println!("A"),
| ^^^^^^^^^^^
error: could not evaluate constant pattern
--> $DIR/const-eval-overflow-2.rs:15:9
|
LL | NEG_NEG_128 => println!("A"),
| ^^^^^^^^^^^
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.

View File

@ -1,5 +1,5 @@
error[E0080]: evaluation of constant value failed
--> $DIR/ref_to_int_match.rs:25:27
--> $DIR/ref_to_int_match.rs:24:27
|
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
| ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@ -13,12 +13,6 @@ error: could not evaluate constant pattern
LL | 10..=BAR => {},
| ^^^
error: could not evaluate constant pattern
--> $DIR/ref_to_int_match.rs:7:14
|
LL | 10..=BAR => {},
| ^^^
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.

View File

@ -1,5 +1,5 @@
error[E0080]: evaluation of constant value failed
--> $DIR/ref_to_int_match.rs:25:27
--> $DIR/ref_to_int_match.rs:24:27
|
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
| ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@ -13,12 +13,6 @@ error: could not evaluate constant pattern
LL | 10..=BAR => {},
| ^^^
error: could not evaluate constant pattern
--> $DIR/ref_to_int_match.rs:7:14
|
LL | 10..=BAR => {},
| ^^^
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.

View File

@ -5,7 +5,6 @@ fn main() {
match n {
0..=10 => {},
10..=BAR => {}, //~ ERROR could not evaluate constant pattern
//~| ERROR could not evaluate constant pattern
_ => {},
}
}

View File

@ -9,8 +9,8 @@ LL | A = { let 0 = 0; 0 },
= note: the matched value is of type `i32`
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | A = { if let 0 = 0 { todo!() } 0 },
| ++ ~~~~~~~~~~~
LL | A = { if let 0 = 0 { todo!() }; 0 },
| ++ +++++++++++
help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
|
LL | A = { let _0 = 0; 0 },

View File

@ -9,8 +9,8 @@ LL | let x: [i32; { let 0 = 0; 0 }] = [];
= note: the matched value is of type `i32`
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | let x: [i32; { if let 0 = 0 { todo!() } 0 }] = [];
| ++ ~~~~~~~~~~~
LL | let x: [i32; { if let 0 = 0 { todo!() }; 0 }] = [];
| ++ +++++++++++
help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
|
LL | let x: [i32; { let _0 = 0; 0 }] = [];

View File

@ -9,8 +9,8 @@ LL | const X: i32 = { let 0 = 0; 0 };
= note: the matched value is of type `i32`
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | const X: i32 = { if let 0 = 0 { todo!() } 0 };
| ++ ~~~~~~~~~~~
LL | const X: i32 = { if let 0 = 0 { todo!() }; 0 };
| ++ +++++++++++
help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
|
LL | const X: i32 = { let _0 = 0; 0 };
@ -27,8 +27,8 @@ LL | static Y: i32 = { let 0 = 0; 0 };
= note: the matched value is of type `i32`
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | static Y: i32 = { if let 0 = 0 { todo!() } 0 };
| ++ ~~~~~~~~~~~
LL | static Y: i32 = { if let 0 = 0 { todo!() }; 0 };
| ++ +++++++++++
help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
|
LL | static Y: i32 = { let _0 = 0; 0 };
@ -45,8 +45,8 @@ LL | const X: i32 = { let 0 = 0; 0 };
= note: the matched value is of type `i32`
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | const X: i32 = { if let 0 = 0 { todo!() } 0 };
| ++ ~~~~~~~~~~~
LL | const X: i32 = { if let 0 = 0 { todo!() }; 0 };
| ++ +++++++++++
help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
|
LL | const X: i32 = { let _0 = 0; 0 };
@ -63,8 +63,8 @@ LL | const X: i32 = { let 0 = 0; 0 };
= note: the matched value is of type `i32`
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | const X: i32 = { if let 0 = 0 { todo!() } 0 };
| ++ ~~~~~~~~~~~
LL | const X: i32 = { if let 0 = 0 { todo!() }; 0 };
| ++ +++++++++++
help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
|
LL | const X: i32 = { let _0 = 0; 0 };

View File

@ -1,9 +1,6 @@
error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:12:9
|
LL | const a: u8 = 2;
| ----------- constant defined here
...
LL | let a = 4;
| ^
| |
@ -11,14 +8,13 @@ LL | let a = 4;
| missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable
| help: introduce a variable instead: `a_var`
|
= 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: the matched value is of type `u8`
error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:17:9
|
LL | pub const b: u8 = 2;
| --------------- constant defined here
...
LL | let c = 4;
| ^
| |
@ -26,14 +22,13 @@ LL | let c = 4;
| missing patterns are not covered because `c` is interpreted as a constant pattern, not a new variable
| help: introduce a variable instead: `c_var`
|
= 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: the matched value is of type `u8`
error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:22:9
|
LL | pub const d: u8 = 2;
| --------------- constant defined here
...
LL | let d = 4;
| ^
| |
@ -41,6 +36,8 @@ LL | let d = 4;
| missing patterns are not covered because `d` is interpreted as a constant pattern, not a new variable
| help: introduce a variable instead: `d_var`
|
= 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: the matched value is of type `u8`
error: aborting due to 3 previous errors

View File

@ -19,7 +19,7 @@ LL | match &[][..] {
= note: the matched value is of type `&[E]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ E_SL => {}
LL ~ E_SL => {},
LL + &_ => todo!()
|

View File

@ -7,7 +7,6 @@ fn main() {
match 1 {
NUM => unimplemented!(),
//~^ ERROR could not evaluate constant pattern
//~| ERROR could not evaluate constant pattern
_ => unimplemented!(),
}
}

View File

@ -12,12 +12,6 @@ error: could not evaluate constant pattern
LL | NUM => unimplemented!(),
| ^^^
error: could not evaluate constant pattern
--> $DIR/issue-43105.rs:8:9
|
LL | NUM => unimplemented!(),
| ^^^
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0015`.

View File

@ -19,7 +19,6 @@ impl<T: 'static> GetTypeId<T> {
const fn check_type_id<T: 'static>() -> bool {
matches!(GetTypeId::<T>::VALUE, GetTypeId::<T>::VALUE)
//~^ ERROR constant pattern depends on a generic parameter
//~| ERROR constant pattern depends on a generic parameter
}
pub struct GetTypeNameLen<T>(T);
@ -31,7 +30,6 @@ impl<T: 'static> GetTypeNameLen<T> {
const fn check_type_name_len<T: 'static>() -> bool {
matches!(GetTypeNameLen::<T>::VALUE, GetTypeNameLen::<T>::VALUE)
//~^ ERROR constant pattern depends on a generic parameter
//~| ERROR constant pattern depends on a generic parameter
}
fn main() {

View File

@ -5,22 +5,10 @@ LL | matches!(GetTypeId::<T>::VALUE, GetTypeId::<T>::VALUE)
| ^^^^^^^^^^^^^^^^^^^^^
error: constant pattern depends on a generic parameter
--> $DIR/issue-73976-polymorphic.rs:32:42
--> $DIR/issue-73976-polymorphic.rs:31:42
|
LL | matches!(GetTypeNameLen::<T>::VALUE, GetTypeNameLen::<T>::VALUE)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: constant pattern depends on a generic parameter
--> $DIR/issue-73976-polymorphic.rs:20:37
|
LL | matches!(GetTypeId::<T>::VALUE, GetTypeId::<T>::VALUE)
| ^^^^^^^^^^^^^^^^^^^^^
error: constant pattern depends on a generic parameter
--> $DIR/issue-73976-polymorphic.rs:32:42
|
LL | matches!(GetTypeNameLen::<T>::VALUE, GetTypeNameLen::<T>::VALUE)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 4 previous errors
error: aborting due to 2 previous errors

View File

@ -6,5 +6,4 @@ const FOO: *const u32 = {
fn main() {
let FOO = FOO;
//~^ ERROR could not evaluate constant pattern
//~| ERROR could not evaluate constant pattern
}

View File

@ -17,12 +17,6 @@ error: could not evaluate constant pattern
LL | let FOO = FOO;
| ^^^
error: could not evaluate constant pattern
--> $DIR/issue-78655.rs:7:9
|
LL | let FOO = FOO;
| ^^^
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0381`.

View File

@ -11,7 +11,6 @@ impl<T> GetVariantCount<T> {
const fn check_variant_count<T>() -> bool {
matches!(GetVariantCount::<T>::VALUE, GetVariantCount::<T>::VALUE)
//~^ ERROR constant pattern depends on a generic parameter
//~| ERROR constant pattern depends on a generic parameter
}
fn main() {

View File

@ -4,11 +4,5 @@ error: constant pattern depends on a generic parameter
LL | matches!(GetVariantCount::<T>::VALUE, GetVariantCount::<T>::VALUE)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: constant pattern depends on a generic parameter
--> $DIR/issue-79137-toogeneric.rs:12:43
|
LL | matches!(GetVariantCount::<T>::VALUE, GetVariantCount::<T>::VALUE)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
error: aborting due to previous error

View File

@ -27,7 +27,7 @@ LL | const U8_MUT: &u8 = {
}
error: could not evaluate constant pattern
--> $DIR/const_refers_to_static_cross_crate.rs:43:9
--> $DIR/const_refers_to_static_cross_crate.rs:42:9
|
LL | U8_MUT => true,
| ^^^^^^
@ -39,7 +39,7 @@ LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
error: could not evaluate constant pattern
--> $DIR/const_refers_to_static_cross_crate.rs:54:9
--> $DIR/const_refers_to_static_cross_crate.rs:52:9
|
LL | U8_MUT2 => true,
| ^^^^^^^
@ -51,31 +51,7 @@ LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None =>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
error: could not evaluate constant pattern
--> $DIR/const_refers_to_static_cross_crate.rs:62:9
|
LL | U8_MUT3 => true,
| ^^^^^^^
error: could not evaluate constant pattern
--> $DIR/const_refers_to_static_cross_crate.rs:34:9
|
LL | SLICE_MUT => true,
| ^^^^^^^^^
error: could not evaluate constant pattern
--> $DIR/const_refers_to_static_cross_crate.rs:43:9
|
LL | U8_MUT => true,
| ^^^^^^
error: could not evaluate constant pattern
--> $DIR/const_refers_to_static_cross_crate.rs:54:9
|
LL | U8_MUT2 => true,
| ^^^^^^^
error: could not evaluate constant pattern
--> $DIR/const_refers_to_static_cross_crate.rs:62:9
--> $DIR/const_refers_to_static_cross_crate.rs:59:9
|
LL | U8_MUT3 => true,
| ^^^^^^^
@ -133,6 +109,6 @@ help: skipping check that does not even have a feature gate
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 12 previous errors; 1 warning emitted
error: aborting due to 8 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0080`.

View File

@ -27,7 +27,7 @@ LL | const U8_MUT: &u8 = {
}
error: could not evaluate constant pattern
--> $DIR/const_refers_to_static_cross_crate.rs:43:9
--> $DIR/const_refers_to_static_cross_crate.rs:42:9
|
LL | U8_MUT => true,
| ^^^^^^
@ -39,7 +39,7 @@ LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
error: could not evaluate constant pattern
--> $DIR/const_refers_to_static_cross_crate.rs:54:9
--> $DIR/const_refers_to_static_cross_crate.rs:52:9
|
LL | U8_MUT2 => true,
| ^^^^^^^
@ -51,31 +51,7 @@ LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None =>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
error: could not evaluate constant pattern
--> $DIR/const_refers_to_static_cross_crate.rs:62:9
|
LL | U8_MUT3 => true,
| ^^^^^^^
error: could not evaluate constant pattern
--> $DIR/const_refers_to_static_cross_crate.rs:34:9
|
LL | SLICE_MUT => true,
| ^^^^^^^^^
error: could not evaluate constant pattern
--> $DIR/const_refers_to_static_cross_crate.rs:43:9
|
LL | U8_MUT => true,
| ^^^^^^
error: could not evaluate constant pattern
--> $DIR/const_refers_to_static_cross_crate.rs:54:9
|
LL | U8_MUT2 => true,
| ^^^^^^^
error: could not evaluate constant pattern
--> $DIR/const_refers_to_static_cross_crate.rs:62:9
--> $DIR/const_refers_to_static_cross_crate.rs:59:9
|
LL | U8_MUT3 => true,
| ^^^^^^^
@ -133,6 +109,6 @@ help: skipping check that does not even have a feature gate
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 12 previous errors; 1 warning emitted
error: aborting due to 8 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0080`.

View File

@ -33,7 +33,6 @@ pub fn test(x: &[u8; 1]) -> bool {
match x {
SLICE_MUT => true,
//~^ ERROR could not evaluate constant pattern
//~| ERROR could not evaluate constant pattern
&[1..] => false,
}
}
@ -42,7 +41,6 @@ pub fn test2(x: &u8) -> bool {
match x {
U8_MUT => true,
//~^ ERROR could not evaluate constant pattern
//~| ERROR could not evaluate constant pattern
&(1..) => false,
}
}
@ -53,7 +51,6 @@ pub fn test3(x: &u8) -> bool {
match x {
U8_MUT2 => true,
//~^ ERROR could not evaluate constant pattern
//~| ERROR could not evaluate constant pattern
&(1..) => false,
}
}
@ -61,7 +58,6 @@ pub fn test4(x: &u8) -> bool {
match x {
U8_MUT3 => true,
//~^ ERROR could not evaluate constant pattern
//~| ERROR could not evaluate constant pattern
&(1..) => false,
}
}

View File

@ -14,7 +14,7 @@ LL | HastaLaVistaBaby,
= note: the matched value is of type `Terminator`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ Terminator::TalkToMyHand => {}
LL ~ Terminator::TalkToMyHand => {},
LL + Terminator::HastaLaVistaBaby => todo!()
|

View File

@ -4,6 +4,5 @@ fn main() {
match 5u32 {
1000 ..= 5 => {}
//~^ ERROR lower range bound must be less than or equal to upper
//~| ERROR lower range bound must be less than or equal to upper
}
}

View File

@ -6,12 +6,6 @@ LL | 1000 ..= 5 => {}
|
= note: When matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range.
error[E0030]: lower range bound must be less than or equal to upper
--> $DIR/E0030-teach.rs:5:9
|
LL | 1000 ..= 5 => {}
| ^^^^ lower bound larger than upper bound
error: aborting due to 2 previous errors
error: aborting due to previous error
For more information about this error, try `rustc --explain E0030`.

View File

@ -2,6 +2,5 @@ fn main() {
match 5u32 {
1000 ..= 5 => {}
//~^ ERROR lower range bound must be less than or equal to upper
//~| ERROR lower range bound must be less than or equal to upper
}
}

View File

@ -4,12 +4,6 @@ error[E0030]: lower range bound must be less than or equal to upper
LL | 1000 ..= 5 => {}
| ^^^^ lower bound larger than upper bound
error[E0030]: lower range bound must be less than or equal to upper
--> $DIR/E0030.rs:3:9
|
LL | 1000 ..= 5 => {}
| ^^^^ lower bound larger than upper bound
error: aborting due to 2 previous errors
error: aborting due to previous error
For more information about this error, try `rustc --explain E0030`.

View File

@ -115,7 +115,7 @@ LL | A, B, C,
= note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ Foo::B => {}
LL ~ Foo::B => {},
LL + Foo::C => todo!()
|

View File

@ -9,7 +9,7 @@ LL | match 0usize {
= 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ 0..=usize::MAX => {}
LL ~ 0..=usize::MAX => {},
LL + _ => todo!()
|
@ -24,7 +24,7 @@ LL | match 0isize {
= 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ isize::MIN..=isize::MAX => {}
LL ~ isize::MIN..=isize::MAX => {},
LL + _ => todo!()
|

View File

@ -10,44 +10,31 @@ macro_rules! m {
fn main() {
m!(0, ..u8::MIN);
//~^ ERROR lower range bound must be less than upper
//~| ERROR lower range bound must be less than upper
m!(0, ..u16::MIN);
//~^ ERROR lower range bound must be less than upper
//~| ERROR lower range bound must be less than upper
m!(0, ..u32::MIN);
//~^ ERROR lower range bound must be less than upper
//~| ERROR lower range bound must be less than upper
m!(0, ..u64::MIN);
//~^ ERROR lower range bound must be less than upper
//~| ERROR lower range bound must be less than upper
m!(0, ..u128::MIN);
//~^ ERROR lower range bound must be less than upper
//~| ERROR lower range bound must be less than upper
m!(0, ..i8::MIN);
//~^ ERROR lower range bound must be less than upper
//~| ERROR lower range bound must be less than upper
m!(0, ..i16::MIN);
//~^ ERROR lower range bound must be less than upper
//~| ERROR lower range bound must be less than upper
m!(0, ..i32::MIN);
//~^ ERROR lower range bound must be less than upper
//~| ERROR lower range bound must be less than upper
m!(0, ..i64::MIN);
//~^ ERROR lower range bound must be less than upper
//~| ERROR lower range bound must be less than upper
m!(0, ..i128::MIN);
//~^ ERROR lower range bound must be less than upper
//~| ERROR lower range bound must be less than upper
m!(0f32, ..f32::NEG_INFINITY);
//~^ ERROR lower range bound must be less than upper
//~| ERROR lower range bound must be less than upper
m!(0f64, ..f64::NEG_INFINITY);
//~^ ERROR lower range bound must be less than upper
//~| ERROR lower range bound must be less than upper
m!('a', ..'\u{0}');
//~^ ERROR lower range bound must be less than upper
//~| ERROR lower range bound must be less than upper
}

View File

@ -5,155 +5,77 @@ LL | m!(0, ..u8::MIN);
| ^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:14:11
--> $DIR/half-open-range-pats-thir-lower-empty.rs:13:11
|
LL | m!(0, ..u16::MIN);
| ^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:17:11
--> $DIR/half-open-range-pats-thir-lower-empty.rs:15:11
|
LL | m!(0, ..u32::MIN);
| ^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:20:11
|
LL | m!(0, ..u64::MIN);
| ^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:23:11
|
LL | m!(0, ..u128::MIN);
| ^^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:27:11
|
LL | m!(0, ..i8::MIN);
| ^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:30:11
|
LL | m!(0, ..i16::MIN);
| ^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:33:11
|
LL | m!(0, ..i32::MIN);
| ^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:36:11
|
LL | m!(0, ..i64::MIN);
| ^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:39:11
|
LL | m!(0, ..i128::MIN);
| ^^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:43:14
|
LL | m!(0f32, ..f32::NEG_INFINITY);
| ^^^^^^^^^^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:46:14
|
LL | m!(0f64, ..f64::NEG_INFINITY);
| ^^^^^^^^^^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:50:13
|
LL | m!('a', ..'\u{0}');
| ^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:11:11
|
LL | m!(0, ..u8::MIN);
| ^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:14:11
|
LL | m!(0, ..u16::MIN);
| ^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:17:11
|
LL | m!(0, ..u32::MIN);
| ^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:20:11
|
LL | m!(0, ..u64::MIN);
| ^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:23:11
--> $DIR/half-open-range-pats-thir-lower-empty.rs:19:11
|
LL | m!(0, ..u128::MIN);
| ^^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:27:11
--> $DIR/half-open-range-pats-thir-lower-empty.rs:22:11
|
LL | m!(0, ..i8::MIN);
| ^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:30:11
--> $DIR/half-open-range-pats-thir-lower-empty.rs:24:11
|
LL | m!(0, ..i16::MIN);
| ^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:33:11
--> $DIR/half-open-range-pats-thir-lower-empty.rs:26:11
|
LL | m!(0, ..i32::MIN);
| ^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:36:11
--> $DIR/half-open-range-pats-thir-lower-empty.rs:28:11
|
LL | m!(0, ..i64::MIN);
| ^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:39:11
--> $DIR/half-open-range-pats-thir-lower-empty.rs:30:11
|
LL | m!(0, ..i128::MIN);
| ^^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:43:14
--> $DIR/half-open-range-pats-thir-lower-empty.rs:33:14
|
LL | m!(0f32, ..f32::NEG_INFINITY);
| ^^^^^^^^^^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:46:14
--> $DIR/half-open-range-pats-thir-lower-empty.rs:35:14
|
LL | m!(0f64, ..f64::NEG_INFINITY);
| ^^^^^^^^^^^^^^^^^^^
error[E0579]: lower range bound must be less than upper
--> $DIR/half-open-range-pats-thir-lower-empty.rs:50:13
--> $DIR/half-open-range-pats-thir-lower-empty.rs:38:13
|
LL | m!('a', ..'\u{0}');
| ^^^^^^^^^
error: aborting due to 26 previous errors
error: aborting due to 13 previous errors
For more information about this error, try `rustc --explain E0579`.

View File

@ -29,6 +29,11 @@ note: ...which requires building MIR for `cycle1`...
|
LL | fn cycle1() -> impl Clone {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires match-checking `cycle1`...
--> $DIR/auto-trait-leak.rs:12:1
|
LL | fn cycle1() -> impl Clone {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires building THIR for `cycle1`...
--> $DIR/auto-trait-leak.rs:12:1
|
@ -70,6 +75,11 @@ note: ...which requires building MIR for `cycle2`...
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires match-checking `cycle2`...
--> $DIR/auto-trait-leak.rs:19:1
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires building THIR for `cycle2`...
--> $DIR/auto-trait-leak.rs:19:1
|

View File

@ -7,7 +7,6 @@ fn foo<const V: usize>() {
match 0 {
const { V } => {},
//~^ ERROR constant pattern depends on a generic parameter
//~| ERROR constant pattern depends on a generic parameter
_ => {},
}
}
@ -20,7 +19,6 @@ fn bar<const V: usize>() {
match 0 {
const { f(V) } => {},
//~^ ERROR constant pattern depends on a generic parameter
//~| ERROR constant pattern depends on a generic parameter
_ => {},
}
}

View File

@ -5,22 +5,10 @@ LL | const { V } => {},
| ^^^^^^^^^^^
error: constant pattern depends on a generic parameter
--> $DIR/const-match-pat-generic.rs:21:9
--> $DIR/const-match-pat-generic.rs:20:9
|
LL | const { f(V) } => {},
| ^^^^^^^^^^^^^^
error: constant pattern depends on a generic parameter
--> $DIR/const-match-pat-generic.rs:8:9
|
LL | const { V } => {},
| ^^^^^^^^^^^
error: constant pattern depends on a generic parameter
--> $DIR/const-match-pat-generic.rs:21:9
|
LL | const { f(V) } => {},
| ^^^^^^^^^^^^^^
error: aborting due to 4 previous errors
error: aborting due to 2 previous errors

View File

@ -3,22 +3,19 @@
fn main() {
match 5 {
6 ..= 1 => { }
//~^ ERROR lower range bound must be less than or equal to upper
_ => { }
};
//~^^^ ERROR lower range bound must be less than or equal to upper
//~| ERROR lower range bound must be less than or equal to upper
match 5 {
0 .. 0 => { }
//~^ ERROR lower range bound must be less than upper
_ => { }
};
//~^^^ ERROR lower range bound must be less than upper
//~| ERROR lower range bound must be less than upper
match 5u64 {
0xFFFF_FFFF_FFFF_FFFF ..= 1 => { }
//~^ ERROR lower range bound must be less than or equal to upper
_ => { }
};
//~^^^ ERROR lower range bound must be less than or equal to upper
//~| ERROR lower range bound must be less than or equal to upper
}

View File

@ -5,36 +5,18 @@ LL | 6 ..= 1 => { }
| ^ lower bound larger than upper bound
error[E0579]: lower range bound must be less than upper
--> $DIR/match-range-fail-2.rs:12:9
--> $DIR/match-range-fail-2.rs:11:9
|
LL | 0 .. 0 => { }
| ^
error[E0030]: lower range bound must be less than or equal to upper
--> $DIR/match-range-fail-2.rs:19:9
--> $DIR/match-range-fail-2.rs:17:9
|
LL | 0xFFFF_FFFF_FFFF_FFFF ..= 1 => { }
| ^^^^^^^^^^^^^^^^^^^^^ lower bound larger than upper bound
error[E0030]: lower range bound must be less than or equal to upper
--> $DIR/match-range-fail-2.rs:5:9
|
LL | 6 ..= 1 => { }
| ^ lower bound larger than upper bound
error[E0579]: lower range bound must be less than upper
--> $DIR/match-range-fail-2.rs:12:9
|
LL | 0 .. 0 => { }
| ^
error[E0030]: lower range bound must be less than or equal to upper
--> $DIR/match-range-fail-2.rs:19:9
|
LL | 0xFFFF_FFFF_FFFF_FFFF ..= 1 => { }
| ^^^^^^^^^^^^^^^^^^^^^ lower bound larger than upper bound
error: aborting due to 6 previous errors
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0030, E0579.
For more information about an error, try `rustc --explain E0030`.

View File

@ -17,8 +17,8 @@ LL | B(inner::Wrapper<B>),
= note: the matched value is of type `Either<(), !>`
help: you might want to use `if let` to ignore the variant that isn't matched
|
LL | if let Either::A(()) = foo() { todo!() }
| ++ ~~~~~~~~~~~
LL | if let Either::A(()) = foo() { todo!() };
| ++ +++++++++++
error: aborting due to previous error

View File

@ -7,7 +7,7 @@ LL | match (0u8, 0u8) {
= note: the matched value is of type `(u8, u8)`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ (0 | 1, 2 | 3) => {}
LL ~ (0 | 1, 2 | 3) => {},
LL + (2_u8..=u8::MAX, _) => todo!()
|
@ -20,7 +20,7 @@ LL | match ((0u8,),) {
= note: the matched value is of type `((u8,),)`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ ((0 | 1,) | (2 | 3,),) => {}
LL ~ ((0 | 1,) | (2 | 3,),) => {},
LL + ((4_u8..=u8::MAX)) => todo!()
|
@ -33,7 +33,7 @@ LL | match (Some(0u8),) {
= note: the matched value is of type `(Option<u8>,)`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ (None | Some(0 | 1),) => {}
LL ~ (None | Some(0 | 1),) => {},
LL + (Some(2_u8..=u8::MAX)) => todo!()
|

View File

@ -9,8 +9,8 @@ LL | let (0 | (1 | 2)) = 0;
= note: the matched value is of type `i32`
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | if let (0 | (1 | 2)) = 0 { todo!() }
| ++ ~~~~~~~~~~~
LL | if let (0 | (1 | 2)) = 0 { todo!() };
| ++ +++++++++++
error[E0004]: non-exhaustive patterns: `i32::MIN..=-1_i32` and `3_i32..=i32::MAX` not covered
--> $DIR/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs:3:11
@ -21,7 +21,7 @@ LL | match 0 {
= note: the matched value is of type `i32`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ 0 | (1 | 2) => {}
LL ~ 0 | (1 | 2) => {},
LL + i32::MIN..=-1_i32 | 3_i32..=i32::MAX => todo!()
|

View File

@ -2,18 +2,16 @@ error: cannot move out of value because it is borrowed
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:12:14
|
LL | Some(ref _y @ _z) => {}
| ------^^^--
| | |
| | value is moved into `_z` here
| ^^^^^^ -- value is moved into `_z` here
| |
| value is borrowed by `_y` here
error: borrow of moved value
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:19:14
|
LL | Some(_z @ ref _y) => {}
| --^^^------
| | |
| | value borrowed here after move
| ^^ ------ value borrowed here after move
| |
| value moved into `_z` here
| move occurs because `_z` has type `X` which does not implement the `Copy` trait
|
@ -26,18 +24,16 @@ error: cannot move out of value because it is borrowed
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:26:14
|
LL | Some(ref mut _y @ _z) => {}
| ----------^^^--
| | |
| | value is moved into `_z` here
| ^^^^^^^^^^ -- value is moved into `_z` here
| |
| value is mutably borrowed by `_y` here
error: borrow of moved value
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:33:14
|
LL | Some(_z @ ref mut _y) => {}
| --^^^----------
| | |
| | value borrowed here after move
| ^^ ---------- value borrowed here after move
| |
| value moved into `_z` here
| move occurs because `_z` has type `X` which does not implement the `Copy` trait
|

View File

@ -2,72 +2,64 @@ error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-at-and-box.rs:31:9
|
LL | let ref a @ box b = Box::new(NC);
| -----^^^^^^^-
| | |
| | value is moved into `b` here
| ^^^^^ - value is moved into `b` here
| |
| value is borrowed by `a` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-at-and-box.rs:34:9
|
LL | let ref a @ box ref mut b = Box::new(nc());
| -----^^^^^^^---------
| | |
| | value is mutably borrowed by `b` here
| ^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is borrowed by `a` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-at-and-box.rs:36:9
|
LL | let ref a @ box ref mut b = Box::new(NC);
| -----^^^^^^^---------
| | |
| | value is mutably borrowed by `b` here
| ^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is borrowed by `a` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-at-and-box.rs:38:9
|
LL | let ref a @ box ref mut b = Box::new(NC);
| -----^^^^^^^---------
| | |
| | value is mutably borrowed by `b` here
| ^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is borrowed by `a` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-at-and-box.rs:42:9
|
LL | let ref a @ box ref mut b = Box::new(NC);
| -----^^^^^^^---------
| | |
| | value is mutably borrowed by `b` here
| ^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is borrowed by `a` here
error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-at-and-box.rs:48:9
|
LL | let ref mut a @ box ref b = Box::new(NC);
| ---------^^^^^^^-----
| | |
| | value is borrowed by `b` here
| ^^^^^^^^^ ----- value is borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-at-and-box.rs:62:9
|
LL | ref mut a @ box ref b => {
| ---------^^^^^^^-----
| | |
| | value is borrowed by `b` here
| ^^^^^^^^^ ----- value is borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-at-and-box.rs:54:11
|
LL | fn f5(ref mut a @ box ref b: Box<NC>) {
| ---------^^^^^^^-----
| | |
| | value is borrowed by `b` here
| ^^^^^^^^^ ----- value is borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error[E0382]: borrow of moved value

View File

@ -2,9 +2,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse-promotion.rs:6:9
|
LL | let a @ ref b = U;
| -^^^-----
| | |
| | value borrowed here after move
| ^ ----- value borrowed here after move
| |
| value moved into `a` here
| move occurs because `a` has type `U` which does not implement the `Copy` trait
|

View File

@ -2,9 +2,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:22:9
|
LL | let a @ ref b = U;
| -^^^-----
| | |
| | value borrowed here after move
| ^ ----- value borrowed here after move
| |
| value moved into `a` here
| move occurs because `a` has type `U` which does not implement the `Copy` trait
|
@ -17,9 +16,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:9
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U);
| -^^^^^^^^^^^^---------^^^^^^-----^
| | | |
| | | value borrowed here after move
| ^ --------- ----- value borrowed here after move
| | |
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait
@ -33,9 +31,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:14
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U);
| -----^^^---------
| | |
| | value borrowed here after move
| ^^^^^ --------- value borrowed here after move
| |
| value moved into `b` here
| move occurs because `b` has type `U` which does not implement the `Copy` trait
|
@ -48,9 +45,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:33
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U);
| -^^^-----
| | |
| | value borrowed here after move
| ^ ----- value borrowed here after move
| |
| value moved into `d` here
| move occurs because `d` has type `U` which does not implement the `Copy` trait
|
@ -63,9 +59,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:29:9
|
LL | let a @ [ref mut b, ref c] = [U, U];
| -^^^^---------^^-----^
| | | |
| | | value borrowed here after move
| ^ --------- ----- value borrowed here after move
| | |
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait
@ -79,9 +74,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:31:9
|
LL | let a @ ref b = u();
| -^^^-----
| | |
| | value borrowed here after move
| ^ ----- value borrowed here after move
| |
| value moved into `a` here
| move occurs because `a` has type `U` which does not implement the `Copy` trait
|
@ -94,9 +88,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:9
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u());
| -^^^^^^^^^^^^---------^^^^^^-----^
| | | |
| | | value borrowed here after move
| ^ --------- ----- value borrowed here after move
| | |
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait
@ -110,9 +103,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:14
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u());
| -----^^^---------
| | |
| | value borrowed here after move
| ^^^^^ --------- value borrowed here after move
| |
| value moved into `b` here
| move occurs because `b` has type `U` which does not implement the `Copy` trait
|
@ -125,9 +117,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:33
|
LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u());
| -^^^-----
| | |
| | value borrowed here after move
| ^ ----- value borrowed here after move
| |
| value moved into `d` here
| move occurs because `d` has type `U` which does not implement the `Copy` trait
|
@ -140,9 +131,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:38:9
|
LL | let a @ [ref mut b, ref c] = [u(), u()];
| -^^^^---------^^-----^
| | | |
| | | value borrowed here after move
| ^ --------- ----- value borrowed here after move
| | |
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait
@ -156,9 +146,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:42:9
|
LL | a @ Some(ref b) => {}
| -^^^^^^^^-----^
| | |
| | value borrowed here after move
| ^ ----- value borrowed here after move
| |
| value moved into `a` here
| move occurs because `a` has type `Option<U>` which does not implement the `Copy` trait
|
@ -171,9 +160,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:47:9
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -^^^^^^^^^^^^^^^^^---------^^^^^^-----^^
| | | |
| | | value borrowed here after move
| ^ --------- ----- value borrowed here after move
| | |
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `Option<(U, U)>` which does not implement the `Copy` trait
@ -187,9 +175,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:47:19
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -----^^^---------
| | |
| | value borrowed here after move
| ^^^^^ --------- value borrowed here after move
| |
| value moved into `b` here
| move occurs because `b` has type `U` which does not implement the `Copy` trait
|
@ -202,9 +189,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:47:38
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -^^^-----
| | |
| | value borrowed here after move
| ^ ----- value borrowed here after move
| |
| value moved into `d` here
| move occurs because `d` has type `U` which does not implement the `Copy` trait
|
@ -217,9 +203,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:55:9
|
LL | mut a @ Some([ref b, ref mut c]) => {}
| -----^^^^^^^^^-----^^---------^^
| | | |
| | | value borrowed here after move
| ^^^^^ ----- --------- value borrowed here after move
| | |
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `Option<[U; 2]>` which does not implement the `Copy` trait
@ -233,9 +218,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:61:9
|
LL | a @ Some(ref b) => {}
| -^^^^^^^^-----^
| | |
| | value borrowed here after move
| ^ ----- value borrowed here after move
| |
| value moved into `a` here
| move occurs because `a` has type `Option<U>` which does not implement the `Copy` trait
|
@ -248,9 +232,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:67:9
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -^^^^^^^^^^^^^^^^^---------^^^^^^-----^^
| | | |
| | | value borrowed here after move
| ^ --------- ----- value borrowed here after move
| | |
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `Option<(U, U)>` which does not implement the `Copy` trait
@ -264,9 +247,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:67:19
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -----^^^---------
| | |
| | value borrowed here after move
| ^^^^^ --------- value borrowed here after move
| |
| value moved into `b` here
| move occurs because `b` has type `U` which does not implement the `Copy` trait
|
@ -279,9 +261,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:67:38
|
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -^^^-----
| | |
| | value borrowed here after move
| ^ ----- value borrowed here after move
| |
| value moved into `d` here
| move occurs because `d` has type `U` which does not implement the `Copy` trait
|
@ -294,9 +275,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:75:9
|
LL | mut a @ Some([ref b, ref mut c]) => {}
| -----^^^^^^^^^-----^^---------^^
| | | |
| | | value borrowed here after move
| ^^^^^ ----- --------- value borrowed here after move
| | |
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `Option<[U; 2]>` which does not implement the `Copy` trait
@ -310,9 +290,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:11:11
|
LL | fn f1(a @ ref b: U) {}
| -^^^-----
| | |
| | value borrowed here after move
| ^ ----- value borrowed here after move
| |
| value moved into `a` here
| move occurs because `a` has type `U` which does not implement the `Copy` trait
|
@ -325,9 +304,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:11
|
LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {}
| -----^^^^^^^^-----^^^^^^^^^^-----^
| | | |
| | | value borrowed here after move
| ^^^^^ ----- ----- value borrowed here after move
| | |
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait
@ -341,9 +319,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:20
|
LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {}
| -^^^-----
| | |
| | value borrowed here after move
| ^ ----- value borrowed here after move
| |
| value moved into `b` here
| move occurs because `b` has type `U` which does not implement the `Copy` trait
|
@ -356,9 +333,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:31
|
LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {}
| -----^^^-----
| | |
| | value borrowed here after move
| ^^^^^ ----- value borrowed here after move
| |
| value moved into `d` here
| move occurs because `d` has type `U` which does not implement the `Copy` trait
|
@ -371,9 +347,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:19:11
|
LL | fn f3(a @ [ref mut b, ref c]: [U; 2]) {}
| -^^^^---------^^-----^
| | | |
| | | value borrowed here after move
| ^ --------- ----- value borrowed here after move
| | |
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait

View File

@ -2,18 +2,16 @@ error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:24:9
|
LL | let ref a @ b = U;
| -----^^^-
| | |
| | value is moved into `b` here
| ^^^^^ - value is moved into `b` here
| |
| value is borrowed by `a` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:26:9
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U);
| -----^^^^^^^^^^^^-----^^^^^^^^^^-^
| | | |
| | | value is moved into `e` here
| ^^^^^ ----- - value is moved into `e` here
| | |
| | value is moved into `c` here
| value is borrowed by `a` here
@ -21,27 +19,24 @@ error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:26:18
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U);
| -----^^^-----
| | |
| | value is moved into `c` here
| ^^^^^ ----- value is moved into `c` here
| |
| value is borrowed by `b` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:26:33
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U);
| -----^^^-
| | |
| | value is moved into `e` here
| ^^^^^ - value is moved into `e` here
| |
| value is borrowed by `d` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:30:9
|
LL | let ref mut a @ [b, mut c] = [U, U];
| ---------^^^^-^^-----^
| | | |
| | | value is moved into `c` here
| ^^^^^^^^^ - ----- value is moved into `c` here
| | |
| | value is moved into `b` here
| value is mutably borrowed by `a` here
@ -49,18 +44,16 @@ error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:33:9
|
LL | let ref a @ b = u();
| -----^^^-
| | |
| | value is moved into `b` here
| ^^^^^ - value is moved into `b` here
| |
| value is borrowed by `a` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:36:9
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
| -----^^^^^^^^^^^^-----^^^^^^^^^^-^
| | | |
| | | value is moved into `e` here
| ^^^^^ ----- - value is moved into `e` here
| | |
| | value is moved into `c` here
| value is borrowed by `a` here
@ -68,27 +61,24 @@ error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:36:18
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
| -----^^^-----
| | |
| | value is moved into `c` here
| ^^^^^ ----- value is moved into `c` here
| |
| value is borrowed by `b` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:36:33
|
LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
| -----^^^-
| | |
| | value is moved into `e` here
| ^^^^^ - value is moved into `e` here
| |
| value is borrowed by `d` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:42:9
|
LL | let ref mut a @ [b, mut c] = [u(), u()];
| ---------^^^^-^^-----^
| | | |
| | | value is moved into `c` here
| ^^^^^^^^^ - ----- value is moved into `c` here
| | |
| | value is moved into `b` here
| value is mutably borrowed by `a` here
@ -96,18 +86,16 @@ error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:47:9
|
LL | ref a @ Some(b) => {}
| -----^^^^^^^^-^
| | |
| | value is moved into `b` here
| ^^^^^ - value is moved into `b` here
| |
| value is borrowed by `a` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:52:9
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^^^^^^^^^^^^^^^-----^^^^^^^^^^-^^
| | | |
| | | value is moved into `e` here
| ^^^^^ ----- - value is moved into `e` here
| | |
| | value is moved into `c` here
| value is borrowed by `a` here
@ -115,27 +103,24 @@ error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:52:23
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^-----
| | |
| | value is moved into `c` here
| ^^^^^ ----- value is moved into `c` here
| |
| value is borrowed by `b` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:52:38
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^-
| | |
| | value is moved into `e` here
| ^^^^^ - value is moved into `e` here
| |
| value is borrowed by `d` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:59:9
|
LL | ref mut a @ Some([b, mut c]) => {}
| ---------^^^^^^^^^-^^-----^^
| | | |
| | | value is moved into `c` here
| ^^^^^^^^^ - ----- value is moved into `c` here
| | |
| | value is moved into `b` here
| value is mutably borrowed by `a` here
@ -143,18 +128,16 @@ error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:64:9
|
LL | ref a @ Some(b) => {}
| -----^^^^^^^^-^
| | |
| | value is moved into `b` here
| ^^^^^ - value is moved into `b` here
| |
| value is borrowed by `a` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:69:9
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^^^^^^^^^^^^^^^-----^^^^^^^^^^-^^
| | | |
| | | value is moved into `e` here
| ^^^^^ ----- - value is moved into `e` here
| | |
| | value is moved into `c` here
| value is borrowed by `a` here
@ -162,27 +145,24 @@ error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:69:23
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^-----
| | |
| | value is moved into `c` here
| ^^^^^ ----- value is moved into `c` here
| |
| value is borrowed by `b` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:69:38
|
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| -----^^^-
| | |
| | value is moved into `e` here
| ^^^^^ - value is moved into `e` here
| |
| value is borrowed by `d` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:78:9
|
LL | ref mut a @ Some([b, mut c]) => {}
| ---------^^^^^^^^^-^^-----^^
| | | |
| | | value is moved into `c` here
| ^^^^^^^^^ - ----- value is moved into `c` here
| | |
| | value is moved into `b` here
| value is mutably borrowed by `a` here
@ -190,18 +170,16 @@ error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:11:11
|
LL | fn f1(ref a @ b: U) {}
| -----^^^-
| | |
| | value is moved into `b` here
| ^^^^^ - value is moved into `b` here
| |
| value is borrowed by `a` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:14:11
|
LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
| -----^^^^^^^^^^^^-----^^^^^^^^^^-^
| | | |
| | | value is moved into `e` here
| ^^^^^ ----- - value is moved into `e` here
| | |
| | value is moved into `c` here
| value is borrowed by `a` here
@ -209,27 +187,24 @@ error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:14:20
|
LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
| -----^^^-----
| | |
| | value is moved into `c` here
| ^^^^^ ----- value is moved into `c` here
| |
| value is borrowed by `b` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:14:35
|
LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
| -----^^^-
| | |
| | value is moved into `e` here
| ^^^^^ - value is moved into `e` here
| |
| value is borrowed by `d` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-by-move-and-ref.rs:20:11
|
LL | fn f3(ref mut a @ [b, mut c]: [U; 2]) {}
| ---------^^^^-^^-----^
| | | |
| | | value is moved into `c` here
| ^^^^^^^^^ - ----- value is moved into `c` here
| | |
| | value is moved into `b` here
| value is mutably borrowed by `a` here

View File

@ -2,18 +2,16 @@ error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:8:9
|
LL | ref mut z @ &mut Some(ref a) => {
| ---------^^^^^^^^^^^^^-----^
| | |
| | value is borrowed by `a` here
| ^^^^^^^^^ ----- value is borrowed by `a` here
| |
| value is mutably borrowed by `z` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:33:9
|
LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub
| ---------^^^^-----------------^
| | | |
| | | value is mutably borrowed by `c` here
| ^^^^^^^^^ ----- --------- value is mutably borrowed by `c` here
| | |
| | value is borrowed by `b` here
| value is mutably borrowed by `a` here
@ -21,36 +19,32 @@ error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:33:22
|
LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub
| -----^^^---------
| | |
| | value is mutably borrowed by `c` here
| ^^^^^ --------- value is mutably borrowed by `c` here
| |
| value is borrowed by `b` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:37:9
|
LL | let ref a @ ref mut b = U;
| -----^^^---------
| | |
| | value is mutably borrowed by `b` here
| ^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is borrowed by `a` here
error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:39:9
|
LL | let ref mut a @ ref b = U;
| ---------^^^-----
| | |
| | value is borrowed by `b` here
| ^^^^^^^^^ ----- value is borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:41:9
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| -----^^^^---------^^---------^
| | | |
| | | value is mutably borrowed by `c` here
| ^^^^^ --------- --------- value is mutably borrowed by `c` here
| | |
| | value is mutably borrowed by `b` here
| value is borrowed by `a` here
@ -58,9 +52,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:43:9
|
LL | let ref mut a @ (ref b, ref c) = (U, U);
| ---------^^^^-----^^-----^
| | | |
| | | value is borrowed by `c` here
| ^^^^^^^^^ ----- ----- value is borrowed by `c` here
| | |
| | value is borrowed by `b` here
| value is mutably borrowed by `a` here
@ -68,153 +61,136 @@ error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:46:9
|
LL | let ref mut a @ ref b = u();
| ---------^^^-----
| | |
| | value is borrowed by `b` here
| ^^^^^^^^^ ----- value is borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:51:9
|
LL | let ref a @ ref mut b = u();
| -----^^^---------
| | |
| | value is mutably borrowed by `b` here
| ^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is borrowed by `a` here
error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:57:9
|
LL | let ref mut a @ ref b = U;
| ---------^^^-----
| | |
| | value is borrowed by `b` here
| ^^^^^^^^^ ----- value is borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:61:9
|
LL | let ref a @ ref mut b = U;
| -----^^^---------
| | |
| | value is mutably borrowed by `b` here
| ^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is borrowed by `a` here
error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:67:9
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => {
| ---------^^^^^^-----^
| | |
| | value is borrowed by `b` here
| ^^^^^^^^^ ----- value is borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:67:33
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => {
| ---------^^^^^^^-----^
| | |
| | value is borrowed by `b` here
| ^^^^^^^^^ ----- value is borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:9
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
| -----^^^^^^---------^
| | |
| | value is mutably borrowed by `b` here
| ^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is borrowed by `a` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:33
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
| -----^^^^^^^---------^
| | |
| | value is mutably borrowed by `b` here
| ^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is borrowed by `a` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:87:9
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
| -----^^^^^^---------^
| | |
| | value is mutably borrowed by `b` here
| ^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is borrowed by `a` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:87:33
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
| -----^^^^^^^---------^
| | |
| | value is mutably borrowed by `b` here
| ^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is borrowed by `a` here
error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:94:9
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
| ---------^^^^^^-----^
| | |
| | value is borrowed by `b` here
| ^^^^^^^^^ ----- value is borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:94:33
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
| ---------^^^^^^^-----^
| | |
| | value is borrowed by `b` here
| ^^^^^^^^^ ----- value is borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:101:9
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
| -----^^^^^^---------^
| | |
| | value is mutably borrowed by `b` here
| ^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is borrowed by `a` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:101:33
|
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
| -----^^^^^^^---------^
| | |
| | value is mutably borrowed by `b` here
| ^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is borrowed by `a` here
error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:109:9
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
| ---------^^^^^^-----^
| | |
| | value is borrowed by `b` here
| ^^^^^^^^^ ----- value is borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:109:33
|
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
| ---------^^^^^^^-----^
| | |
| | value is borrowed by `b` here
| ^^^^^^^^^ ----- value is borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:117:9
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| -----^^^^---------^^---------^
| | | |
| | | value is mutably borrowed by `c` here
| ^^^^^ --------- --------- value is mutably borrowed by `c` here
| | |
| | value is mutably borrowed by `b` here
| value is borrowed by `a` here
@ -222,9 +198,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:123:9
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| -----^^^^---------^^---------^
| | | |
| | | value is mutably borrowed by `c` here
| ^^^^^ --------- --------- value is mutably borrowed by `c` here
| | |
| | value is mutably borrowed by `b` here
| value is borrowed by `a` here
@ -232,9 +207,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:129:9
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| -----^^^^---------^^---------^
| | | |
| | | value is mutably borrowed by `c` here
| ^^^^^ --------- --------- value is mutably borrowed by `c` here
| | |
| | value is mutably borrowed by `b` here
| value is borrowed by `a` here
@ -242,9 +216,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:134:9
|
LL | let ref mut a @ (ref b, ref c) = (U, U);
| ---------^^^^-----^^-----^
| | | |
| | | value is borrowed by `c` here
| ^^^^^^^^^ ----- ----- value is borrowed by `c` here
| | |
| | value is borrowed by `b` here
| value is mutably borrowed by `a` here
@ -252,36 +225,32 @@ error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:22:11
|
LL | fn f1(ref a @ ref mut b: U) {}
| -----^^^---------
| | |
| | value is mutably borrowed by `b` here
| ^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is borrowed by `a` here
error: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:24:11
|
LL | fn f2(ref mut a @ ref b: U) {}
| ---------^^^-----
| | |
| | value is borrowed by `b` here
| ^^^^^^^^^ ----- value is borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:26:11
|
LL | fn f3(ref a @ [ref b, ref mut mid @ .., ref c]: [U; 4]) {}
| -----^^^^^^^^^^^----------------^^^^^^^^
| | |
| | value is mutably borrowed by `mid` here
| ^^^^^ ----------- value is mutably borrowed by `mid` here
| |
| value is borrowed by `a` here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:22
|
LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {}
| -----^^^-------------
| | | |
| | | value is moved into `c` here
| ^^^^^ --------- - value is moved into `c` here
| | |
| | value is mutably borrowed by `b` here
| value is borrowed by `a` here
@ -289,9 +258,8 @@ error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:30
|
LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {}
| ---------^^^-
| | |
| | value is moved into `c` here
| ^^^^^^^^^ - value is moved into `c` here
| |
| value is mutably borrowed by `b` here
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable

View File

@ -2,98 +2,80 @@ error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:26:9
|
LL | let ref mut a @ ref mut b = U;
| ---------^^^---------
| | |
| | value is mutably borrowed by `b` here
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:29:9
|
LL | let ref mut a @ ref mut b = U;
| ---------^^^---------
| | |
| | value is mutably borrowed by `b` here
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:33:9
|
LL | let ref mut a @ ref mut b = U;
| ---------^^^---------
| | |
| | value is mutably borrowed by `b` here
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:36:9
|
LL | let ref mut a @ ref mut b = U;
| ---------^^^---------
| | |
| | value is mutably borrowed by `b` here
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:39:9
|
LL | let ref mut a @ ref mut b = U;
| ---------^^^---------
| | |
| | value is mutably borrowed by `b` here
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:44:9
|
LL | let ref mut a @ (
| ^--------
| |
| _________value is mutably borrowed by `a` here
| |
LL | |
LL | | ref mut b,
| | --------- value is mutably borrowed by `b` here
LL | | [
LL | | ref mut c,
| | --------- value is mutably borrowed by `c` here
LL | | ref mut d,
| | --------- value is mutably borrowed by `d` here
LL | | ref e,
| | ----- value is borrowed by `e` here
LL | | ]
LL | | ) = (U, [U, U, U]);
| |_____^
LL | let ref mut a @ (
| ^^^^^^^^^ value is mutably borrowed by `a` here
LL |
LL | ref mut b,
| --------- value is mutably borrowed by `b` here
LL | [
LL | ref mut c,
| --------- value is mutably borrowed by `c` here
LL | ref mut d,
| --------- value is mutably borrowed by `d` here
LL | ref e,
| ----- value is borrowed by `e` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:54:9
|
LL | let ref mut a @ (
| ^--------
| |
| _________value is mutably borrowed by `a` here
| |
LL | |
LL | | ref mut b,
| | --------- value is mutably borrowed by `b` here
LL | | [
LL | | ref mut c,
| | --------- value is mutably borrowed by `c` here
LL | | ref mut d,
| | --------- value is mutably borrowed by `d` here
LL | | ref e,
| | ----- value is borrowed by `e` here
LL | | ]
LL | | ) = (u(), [u(), u(), u()]);
| |_________^
LL | let ref mut a @ (
| ^^^^^^^^^ value is mutably borrowed by `a` here
LL |
LL | ref mut b,
| --------- value is mutably borrowed by `b` here
LL | [
LL | ref mut c,
| --------- value is mutably borrowed by `c` here
LL | ref mut d,
| --------- value is mutably borrowed by `d` here
LL | ref e,
| ----- value is borrowed by `e` here
error: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:64:9
|
LL | let a @ (ref mut b, ref mut c) = (U, U);
| -^^^^---------^^---------^
| | | |
| | | value borrowed here after move
| ^ --------- --------- value borrowed here after move
| | |
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait
@ -107,9 +89,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:67:9
|
LL | let a @ (b, [c, d]) = &mut val; // Same as ^--
| -^^^^-^^^-^^-^^
| | | | |
| | | | value borrowed here after move
| ^ - - - value borrowed here after move
| | | |
| | | value borrowed here after move
| | value borrowed here after move
| value moved into `a` here
@ -124,9 +105,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:70:9
|
LL | let a @ &mut ref mut b = &mut U;
| -^^^^^^^^---------
| | |
| | value borrowed here after move
| ^ --------- value borrowed here after move
| |
| value moved into `a` here
| move occurs because `a` has type `&mut U` which does not implement the `Copy` trait
|
@ -139,9 +119,8 @@ error: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:72:9
|
LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U);
| -^^^^^^^^^---------^^---------^
| | | |
| | | value borrowed here after move
| ^ --------- --------- value borrowed here after move
| | |
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `&mut (U, U)` which does not implement the `Copy` trait
@ -155,117 +134,99 @@ error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:76:9
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^---------^
| | |
| | value is mutably borrowed by `b` here
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:76:37
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^^---------^
| | |
| | value is mutably borrowed by `b` here
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:82:9
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^---------^
| | |
| | value is mutably borrowed by `b` here
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:82:37
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^^---------^
| | |
| | value is mutably borrowed by `b` here
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:9
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^---------^
| | |
| | value is mutably borrowed by `b` here
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:37
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^^---------^
| | |
| | value is mutably borrowed by `b` here
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:9
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^---------^
| | |
| | value is mutably borrowed by `b` here
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:37
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------^^^^^^^---------^
| | |
| | value is mutably borrowed by `b` here
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:8:11
|
LL | fn f1(ref mut a @ ref mut b: U) {}
| ---------^^^---------
| | |
| | value is mutably borrowed by `b` here
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:10:11
|
LL | fn f2(ref mut a @ ref mut b: U) {}
| ---------^^^---------
| | |
| | value is mutably borrowed by `b` here
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:13:9
|
LL | ref mut a @ [
| ^--------
| |
| _________value is mutably borrowed by `a` here
| |
LL | |
LL | | [ref b @ .., _],
| | ---------- value is borrowed by `b` here
LL | | [_, ref mut mid @ ..],
| | ---------------- value is mutably borrowed by `mid` here
LL | | ..,
LL | | [..],
LL | | ] : [[U; 4]; 5]
| |_________^
LL | ref mut a @ [
| ^^^^^^^^^ value is mutably borrowed by `a` here
LL |
LL | [ref b @ .., _],
| ----- value is borrowed by `b` here
LL | [_, ref mut mid @ ..],
| ----------- value is mutably borrowed by `mid` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:22
|
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
| ---------^^^-------------
| | | |
| | | value is moved into `c` here
| ^^^^^^^^^ --------- - value is moved into `c` here
| | |
| | value is mutably borrowed by `b` here
| value is mutably borrowed by `a` here
@ -273,9 +234,8 @@ error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:34
|
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
| ---------^^^-
| | |
| | value is moved into `c` here
| ^^^^^^^^^ - value is moved into `c` here
| |
| value is mutably borrowed by `b` here
error[E0499]: cannot borrow value as mutable more than once at a time

View File

@ -2,36 +2,32 @@ error: cannot move out of value because it is borrowed
--> $DIR/default-binding-modes-both-sides-independent.rs:26:9
|
LL | let ref a @ b = NotCopy;
| -----^^^-
| | |
| | value is moved into `b` here
| ^^^^^ - value is moved into `b` here
| |
| value is borrowed by `a` here
error: cannot move out of value because it is borrowed
--> $DIR/default-binding-modes-both-sides-independent.rs:29:9
|
LL | let ref mut a @ b = NotCopy;
| ---------^^^-
| | |
| | value is moved into `b` here
| ^^^^^^^^^ - value is moved into `b` here
| |
| value is mutably borrowed by `a` here
error: cannot move out of value because it is borrowed
--> $DIR/default-binding-modes-both-sides-independent.rs:34:12
|
LL | Ok(ref a @ b) | Err(b @ ref a) => {
| -----^^^-
| | |
| | value is moved into `b` here
| ^^^^^ - value is moved into `b` here
| |
| value is borrowed by `a` here
error: borrow of moved value
--> $DIR/default-binding-modes-both-sides-independent.rs:34:29
|
LL | Ok(ref a @ b) | Err(b @ ref a) => {
| -^^^-----
| | |
| | value borrowed here after move
| ^ ----- value borrowed here after move
| |
| value moved into `b` here
| move occurs because `b` has type `NotCopy` which does not implement the `Copy` trait
|
@ -44,9 +40,8 @@ error: cannot move out of value because it is borrowed
--> $DIR/default-binding-modes-both-sides-independent.rs:42:9
|
LL | ref a @ b => {
| -----^^^-
| | |
| | value is moved into `b` here
| ^^^^^ - value is moved into `b` here
| |
| value is borrowed by `a` here
error[E0382]: borrow of moved value

View File

@ -9,8 +9,8 @@ LL | let 5 = 6;
= note: the matched value is of type `i32`
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | if let 5 = 6 { todo!() }
| ++ ~~~~~~~~~~~
LL | if let 5 = 6 { todo!() };
| ++ +++++++++++
help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
|
LL | let _5 = 6;
@ -20,7 +20,7 @@ error[E0005]: refutable pattern in local binding
--> $DIR/issue-106552.rs:5:9
|
LL | let x @ 5 = 6;
| ^^^^^ patterns `i32::MIN..=4_i32` and `6_i32..=i32::MAX` not covered
| ^ patterns `i32::MIN..=4_i32` and `6_i32..=i32::MAX` 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

View File

@ -1,15 +1,15 @@
error[E0158]: associated consts cannot be referenced in patterns
--> $DIR/issue-68393-let-pat-assoc-constant.rs:20:40
|
LL | pub fn test<A: Foo, B: Foo>(arg: EFoo, A::X: EFoo) {
| ^^^^
error[E0158]: associated consts cannot be referenced in patterns
--> $DIR/issue-68393-let-pat-assoc-constant.rs:22:9
|
LL | let A::X = arg;
| ^^^^
error[E0158]: associated consts cannot be referenced in patterns
--> $DIR/issue-68393-let-pat-assoc-constant.rs:20:40
|
LL | pub fn test<A: Foo, B: Foo>(arg: EFoo, A::X: EFoo) {
| ^^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0158`.

View File

@ -4,7 +4,7 @@ fn main() {
match Some(1) { //~ ERROR non-exhaustive patterns: `None` not covered
Some(1) => {}
// hello
Some(_) => {}
Some(_) => {},
None => todo!()
}
}

View File

@ -12,7 +12,7 @@ note: `Option<i32>` defined here
= note: the matched value is of type `Option<i32>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ Some(_) => {}
LL ~ Some(_) => {},
LL + None => todo!()
|

View File

@ -7,21 +7,6 @@ LL | FOO => {}
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: unreachable pattern
--> $DIR/consts-opaque.rs:32:9
|
LL | FOO => {}
| --- matches any value
LL |
LL | _ => {} // should not be emitting unreachable warning
| ^ unreachable pattern
|
note: the lint level is defined here
--> $DIR/consts-opaque.rs:6:9
|
LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:37:9
|
@ -31,15 +16,6 @@ LL | FOO_REF => {}
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: unreachable pattern
--> $DIR/consts-opaque.rs:39:9
|
LL | FOO_REF => {}
| ------- matches any value
LL |
LL | Foo(_) => {} // should not be emitting unreachable warning
| ^^^^^^ unreachable pattern
warning: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:45:9
|
@ -61,23 +37,6 @@ LL | BAR => {} // should not be emitting unreachable warning
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: unreachable pattern
--> $DIR/consts-opaque.rs:53:9
|
LL | Bar => {}
| --- matches any value
LL | BAR => {} // should not be emitting unreachable warning
| ^^^ unreachable pattern
error: unreachable pattern
--> $DIR/consts-opaque.rs:56:9
|
LL | Bar => {}
| --- matches any value
...
LL | _ => {}
| ^ unreachable pattern
error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:61:9
|
@ -87,24 +46,6 @@ LL | BAR => {}
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: unreachable pattern
--> $DIR/consts-opaque.rs:63:9
|
LL | BAR => {}
| --- matches any value
LL |
LL | Bar => {} // should not be emitting unreachable warning
| ^^^ unreachable pattern
error: unreachable pattern
--> $DIR/consts-opaque.rs:65:9
|
LL | BAR => {}
| --- matches any value
...
LL | _ => {}
| ^ unreachable pattern
error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:70:9
|
@ -123,6 +64,92 @@ LL | BAR => {} // should not be emitting unreachable warning
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:80:9
|
LL | BAZ => {}
| ^^^
|
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:90:9
|
LL | BAZ => {}
| ^^^
|
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:97:9
|
LL | BAZ => {}
| ^^^
|
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: unreachable pattern
--> $DIR/consts-opaque.rs:32:9
|
LL | FOO => {}
| --- matches any value
LL |
LL | _ => {} // should not be emitting unreachable warning
| ^ unreachable pattern
|
note: the lint level is defined here
--> $DIR/consts-opaque.rs:6:9
|
LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern
--> $DIR/consts-opaque.rs:39:9
|
LL | FOO_REF => {}
| ------- matches any value
LL |
LL | Foo(_) => {} // should not be emitting unreachable warning
| ^^^^^^ unreachable pattern
error: unreachable pattern
--> $DIR/consts-opaque.rs:53:9
|
LL | Bar => {}
| --- matches any value
LL | BAR => {} // should not be emitting unreachable warning
| ^^^ unreachable pattern
error: unreachable pattern
--> $DIR/consts-opaque.rs:56:9
|
LL | Bar => {}
| --- matches any value
...
LL | _ => {}
| ^ unreachable pattern
error: unreachable pattern
--> $DIR/consts-opaque.rs:63:9
|
LL | BAR => {}
| --- matches any value
LL |
LL | Bar => {} // should not be emitting unreachable warning
| ^^^ unreachable pattern
error: unreachable pattern
--> $DIR/consts-opaque.rs:65:9
|
LL | BAR => {}
| --- matches any value
...
LL | _ => {}
| ^ unreachable pattern
error: unreachable pattern
--> $DIR/consts-opaque.rs:72:9
|
@ -141,15 +168,6 @@ LL | BAR => {}
LL | _ => {} // should not be emitting unreachable warning
| ^ unreachable pattern
error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:80:9
|
LL | BAZ => {}
| ^^^
|
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: unreachable pattern
--> $DIR/consts-opaque.rs:82:9
|
@ -168,15 +186,6 @@ LL | BAZ => {}
LL | _ => {}
| ^ unreachable pattern
error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:90:9
|
LL | BAZ => {}
| ^^^
|
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: unreachable pattern
--> $DIR/consts-opaque.rs:92:9
|
@ -186,15 +195,6 @@ LL |
LL | _ => {}
| ^ unreachable pattern
error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/consts-opaque.rs:97:9
|
LL | BAZ => {}
| ^^^
|
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: unreachable pattern
--> $DIR/consts-opaque.rs:99:9
|

View File

@ -12,7 +12,7 @@ LL | pub enum HiddenEnum {
= note: the matched value is of type `HiddenEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ HiddenEnum::B => {}
LL ~ HiddenEnum::B => {},
LL + _ => todo!()
|
@ -33,7 +33,7 @@ LL | B,
= note: the matched value is of type `HiddenEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ HiddenEnum::C => {}
LL ~ HiddenEnum::C => {},
LL + HiddenEnum::B => todo!()
|
@ -54,7 +54,7 @@ LL | B,
= note: the matched value is of type `HiddenEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ HiddenEnum::A => {}
LL ~ HiddenEnum::A => {},
LL + HiddenEnum::B | _ => todo!()
|
@ -72,7 +72,7 @@ note: `Option<HiddenEnum>` defined here
= note: the matched value is of type `Option<HiddenEnum>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ Some(HiddenEnum::A) => {}
LL ~ Some(HiddenEnum::A) => {},
LL + Some(HiddenEnum::B) | Some(_) => todo!()
|
@ -93,7 +93,7 @@ LL | C,
= note: the matched value is of type `InCrate`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ InCrate::B => {}
LL ~ InCrate::B => {},
LL + InCrate::C => todo!()
|

View File

@ -162,7 +162,7 @@ LL | match_guarded_arm!(0u8);
= note: the matched value is of type `u8`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ _ if false => {}
LL ~ _ if false => {},
LL + _ => todo!()
|
@ -180,7 +180,7 @@ LL | struct NonEmptyStruct1;
= note: the matched value is of type `NonEmptyStruct1`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ _ if false => {}
LL ~ _ if false => {},
LL + NonEmptyStruct1 => todo!()
|
@ -198,7 +198,7 @@ LL | struct NonEmptyStruct2(bool);
= note: the matched value is of type `NonEmptyStruct2`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ _ if false => {}
LL ~ _ if false => {},
LL + NonEmptyStruct2(_) => todo!()
|
@ -216,7 +216,7 @@ LL | union NonEmptyUnion1 {
= note: the matched value is of type `NonEmptyUnion1`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ _ if false => {}
LL ~ _ if false => {},
LL + NonEmptyUnion1 { .. } => todo!()
|
@ -234,7 +234,7 @@ LL | union NonEmptyUnion2 {
= note: the matched value is of type `NonEmptyUnion2`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ _ if false => {}
LL ~ _ if false => {},
LL + NonEmptyUnion2 { .. } => todo!()
|
@ -254,7 +254,7 @@ LL | Foo(bool),
= note: the matched value is of type `NonEmptyEnum1`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ _ if false => {}
LL ~ _ if false => {},
LL + NonEmptyEnum1::Foo(_) => todo!()
|
@ -276,7 +276,7 @@ LL | Bar,
= note: the matched value is of type `NonEmptyEnum2`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ _ if false => {}
LL ~ _ if false => {},
LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!()
|
@ -294,7 +294,7 @@ LL | enum NonEmptyEnum5 {
= note: the matched value is of type `NonEmptyEnum5`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
LL ~ _ if false => {}
LL ~ _ if false => {},
LL + _ => todo!()
|

View File

@ -162,7 +162,7 @@ LL | match_guarded_arm!(0u8);
= note: the matched value is of type `u8`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ _ if false => {}
LL ~ _ if false => {},
LL + _ => todo!()
|
@ -180,7 +180,7 @@ LL | struct NonEmptyStruct1;
= note: the matched value is of type `NonEmptyStruct1`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ _ if false => {}
LL ~ _ if false => {},
LL + NonEmptyStruct1 => todo!()
|
@ -198,7 +198,7 @@ LL | struct NonEmptyStruct2(bool);
= note: the matched value is of type `NonEmptyStruct2`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ _ if false => {}
LL ~ _ if false => {},
LL + NonEmptyStruct2(_) => todo!()
|
@ -216,7 +216,7 @@ LL | union NonEmptyUnion1 {
= note: the matched value is of type `NonEmptyUnion1`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ _ if false => {}
LL ~ _ if false => {},
LL + NonEmptyUnion1 { .. } => todo!()
|
@ -234,7 +234,7 @@ LL | union NonEmptyUnion2 {
= note: the matched value is of type `NonEmptyUnion2`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ _ if false => {}
LL ~ _ if false => {},
LL + NonEmptyUnion2 { .. } => todo!()
|
@ -254,7 +254,7 @@ LL | Foo(bool),
= note: the matched value is of type `NonEmptyEnum1`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ _ if false => {}
LL ~ _ if false => {},
LL + NonEmptyEnum1::Foo(_) => todo!()
|
@ -276,7 +276,7 @@ LL | Bar,
= note: the matched value is of type `NonEmptyEnum2`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ _ if false => {}
LL ~ _ if false => {},
LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!()
|
@ -294,7 +294,7 @@ LL | enum NonEmptyEnum5 {
= note: the matched value is of type `NonEmptyEnum5`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
LL ~ _ if false => {}
LL ~ _ if false => {},
LL + _ => todo!()
|

View File

@ -7,7 +7,7 @@ LL | match 0.0 {
= note: the matched value is of type `f64`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ 0.0..=1.0 => {}
LL ~ 0.0..=1.0 => {},
LL + _ => todo!()
|

View File

@ -7,7 +7,7 @@ LL | match 0u8 {
= note: the matched value is of type `u8`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ 128 ..= 255 if true => {}
LL ~ 128 ..= 255 if true => {},
LL + 128_u8..=u8::MAX => todo!()
|

View File

@ -91,7 +91,7 @@ LL | match 0i8 {
= note: the matched value is of type `i8`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ 1 ..= i8::MAX => {}
LL ~ 1 ..= i8::MAX => {},
LL + 0_i8 => todo!()
|
@ -140,7 +140,7 @@ LL | match (0u8, true) {
= note: the matched value is of type `(u8, bool)`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ (0 ..= 255, true) => {}
LL ~ (0 ..= 255, true) => {},
LL + (126_u8..=127_u8, false) => todo!()
|

View File

@ -9,7 +9,7 @@ LL | match 0usize {
= 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ 0 ..= usize::MAX => {}
LL ~ 0 ..= usize::MAX => {},
LL + _ => todo!()
|
@ -24,7 +24,7 @@ LL | match 0isize {
= 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ isize::MIN ..= isize::MAX => {}
LL ~ isize::MIN ..= isize::MAX => {},
LL + _ => todo!()
|
@ -147,7 +147,7 @@ LL | match 0isize {
= 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ 1 ..= isize::MAX => {}
LL ~ 1 ..= isize::MAX => {},
LL + _ => todo!()
|

View File

@ -9,7 +9,7 @@ LL | match 0usize {
= 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ 0..=usize::MAX => {}
LL ~ 0..=usize::MAX => {},
LL + _ => todo!()
|
@ -24,7 +24,7 @@ LL | match 0isize {
= 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ isize::MIN..=isize::MAX => {}
LL ~ isize::MIN..=isize::MAX => {},
LL + _ => todo!()
|

View File

@ -7,7 +7,7 @@ LL | match (a, b) {
= note: the matched value is of type `(Option<usize>, Option<usize>)`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ (Some(_), None) | (None, Some(_)) => {}
LL ~ (Some(_), None) | (None, Some(_)) => {},
LL + (None, None) | (Some(_), Some(_)) => todo!()
|

View File

@ -7,7 +7,7 @@ LL | match "world" {
= note: the matched value is of type `&str`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ "hello" => {}
LL ~ "hello" => {},
LL + &_ => todo!()
|
@ -20,7 +20,7 @@ LL | match "world" {
= note: the matched value is of type `&str`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ "hello" => {}
LL ~ "hello" => {},
LL + &_ => todo!()
|

View File

@ -7,7 +7,7 @@ LL | match (A, ()) {
= note: the matched value is of type `(Enum, ())`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
LL ~ (A, _) => {}
LL ~ (A, _) => {},
LL + _ => todo!()
|
@ -20,7 +20,7 @@ LL | match (A, A) {
= note: the matched value is of type `(Enum, Enum)`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
LL ~ (_, A) => {}
LL ~ (_, A) => {},
LL + _ => todo!()
|
@ -33,7 +33,7 @@ LL | match ((A, ()), ()) {
= note: the matched value is of type `((Enum, ()), ())`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
LL ~ ((A, ()), _) => {}
LL ~ ((A, ()), _) => {},
LL + _ => todo!()
|
@ -46,7 +46,7 @@ LL | match ((A, ()), A) {
= note: the matched value is of type `((Enum, ()), Enum)`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
LL ~ ((A, ()), _) => {}
LL ~ ((A, ()), _) => {},
LL + _ => todo!()
|
@ -59,7 +59,7 @@ LL | match ((A, ()), ()) {
= note: the matched value is of type `((Enum, ()), ())`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
LL ~ ((A, _), _) => {}
LL ~ ((A, _), _) => {},
LL + _ => todo!()
|
@ -77,7 +77,7 @@ LL | struct S(Enum, ());
= note: the matched value is of type `S`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
LL ~ S(A, _) => {}
LL ~ S(A, _) => {},
LL + _ => todo!()
|
@ -95,7 +95,7 @@ LL | struct Sd { x: Enum, y: () }
= note: the matched value is of type `Sd`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
LL ~ Sd { x: A, y: _ } => {}
LL ~ Sd { x: A, y: _ } => {},
LL + _ => todo!()
|

View File

@ -9,7 +9,7 @@ note: `Box<ElementKind>` defined here
= note: the matched value is of type `Box<ElementKind>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true }
LL ~ box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true },
LL + box _ => todo!()
|

View File

@ -12,7 +12,7 @@ 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 by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ Tag::ExifIFDPointer => {}
LL ~ Tag::ExifIFDPointer => {},
LL + Tag(Context::Exif, _) => todo!()
|

View File

@ -18,7 +18,7 @@ LL | C(bool),
= note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ Foo::C(true) => {}
LL ~ Foo::C(true) => {},
LL + Foo::A(false) | Foo::B(false) | Foo::C(false) => todo!()
|

View File

@ -7,7 +7,7 @@ LL | match buf {
= note: the matched value is of type `&[u8; 4]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ b"AAAA" => {}
LL ~ b"AAAA" => {},
LL + &[0_u8..=64_u8, _, _, _] | &[66_u8..=u8::MAX, _, _, _] => todo!()
|
@ -20,7 +20,7 @@ LL | match buf {
= note: the matched value is of type `&[u8]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
LL ~ b"AAAA" => {}
LL ~ b"AAAA" => {},
LL + _ => todo!()
|

View File

@ -12,7 +12,7 @@ note: `Option<Private>` defined here
= note: the matched value is of type `Option<Private>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ }) => {}
LL ~ }) => {},
LL + Some(Private { misc: true, .. }) => todo!()
|

View File

@ -7,7 +7,7 @@ LL | match list {
= note: the matched value is of type `&[Option<()>]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ &[.., Some(_), _] => {}
LL ~ &[.., Some(_), _] => {},
LL ~ &[_, Some(_), .., None, _] => todo!(),
|

View File

@ -18,7 +18,7 @@ LL | C
= note: the matched value is of type `E`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ E::A => {}
LL ~ E::A => {},
LL + E::B | E::C => todo!()
|
@ -44,8 +44,8 @@ LL | C
= note: the matched value is of type `E`
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | if let E::A = e { todo!() }
| ++ ~~~~~~~~~~~
LL | if let E::A = e { todo!() };
| ++ +++++++++++
error[E0004]: non-exhaustive patterns: `&E::B` and `&E::C` not covered
--> $DIR/non-exhaustive-defined-here.rs:50:11
@ -67,7 +67,7 @@ LL | C
= note: the matched value is of type `&E`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ E::A => {}
LL ~ E::A => {},
LL + &E::B | &E::C => todo!()
|
@ -93,8 +93,8 @@ LL | C
= note: the matched value is of type `&E`
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | if let E::A = e { todo!() }
| ++ ~~~~~~~~~~~
LL | if let E::A = e { todo!() };
| ++ +++++++++++
error[E0004]: non-exhaustive patterns: `&&mut &E::B` and `&&mut &E::C` not covered
--> $DIR/non-exhaustive-defined-here.rs:66:11
@ -116,7 +116,7 @@ LL | C
= note: the matched value is of type `&&mut &E`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ E::A => {}
LL ~ E::A => {},
LL + &&mut &E::B | &&mut &E::C => todo!()
|
@ -142,8 +142,8 @@ LL | C
= note: the matched value is of type `&&mut &E`
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | if let E::A = e { todo!() }
| ++ ~~~~~~~~~~~
LL | if let E::A = e { todo!() };
| ++ +++++++++++
error[E0004]: non-exhaustive patterns: `Opt::None` not covered
--> $DIR/non-exhaustive-defined-here.rs:92:11
@ -162,7 +162,7 @@ LL | None,
= note: the matched value is of type `Opt`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ Opt::Some(ref _x) => {}
LL ~ Opt::Some(ref _x) => {},
LL + Opt::None => todo!()
|

View File

@ -25,7 +25,7 @@ LL | enum T { A(U), B }
= note: the matched value is of type `T`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ T::B => { panic!("goodbye"); }
LL ~ T::B => { panic!("goodbye"); },
LL + T::A(U::C) => todo!()
|

View File

@ -24,7 +24,7 @@ LL | match true {
= note: the matched value is of type `bool`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ true => {}
LL ~ true => {},
LL + false => todo!()
|
@ -42,7 +42,7 @@ note: `Option<i32>` defined here
= note: the matched value is of type `Option<i32>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ None => {}
LL ~ None => {},
LL + Some(_) => todo!()
|
@ -55,7 +55,7 @@ LL | match (2, 3, 4) {
= note: the matched value is of type `(i32, i32, i32)`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ (_, _, 4) => {}
LL ~ (_, _, 4) => {},
LL + (_, _, i32::MIN..=3_i32) | (_, _, 5_i32..=i32::MAX) => todo!()
|
@ -68,7 +68,7 @@ LL | match (T::A, T::A) {
= note: the matched value is of type `(T, T)`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ (T::B, T::A) => {}
LL ~ (T::B, T::A) => {},
LL + (T::A, T::A) | (T::B, T::B) => todo!()
|
@ -86,7 +86,7 @@ LL | enum T { A, B }
= note: the matched value is of type `T`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ T::A => {}
LL ~ T::A => {},
LL + T::B => todo!()
|
@ -99,7 +99,7 @@ LL | match *vec {
= note: the matched value is of type `[Option<isize>]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ [None] => {}
LL ~ [None] => {},
LL + [] => todo!()
|

View File

@ -17,8 +17,8 @@ LL | let (1, (Some(1), 2..=3)) = (1, (None, 2));
= note: the matched value is of type `(i32, (Option<i32>, i32))`
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | if let (1, (Some(1), 2..=3)) = (1, (None, 2)) { todo!() }
| ++ ~~~~~~~~~~~
LL | if let (1, (Some(1), 2..=3)) = (1, (None, 2)) { todo!() };
| ++ +++++++++++
error: aborting due to 2 previous errors

View File

@ -5,6 +5,10 @@ LL | let f = |3: isize| println!("hello");
| ^ pattern `_` not covered
|
= note: the matched value is of type `isize`
help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
|
LL | let f = |_3: isize| println!("hello");
| +
error: aborting due to previous error

View File

@ -7,7 +7,7 @@ LL | match s2 {
= note: the matched value is of type `&[bool; 2]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ [true, .., true] => {}
LL ~ [true, .., true] => {},
LL + &[false, _] => todo!()
|
@ -20,7 +20,7 @@ LL | match s3 {
= note: the matched value is of type `&[bool; 3]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ [true, .., true] => {}
LL ~ [true, .., true] => {},
LL + &[false, ..] => todo!()
|
@ -33,7 +33,7 @@ LL | match s10 {
= note: the matched value is of type `&[bool; 10]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ [true, .., true] => {}
LL ~ [true, .., true] => {},
LL + &[false, ..] => todo!()
|
@ -46,7 +46,7 @@ LL | match s2 {
= note: the matched value is of type `&[bool; 2]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ [.., false] => {}
LL ~ [.., false] => {},
LL + &[false, true] => todo!()
|
@ -59,7 +59,7 @@ LL | match s3 {
= note: the matched value is of type `&[bool; 3]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ [.., false] => {}
LL ~ [.., false] => {},
LL + &[false, .., true] => todo!()
|
@ -72,7 +72,7 @@ LL | match s {
= note: the matched value is of type `&[bool]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ [.., false] => {}
LL ~ [.., false] => {},
LL + &[false, .., true] => todo!()
|
@ -85,7 +85,7 @@ LL | match s {
= note: the matched value is of type `&[bool]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ [] => {}
LL ~ [] => {},
LL + &[_, ..] => todo!()
|
@ -98,7 +98,7 @@ LL | match s {
= note: the matched value is of type `&[bool]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ [_] => {}
LL ~ [_] => {},
LL + &[_, _, ..] => todo!()
|
@ -111,7 +111,7 @@ LL | match s {
= note: the matched value is of type `&[bool]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ [true, ..] => {}
LL ~ [true, ..] => {},
LL + &[false, ..] => todo!()
|
@ -124,7 +124,7 @@ LL | match s {
= note: the matched value is of type `&[bool]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ [true, ..] => {}
LL ~ [true, ..] => {},
LL + &[false, _, ..] => todo!()
|
@ -137,7 +137,7 @@ LL | match s {
= note: the matched value is of type `&[bool]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ [.., true] => {}
LL ~ [.., true] => {},
LL + &[_, .., false] => todo!()
|
@ -150,7 +150,7 @@ LL | match s {
= note: the matched value is of type `&[bool]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ [.., false] => {}
LL ~ [.., false] => {},
LL + &[_, _, .., true] => todo!()
|
@ -163,7 +163,7 @@ LL | match s {
= note: the matched value is of type `&[bool]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ [false, .., false] => {}
LL ~ [false, .., false] => {},
LL + &[true, _, .., _] => todo!()
|
@ -176,7 +176,7 @@ LL | match s {
= note: the matched value is of type `&[bool]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ &[true] => {}
LL ~ &[true] => {},
LL + &[] | &[_, _, ..] => todo!()
|
@ -189,7 +189,7 @@ LL | match s {
= note: the matched value is of type `&[bool]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ CONST => {}
LL ~ CONST => {},
LL + &[] | &[_, _, ..] => todo!()
|
@ -202,7 +202,7 @@ LL | match s {
= note: the matched value is of type `&[bool]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ &[false] => {}
LL ~ &[false] => {},
LL + &[] | &[_, _, ..] => todo!()
|
@ -215,7 +215,7 @@ LL | match s {
= note: the matched value is of type `&[bool]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ CONST => {}
LL ~ CONST => {},
LL + &[] | &[_, _, ..] => todo!()
|
@ -228,7 +228,7 @@ LL | match s {
= note: the matched value is of type `&[bool]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ CONST => {}
LL ~ CONST => {},
LL + &[_, _, ..] => todo!()
|
@ -241,7 +241,7 @@ LL | match s {
= note: the matched value is of type `&[bool]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ &[_, _, ..] => {}
LL ~ &[_, _, ..] => {},
LL + &[false] => todo!()
|
@ -254,7 +254,7 @@ LL | match s1 {
= note: the matched value is of type `&[bool; 1]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ CONST1 => {}
LL ~ CONST1 => {},
LL + &[false] => todo!()
|

View File

@ -15,7 +15,7 @@ LL | Stable2,
= note: the matched value is of type `UnstableEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ UnstableEnum::Stable => {}
LL ~ UnstableEnum::Stable => {},
LL + UnstableEnum::Stable2 | _ => todo!()
|
@ -33,7 +33,7 @@ LL | pub enum UnstableEnum {
= note: the matched value is of type `UnstableEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ UnstableEnum::Stable2 => {}
LL ~ UnstableEnum::Stable2 => {},
LL + _ => todo!()
|

View File

@ -14,7 +14,7 @@ LL | B { x: Option<isize> },
= note: the matched value is of type `A`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ A::B { x: None } => {}
LL ~ A::B { x: None } => {},
LL + A::B { x: Some(_) } => todo!()
|

View File

@ -15,7 +15,7 @@ LL | Unstable,
= note: the matched value is of type `UnstableEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ UnstableEnum::Stable2 => {}
LL ~ UnstableEnum::Stable2 => {},
LL + UnstableEnum::Unstable => todo!()
|

View File

@ -4,10 +4,8 @@ fn main() {
match 0u8 {
251..257 => {}
//~^ ERROR literal out of range
//~| ERROR literal out of range
251..=256 => {}
//~^ ERROR literal out of range
//~| ERROR literal out of range
_ => {}
}
}

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