Perform match checking on THIR.

This commit is contained in:
Camille GILLOT 2023-02-27 17:43:39 +00:00
parent 3b47cdc439
commit 05082f57af
81 changed files with 668 additions and 997 deletions

View file

@ -2,7 +2,6 @@
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 @@ pub fn contains_explicit_ref_binding(&self) -> Option<hir::Mutability> {
});
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

@ -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

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

@ -10,7 +10,8 @@
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 +535,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)]
@ -590,7 +583,7 @@ pub struct BorrowOfMovedValue<'tcx> {
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 +631,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,
},
}

File diff suppressed because it is too large Load diff

View file

@ -54,11 +54,9 @@ pub(super) fn pat_from_hir<'a, 'tcx>(
pat: &'tcx hir::Pat<'tcx>,
) -> Box<Pat<'tcx>> {
let mut pcx = PatCtxt::new(tcx, param_env, typeck_results);
pcx.include_lint_checks();
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);
}
pcx.report_inlining_errors();
debug!("pat_from_hir({:?}) = {:?}", pat, result);
result
}
@ -77,6 +75,25 @@ fn include_lint_checks(&mut self) -> &mut Self {
self
}
fn report_inlining_errors(&self) {
for error in &self.errors {
match *error {
PatternError::StaticInPattern(span) => {
self.tcx.sess.emit_err(StaticInPattern { span });
}
PatternError::AssocConstInPattern(span) => {
self.tcx.sess.emit_err(AssocConstInPattern { span });
}
PatternError::ConstParamInPattern(span) => {
self.tcx.sess.emit_err(ConstParamInPattern { span });
}
PatternError::NonConstPath(span) => {
self.tcx.sess.emit_err(NonConstPath { span });
}
}
}
}
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:

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

@ -12,17 +12,14 @@ fn main() {
let a = 4;
//~^ ERROR refutable pattern in local binding
//~| patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
//~| missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable
//~| HELP introduce a variable instead
//~| HELP you might want to use `if let` to ignore the variants that aren't matched
let c = 4;
//~^ ERROR refutable pattern in local binding
//~| patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
//~| missing patterns are not covered because `c` is interpreted as a constant pattern, not a new variable
//~| HELP introduce a variable instead
//~| HELP you might want to use `if let` to ignore the variants that aren't matched
let d = 4;
//~^ ERROR refutable pattern in local binding
//~| patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
//~| missing patterns are not covered because `d` is interpreted as a constant pattern, not a new variable
//~| HELP introduce a variable instead
//~| HELP you might want to use `if let` to ignore the variants that aren't matched
fn f() {} // Check that the `NOTE`s still work with an item here (cf. issue #35115).
}

View file

@ -1,47 +1,44 @@
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;
| ^
| |
| patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
| missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable
| help: introduce a variable instead: `a_var`
| ^ patterns `0_u8..=1_u8` and `3_u8..=u8::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
= note: the matched value is of type `u8`
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | if let a = 4 { todo!() };
| ++ +++++++++++
error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:17:9
--> $DIR/const-pattern-irrefutable.rs:16:9
|
LL | pub const b: u8 = 2;
| --------------- constant defined here
...
LL | let c = 4;
| ^
| |
| patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
| missing patterns are not covered because `c` is interpreted as a constant pattern, not a new variable
| help: introduce a variable instead: `c_var`
| ^ patterns `0_u8..=1_u8` and `3_u8..=u8::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
= note: the matched value is of type `u8`
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | if let c = 4 { todo!() };
| ++ +++++++++++
error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:22:9
--> $DIR/const-pattern-irrefutable.rs:20:9
|
LL | pub const d: u8 = 2;
| --------------- constant defined here
...
LL | let d = 4;
| ^
| |
| patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
| missing patterns are not covered because `d` is interpreted as a constant pattern, not a new variable
| help: introduce a variable instead: `d_var`
| ^ patterns `0_u8..=1_u8` and `3_u8..=u8::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
= note: the matched value is of type `u8`
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | if let d = 4 { todo!() };
| ++ +++++++++++
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 @@
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 @@
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

@ -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

@ -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
_ => {}
}
}

View file

@ -5,22 +5,10 @@ LL | 251..257 => {}
| ^^^ this value doesn't fit in `u8` whose maximum value is `255`
error: literal out of range for `u8`
--> $DIR/range-pattern-out-of-bounds-issue-68972.rs:8:15
--> $DIR/range-pattern-out-of-bounds-issue-68972.rs:7:15
|
LL | 251..=256 => {}
| ^^^ this value doesn't fit in `u8` whose maximum value is `255`
error: literal out of range for `u8`
--> $DIR/range-pattern-out-of-bounds-issue-68972.rs:5:14
|
LL | 251..257 => {}
| ^^^ this value doesn't fit in `u8` whose maximum value is `255`
error: literal out of range for `u8`
--> $DIR/range-pattern-out-of-bounds-issue-68972.rs:8:15
|
LL | 251..=256 => {}
| ^^^ this value doesn't fit in `u8` whose maximum value is `255`
error: aborting due to 4 previous errors
error: aborting due to 2 previous errors

View file

@ -7,7 +7,7 @@ LL | match sl {
= 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 ~ [first, remainder @ ..] => {}
LL ~ [first, remainder @ ..] => {},
LL ~ &[] => todo!(),
|

View file

@ -2,10 +2,7 @@ fn main() {
let A = 3;
//~^ ERROR refutable pattern in local binding
//~| patterns `i32::MIN..=1_i32` and `3_i32..=i32::MAX` not covered
//~| missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable
//~| HELP introduce a variable instead
//~| SUGGESTION a_var
//~| HELP you might want to use `if let` to ignore the variants that aren't matched
const A: i32 = 2;
//~^ constant defined here
}

View file

@ -2,16 +2,15 @@ error[E0005]: refutable pattern in local binding
--> $DIR/const-pat-non-exaustive-let-new-var.rs:2:9
|
LL | let A = 3;
| ^
| |
| patterns `i32::MIN..=1_i32` and `3_i32..=i32::MAX` not covered
| missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable
| help: introduce a variable instead: `a_var`
...
LL | const A: i32 = 2;
| ------------ constant defined here
| ^ patterns `i32::MIN..=1_i32` and `3_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
= 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 A = 3 { todo!() };
| ++ +++++++++++
error: aborting due to previous error