Auto merge of #73316 - Dylan-DPC:rollup-zgouwou, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #72932 (Clarify the behaviour of Pattern when used with methods like str::contains)
 - #73066 (Querify whether a type has structural equality (Take 2))
 - #73194 (Prefer the associated constants for pattern matching error)
 - #73241 (Add/update comments about MinGW late_link_args)
 - #73267 (Use the built cargo for cargotest.)
 - #73290 (Fix links when pinging notification groups)
 - #73302 (Adjusted some doctests in libcore to use `should_panic`.)
 - #73308 (pretty/asm.rs should only be tested for x86_64 and not AArch64)

Failed merges:

r? @ghost
This commit is contained in:
bors 2020-06-13 15:50:56 +00:00
commit 06e47688bf
38 changed files with 300 additions and 234 deletions

View File

@ -154,6 +154,7 @@ impl Step for Cargotest {
fn run(self, builder: &Builder<'_>) {
let compiler = builder.compiler(self.stage, self.host);
builder.ensure(compile::Rustc { compiler, target: compiler.host });
let cargo = builder.ensure(tool::Cargo { compiler, target: compiler.host });
// Note that this is a short, cryptic, and not scoped directory name. This
// is currently to minimize the length of path on Windows where we otherwise
@ -165,7 +166,7 @@ impl Step for Cargotest {
let mut cmd = builder.tool_cmd(Tool::CargoTest);
try_run(
builder,
cmd.arg(&builder.initial_cargo)
cmd.arg(&cargo)
.arg(&out_dir)
.env("RUSTC", builder.rustc(compiler))
.env("RUSTDOC", builder.rustdoc(compiler)),

View File

@ -778,18 +778,13 @@ impl<T: ?Sized> RefCell<T> {
///
/// An example of panic:
///
/// ```
/// ```should_panic
/// use std::cell::RefCell;
/// use std::thread;
///
/// let result = thread::spawn(move || {
/// let c = RefCell::new(5);
/// let m = c.borrow_mut();
/// let c = RefCell::new(5);
///
/// let b = c.borrow(); // this causes a panic
/// }).join();
///
/// assert!(result.is_err());
/// let m = c.borrow_mut();
/// let b = c.borrow(); // this causes a panic
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
@ -858,18 +853,13 @@ impl<T: ?Sized> RefCell<T> {
///
/// An example of panic:
///
/// ```
/// ```should_panic
/// use std::cell::RefCell;
/// use std::thread;
///
/// let result = thread::spawn(move || {
/// let c = RefCell::new(5);
/// let m = c.borrow();
/// let c = RefCell::new(5);
/// let m = c.borrow();
///
/// let b = c.borrow_mut(); // this causes a panic
/// }).join();
///
/// assert!(result.is_err());
/// let b = c.borrow_mut(); // this causes a panic
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]

View File

@ -278,16 +278,11 @@ impl fmt::Display for CharTryFromError {
///
/// Passing a large radix, causing a panic:
///
/// ```
/// use std::thread;
/// ```should_panic
/// use std::char;
///
/// let result = thread::spawn(|| {
/// // this panics
/// let c = char::from_digit(1, 37);
/// }).join();
///
/// assert!(result.is_err());
/// // this panics
/// let c = char::from_digit(1, 37);
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]

View File

@ -229,16 +229,11 @@ impl char {
///
/// Passing a large radix, causing a panic:
///
/// ```
/// use std::thread;
/// ```should_panic
/// use std::char;
///
/// let result = thread::spawn(|| {
/// // this panics
/// let c = char::from_digit(1, 37);
/// }).join();
///
/// assert!(result.is_err());
/// // this panics
/// char::from_digit(1, 37);
/// ```
#[unstable(feature = "assoc_char_funcs", reason = "recently added", issue = "71763")]
#[inline]
@ -282,15 +277,9 @@ impl char {
///
/// Passing a large radix, causing a panic:
///
/// ```
/// use std::thread;
///
/// let result = thread::spawn(|| {
/// // this panics
/// '1'.is_digit(37);
/// }).join();
///
/// assert!(result.is_err());
/// ```should_panic
/// // this panics
/// '1'.is_digit(37);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
@ -337,14 +326,9 @@ impl char {
///
/// Passing a large radix, causing a panic:
///
/// ```
/// use std::thread;
///
/// let result = thread::spawn(|| {
/// '1'.to_digit(37);
/// }).join();
///
/// assert!(result.is_err());
/// ```should_panic
/// // this panics
/// '1'.to_digit(37);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
@ -646,17 +630,11 @@ impl char {
///
/// A buffer that's too small:
///
/// ```
/// use std::thread;
/// ```should_panic
/// let mut b = [0; 1];
///
/// let result = thread::spawn(|| {
/// let mut b = [0; 1];
///
/// // this panics
/// 'ß'.encode_utf8(&mut b);
/// }).join();
///
/// assert!(result.is_err());
/// // this panics
/// 'ß'.encode_utf8(&mut b);
/// ```
#[stable(feature = "unicode_encode_char", since = "1.15.0")]
#[inline]
@ -687,17 +665,11 @@ impl char {
///
/// A buffer that's too small:
///
/// ```
/// use std::thread;
/// ```should_panic
/// let mut b = [0; 1];
///
/// let result = thread::spawn(|| {
/// let mut b = [0; 1];
///
/// // this panics
/// '𝕊'.encode_utf16(&mut b);
/// }).join();
///
/// assert!(result.is_err());
/// // this panics
/// '𝕊'.encode_utf16(&mut b);
/// ```
#[stable(feature = "unicode_encode_char", since = "1.15.0")]
#[inline]

View File

@ -60,6 +60,43 @@ use crate::slice::memchr;
/// The trait itself acts as a builder for an associated
/// `Searcher` type, which does the actual work of finding
/// occurrences of the pattern in a string.
///
/// Depending on the type of the pattern, the behaviour of methods like
/// [`str::find`] and [`str::contains`] can change. The table below describes
/// some of those behaviours.
///
/// | Pattern type | Match condition |
/// |--------------------------|-------------------------------------------|
/// | `&str` | is substring |
/// | `char` | is contained in string |
/// | `&[char] | any char in slice is contained in string |
/// | `F: FnMut(char) -> bool` | `F` returns `true` for a char in string |
/// | `&&str` | is substring |
/// | `&String` | is substring |
///
/// # Examples
/// ```
/// // &str
/// assert_eq!("abaaa".find("ba"), Some(1));
/// assert_eq!("abaaa".find("bac"), None);
///
/// // char
/// assert_eq!("abaaa".find('a'), Some(0));
/// assert_eq!("abaaa".find('b'), Some(1));
/// assert_eq!("abaaa".find('c'), None);
///
/// // &[char]
/// assert_eq!("ab".find(&['b', 'a'][..]), Some(0));
/// assert_eq!("abaaa".find(&['a', 'z'][..]), Some(0));
/// assert_eq!("abaaa".find(&['c', 'd'][..]), None);
///
/// // FnMut(char) -> bool
/// assert_eq!("abcdef_z".find(|ch| ch > 'd' && ch < 'y'), Some(4));
/// assert_eq!("abcddd_z".find(|ch| ch > 'd' && ch < 'y'), None);
/// ```
///
/// [`str::find`]: ../../../std/primitive.str.html#method.find
/// [`str::contains`]: ../../../std/primitive.str.html#method.contains
pub trait Pattern<'a>: Sized {
/// Associated searcher for this pattern
type Searcher: Searcher<'a>;

View File

@ -789,6 +789,17 @@ rustc_queries! {
desc { "computing whether `{}` needs drop", env.value }
}
/// Query backing `TyS::is_structural_eq_shallow`.
///
/// This is only correct for ADTs. Call `is_structural_eq_shallow` to handle all types
/// correctly.
query has_structural_eq_impls(ty: Ty<'tcx>) -> bool {
desc {
"computing whether `{:?}` implements `PartialStructuralEq` and `StructuralEq`",
ty
}
}
/// A list of types where the ADT requires drop if and only if any of
/// those types require drop. If the ADT is known to always need drop
/// then `Err(AlwaysRequiresDrop)` is returned.

View File

@ -986,7 +986,7 @@ pub trait PrettyPrinter<'tcx>:
let ui_str = ui.name_str();
if data == max {
p!(write("std::{}::MAX", ui_str))
p!(write("{}::MAX", ui_str))
} else {
if print_ty { p!(write("{}{}", data, ui_str)) } else { p!(write("{}", data)) }
};
@ -999,8 +999,8 @@ pub trait PrettyPrinter<'tcx>:
let i_str = i.name_str();
match data {
d if d == min => p!(write("std::{}::MIN", i_str)),
d if d == max => p!(write("std::{}::MAX", i_str)),
d if d == min => p!(write("{}::MIN", i_str)),
d if d == max => p!(write("{}::MAX", i_str)),
_ => {
let data = sign_extend(data, size) as i128;
if print_ty {

View File

@ -778,6 +778,57 @@ impl<'tcx> ty::TyS<'tcx> {
}
}
/// Returns `true` if equality for this type is both reflexive and structural.
///
/// Reflexive equality for a type is indicated by an `Eq` impl for that type.
///
/// Primitive types (`u32`, `str`) have structural equality by definition. For composite data
/// types, equality for the type as a whole is structural when it is the same as equality
/// between all components (fields, array elements, etc.) of that type. For ADTs, structural
/// equality is indicated by an implementation of `PartialStructuralEq` and `StructuralEq` for
/// that type.
///
/// This function is "shallow" because it may return `true` for a composite type whose fields
/// are not `StructuralEq`. For example, `[T; 4]` has structural equality regardless of `T`
/// because equality for arrays is determined by the equality of each array element. If you
/// want to know whether a given call to `PartialEq::eq` will proceed structurally all the way
/// down, you will need to use a type visitor.
#[inline]
pub fn is_structural_eq_shallow(&'tcx self, tcx: TyCtxt<'tcx>) -> bool {
match self.kind {
// Look for an impl of both `PartialStructuralEq` and `StructuralEq`.
Adt(..) => tcx.has_structural_eq_impls(self),
// Primitive types that satisfy `Eq`.
Bool | Char | Int(_) | Uint(_) | Str | Never => true,
// Composite types that satisfy `Eq` when all of their fields do.
//
// Because this function is "shallow", we return `true` for these composites regardless
// of the type(s) contained within.
Ref(..) | Array(..) | Slice(_) | Tuple(..) => true,
// Raw pointers use bitwise comparison.
RawPtr(_) | FnPtr(_) => true,
// Floating point numbers are not `Eq`.
Float(_) => false,
// Conservatively return `false` for all others...
// Anonymous function types
FnDef(..) | Closure(..) | Dynamic(..) | Generator(..) => false,
// Generic or inferred types
//
// FIXME(ecstaticmorse): Maybe we should `bug` here? This should probably only be
// called for known, fully-monomorphized types.
Projection(_) | Opaque(..) | Param(_) | Bound(..) | Placeholder(_) | Infer(_) => false,
Foreign(_) | GeneratorWitness(..) | Error => false,
}
}
pub fn same_type(a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
match (&a.kind, &b.kind) {
(&Adt(did_a, substs_a), &Adt(did_b, substs_b)) => {

View File

@ -2,7 +2,6 @@
//!
//! See the `Qualif` trait for more info.
use rustc_infer::infer::TyCtxtInferExt;
use rustc_middle::mir::*;
use rustc_middle::ty::{self, subst::SubstsRef, AdtDef, Ty};
use rustc_span::DUMMY_SP;
@ -137,10 +136,7 @@ impl Qualif for CustomEq {
substs: SubstsRef<'tcx>,
) -> bool {
let ty = cx.tcx.mk_ty(ty::Adt(adt, substs));
let id = cx.tcx.hir().local_def_id_to_hir_id(cx.def_id.as_local().unwrap());
cx.tcx
.infer_ctxt()
.enter(|infcx| !traits::type_marked_structural(id, cx.body.span, &infcx, ty))
!ty.is_structural_eq_shallow(cx.tcx)
}
}

View File

@ -80,7 +80,7 @@ impl<'a, 'tcx> ConstToPat<'a, 'tcx> {
}
fn type_marked_structural(&self, ty: Ty<'tcx>) -> bool {
traits::type_marked_structural(self.id, self.span, &self.infcx, ty)
ty.is_structural_eq_shallow(self.infcx.tcx)
}
fn to_pat(

View File

@ -17,6 +17,8 @@ pub fn opts() -> TargetOptions {
let mut late_link_args = LinkArgs::new();
let mut late_link_args_dynamic = LinkArgs::new();
let mut late_link_args_static = LinkArgs::new();
// Order of `late_link_args*` was found through trial and error to work with various
// mingw-w64 versions (not tested on the CI). It's expected to change from time to time.
late_link_args.insert(
LinkerFlavor::Gcc,
vec![
@ -27,10 +29,9 @@ pub fn opts() -> TargetOptions {
// And it seems that the linker fails to use import symbols from msvcrt
// that are required from functions in msvcrt in certain cases. For example
// `_fmode` that is used by an implementation of `__p__fmode` in x86_64.
// Listing the library twice seems to fix that, and seems to also be done
// by mingw's gcc (Though not sure if it's done on purpose, or by mistake).
// The library is purposely listed twice to fix that.
//
// See https://github.com/rust-lang/rust/pull/47483
// See https://github.com/rust-lang/rust/pull/47483 for some more details.
"-lmsvcrt".to_string(),
"-luser32".to_string(),
"-lkernel32".to_string(),

View File

@ -60,7 +60,6 @@ pub use self::specialize::specialization_graph::FutureCompatOverlapError;
pub use self::specialize::specialization_graph::FutureCompatOverlapErrorKind;
pub use self::specialize::{specialization_graph, translate_substs, OverlapError};
pub use self::structural_match::search_for_structural_match_violation;
pub use self::structural_match::type_marked_structural;
pub use self::structural_match::NonStructuralMatchTy;
pub use self::util::{elaborate_predicates, elaborate_trait_ref, elaborate_trait_refs};
pub use self::util::{expand_trait_aliases, TraitAliasExpander};
@ -553,6 +552,7 @@ fn type_implements_trait<'tcx>(
pub fn provide(providers: &mut ty::query::Providers<'_>) {
object_safety::provide(providers);
structural_match::provide(providers);
*providers = ty::query::Providers {
specialization_graph_of: specialize::specialization_graph_provider,
specializes: specialize::specializes,

View File

@ -1,10 +1,11 @@
use crate::infer::{InferCtxt, TyCtxtInferExt};
use crate::traits::ObligationCause;
use crate::traits::{self, ConstPatternStructural, TraitEngine};
use crate::traits::{self, TraitEngine};
use rustc_data_structures::fx::FxHashSet;
use rustc_hir as hir;
use rustc_hir::lang_items::{StructuralPeqTraitLangItem, StructuralTeqTraitLangItem};
use rustc_middle::ty::query::Providers;
use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt, TypeFoldable, TypeVisitor};
use rustc_span::Span;
@ -45,14 +46,14 @@ pub enum NonStructuralMatchTy<'tcx> {
/// that arose when the requirement was not enforced completely, see
/// Rust RFC 1445, rust-lang/rust#61188, and rust-lang/rust#62307.
pub fn search_for_structural_match_violation<'tcx>(
id: hir::HirId,
_id: hir::HirId,
span: Span,
tcx: TyCtxt<'tcx>,
ty: Ty<'tcx>,
) -> Option<NonStructuralMatchTy<'tcx>> {
// FIXME: we should instead pass in an `infcx` from the outside.
tcx.infer_ctxt().enter(|infcx| {
let mut search = Search { id, span, infcx, found: None, seen: FxHashSet::default() };
let mut search = Search { infcx, span, found: None, seen: FxHashSet::default() };
ty.visit_with(&mut search);
search.found
})
@ -65,27 +66,26 @@ pub fn search_for_structural_match_violation<'tcx>(
///
/// Note that this does *not* recursively check if the substructure of `adt_ty`
/// implements the traits.
pub fn type_marked_structural(
id: hir::HirId,
span: Span,
fn type_marked_structural(
infcx: &InferCtxt<'_, 'tcx>,
adt_ty: Ty<'tcx>,
cause: ObligationCause<'tcx>,
) -> bool {
let mut fulfillment_cx = traits::FulfillmentContext::new();
let cause = ObligationCause::new(span, id, ConstPatternStructural);
// require `#[derive(PartialEq)]`
let structural_peq_def_id = infcx.tcx.require_lang_item(StructuralPeqTraitLangItem, Some(span));
let structural_peq_def_id =
infcx.tcx.require_lang_item(StructuralPeqTraitLangItem, Some(cause.span));
fulfillment_cx.register_bound(
infcx,
ty::ParamEnv::empty(),
adt_ty,
structural_peq_def_id,
cause,
cause.clone(),
);
// for now, require `#[derive(Eq)]`. (Doing so is a hack to work around
// the type `for<'a> fn(&'a ())` failing to implement `Eq` itself.)
let cause = ObligationCause::new(span, id, ConstPatternStructural);
let structural_teq_def_id = infcx.tcx.require_lang_item(StructuralTeqTraitLangItem, Some(span));
let structural_teq_def_id =
infcx.tcx.require_lang_item(StructuralTeqTraitLangItem, Some(cause.span));
fulfillment_cx.register_bound(
infcx,
ty::ParamEnv::empty(),
@ -110,7 +110,6 @@ pub fn type_marked_structural(
/// find instances of ADTs (specifically structs or enums) that do not implement
/// the structural-match traits (`StructuralPartialEq` and `StructuralEq`).
struct Search<'a, 'tcx> {
id: hir::HirId,
span: Span,
infcx: InferCtxt<'a, 'tcx>,
@ -129,7 +128,7 @@ impl Search<'a, 'tcx> {
}
fn type_marked_structural(&self, adt_ty: Ty<'tcx>) -> bool {
type_marked_structural(self.id, self.span, &self.infcx, adt_ty)
adt_ty.is_structural_eq_shallow(self.tcx())
}
}
@ -266,3 +265,12 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for Search<'a, 'tcx> {
false
}
}
pub fn provide(providers: &mut Providers<'_>) {
providers.has_structural_eq_impls = |tcx, ty| {
tcx.infer_ctxt().enter(|infcx| {
let cause = ObligationCause::dummy();
type_marked_structural(&infcx, ty, cause)
})
};
}

View File

@ -59,7 +59,7 @@
// mir::Constant
// + span: $DIR/bad_op_div_by_zero.rs:5:14: 5:19
- // + literal: Const { ty: i32, val: Value(Scalar(0xffffffff)) }
- _6 = Eq(const 1i32, const std::i32::MIN); // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
- _6 = Eq(const 1i32, const i32::MIN); // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
+ _6 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
// ty::Const

View File

@ -59,7 +59,7 @@
// mir::Constant
// + span: $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
- // + literal: Const { ty: i32, val: Value(Scalar(0xffffffff)) }
- _6 = Eq(const 1i32, const std::i32::MIN); // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
- _6 = Eq(const 1i32, const i32::MIN); // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
+ _6 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
// ty::Const

View File

@ -8,6 +8,7 @@ extern crate std;
// pretty-mode:expanded
// pp-exact:asm.pp
// only-x86_64
pub fn main() {
let a: i32;

View File

@ -2,6 +2,7 @@
// pretty-mode:expanded
// pp-exact:asm.pp
// only-x86_64
pub fn main() {
let a: i32;

View File

@ -1,8 +1,8 @@
error[E0005]: refutable pattern in local binding: `std::i32::MIN..=-1i32` and `1i32..=std::i32::MAX` not covered
error[E0005]: refutable pattern in local binding: `i32::MIN..=-1i32` and `1i32..=i32::MAX` not covered
--> $DIR/const-match-check.rs:25:15
|
LL | A = { let 0 = 0; 0 },
| ^ patterns `std::i32::MIN..=-1i32` and `1i32..=std::i32::MAX` not covered
| ^ patterns `i32::MIN..=-1i32` and `1i32..=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,8 +1,8 @@
error[E0005]: refutable pattern in local binding: `std::i32::MIN..=-1i32` and `1i32..=std::i32::MAX` not covered
error[E0005]: refutable pattern in local binding: `i32::MIN..=-1i32` and `1i32..=i32::MAX` not covered
--> $DIR/const-match-check.rs:31:24
|
LL | let x: [i32; { let 0 = 0; 0 }] = [];
| ^ patterns `std::i32::MIN..=-1i32` and `1i32..=std::i32::MAX` not covered
| ^ patterns `i32::MIN..=-1i32` and `1i32..=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,8 +1,8 @@
error[E0005]: refutable pattern in local binding: `std::i32::MIN..=-1i32` and `1i32..=std::i32::MAX` not covered
error[E0005]: refutable pattern in local binding: `i32::MIN..=-1i32` and `1i32..=i32::MAX` not covered
--> $DIR/const-match-check.rs:4:22
|
LL | const X: i32 = { let 0 = 0; 0 };
| ^ patterns `std::i32::MIN..=-1i32` and `1i32..=std::i32::MAX` not covered
| ^ patterns `i32::MIN..=-1i32` and `1i32..=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
@ -12,11 +12,11 @@ help: you might want to use `if let` to ignore the variant that isn't matched
LL | const X: i32 = { if let 0 = 0 { /* */ } 0 };
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0005]: refutable pattern in local binding: `std::i32::MIN..=-1i32` and `1i32..=std::i32::MAX` not covered
error[E0005]: refutable pattern in local binding: `i32::MIN..=-1i32` and `1i32..=i32::MAX` not covered
--> $DIR/const-match-check.rs:8:23
|
LL | static Y: i32 = { let 0 = 0; 0 };
| ^ patterns `std::i32::MIN..=-1i32` and `1i32..=std::i32::MAX` not covered
| ^ patterns `i32::MIN..=-1i32` and `1i32..=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
@ -26,11 +26,11 @@ help: you might want to use `if let` to ignore the variant that isn't matched
LL | static Y: i32 = { if let 0 = 0 { /* */ } 0 };
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0005]: refutable pattern in local binding: `std::i32::MIN..=-1i32` and `1i32..=std::i32::MAX` not covered
error[E0005]: refutable pattern in local binding: `i32::MIN..=-1i32` and `1i32..=i32::MAX` not covered
--> $DIR/const-match-check.rs:13:26
|
LL | const X: i32 = { let 0 = 0; 0 };
| ^ patterns `std::i32::MIN..=-1i32` and `1i32..=std::i32::MAX` not covered
| ^ patterns `i32::MIN..=-1i32` and `1i32..=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
@ -40,11 +40,11 @@ help: you might want to use `if let` to ignore the variant that isn't matched
LL | const X: i32 = { if let 0 = 0 { /* */ } 0 };
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0005]: refutable pattern in local binding: `std::i32::MIN..=-1i32` and `1i32..=std::i32::MAX` not covered
error[E0005]: refutable pattern in local binding: `i32::MIN..=-1i32` and `1i32..=i32::MAX` not covered
--> $DIR/const-match-check.rs:19:26
|
LL | const X: i32 = { let 0 = 0; 0 };
| ^ patterns `std::i32::MIN..=-1i32` and `1i32..=std::i32::MAX` not covered
| ^ patterns `i32::MIN..=-1i32` and `1i32..=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

@ -9,8 +9,8 @@ use foo::d;
const a: u8 = 2;
fn main() {
let a = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` and `3u8..=std::u8::MAX
let c = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` and `3u8..=std::u8::MAX
let d = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` and `3u8..=std::u8::MAX
let a = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` and `3u8..=u8::MAX
let c = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` and `3u8..=u8::MAX
let d = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` and `3u8..=u8::MAX
fn f() {} // Check that the `NOTE`s still work with an item here (cf. issue #35115).
}

View File

@ -1,4 +1,4 @@
error[E0005]: refutable pattern in local binding: `0u8..=1u8` and `3u8..=std::u8::MAX` not covered
error[E0005]: refutable pattern in local binding: `0u8..=1u8` and `3u8..=u8::MAX` not covered
--> $DIR/const-pattern-irrefutable.rs:12:9
|
LL | const a: u8 = 2;
@ -12,7 +12,7 @@ LL | let a = 4;
|
= note: the matched value is of type `u8`
error[E0005]: refutable pattern in local binding: `0u8..=1u8` and `3u8..=std::u8::MAX` not covered
error[E0005]: refutable pattern in local binding: `0u8..=1u8` and `3u8..=u8::MAX` not covered
--> $DIR/const-pattern-irrefutable.rs:13:9
|
LL | pub const b: u8 = 2;
@ -26,7 +26,7 @@ LL | let c = 4;
|
= note: the matched value is of type `u8`
error[E0005]: refutable pattern in local binding: `0u8..=1u8` and `3u8..=std::u8::MAX` not covered
error[E0005]: refutable pattern in local binding: `0u8..=1u8` and `3u8..=u8::MAX` not covered
--> $DIR/const-pattern-irrefutable.rs:14:9
|
LL | pub const d: u8 = 2;

View File

@ -1,8 +1,8 @@
error[E0005]: refutable pattern in `for` loop binding: `&std::i32::MIN..=0i32` and `&2i32..=std::i32::MAX` not covered
error[E0005]: refutable pattern in `for` loop binding: `&i32::MIN..=0i32` and `&2i32..=i32::MAX` not covered
--> $DIR/for-loop-refutable-pattern-error-message.rs:2:9
|
LL | for &1 in [1].iter() {}
| ^^ patterns `&std::i32::MIN..=0i32` and `&2i32..=std::i32::MAX` not covered
| ^^ patterns `&i32::MIN..=0i32` and `&2i32..=i32::MAX` not covered
|
= note: the matched value is of type `&i32`

View File

@ -70,20 +70,20 @@ LL | m!('a', ..VAL_1 | VAL_2..);
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `char`
error[E0004]: non-exhaustive patterns: `std::u8::MAX` not covered
error[E0004]: non-exhaustive patterns: `u8::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:41:12
|
LL | m!(0, ..core::u8::MAX);
| ^ pattern `std::u8::MAX` not covered
| ^ pattern `u8::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
error[E0004]: non-exhaustive patterns: `254u8..=std::u8::MAX` not covered
error[E0004]: non-exhaustive patterns: `254u8..=u8::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:42:12
|
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `254u8..=std::u8::MAX` not covered
| ^ pattern `254u8..=u8::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
@ -97,11 +97,11 @@ LL | m!(0, ALMOST_MIN..);
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
error[E0004]: non-exhaustive patterns: `std::u8::MAX` not covered
error[E0004]: non-exhaustive patterns: `u8::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:44:12
|
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `std::u8::MAX` not covered
| ^ pattern `u8::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
@ -124,20 +124,20 @@ LL | m!(0, ..VAL_1 | VAL_2..);
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
error[E0004]: non-exhaustive patterns: `std::u16::MAX` not covered
error[E0004]: non-exhaustive patterns: `u16::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:54:12
|
LL | m!(0, ..core::u16::MAX);
| ^ pattern `std::u16::MAX` not covered
| ^ pattern `u16::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u16`
error[E0004]: non-exhaustive patterns: `65534u16..=std::u16::MAX` not covered
error[E0004]: non-exhaustive patterns: `65534u16..=u16::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:55:12
|
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `65534u16..=std::u16::MAX` not covered
| ^ pattern `65534u16..=u16::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u16`
@ -151,11 +151,11 @@ LL | m!(0, ALMOST_MIN..);
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u16`
error[E0004]: non-exhaustive patterns: `std::u16::MAX` not covered
error[E0004]: non-exhaustive patterns: `u16::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:57:12
|
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `std::u16::MAX` not covered
| ^ pattern `u16::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u16`
@ -178,20 +178,20 @@ LL | m!(0, ..VAL_1 | VAL_2..);
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u16`
error[E0004]: non-exhaustive patterns: `std::u32::MAX` not covered
error[E0004]: non-exhaustive patterns: `u32::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:67:12
|
LL | m!(0, ..core::u32::MAX);
| ^ pattern `std::u32::MAX` not covered
| ^ pattern `u32::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u32`
error[E0004]: non-exhaustive patterns: `4294967294u32..=std::u32::MAX` not covered
error[E0004]: non-exhaustive patterns: `4294967294u32..=u32::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:68:12
|
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `4294967294u32..=std::u32::MAX` not covered
| ^ pattern `4294967294u32..=u32::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u32`
@ -205,11 +205,11 @@ LL | m!(0, ALMOST_MIN..);
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u32`
error[E0004]: non-exhaustive patterns: `std::u32::MAX` not covered
error[E0004]: non-exhaustive patterns: `u32::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:70:12
|
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `std::u32::MAX` not covered
| ^ pattern `u32::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u32`
@ -232,20 +232,20 @@ LL | m!(0, ..VAL_1 | VAL_2..);
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u32`
error[E0004]: non-exhaustive patterns: `std::u64::MAX` not covered
error[E0004]: non-exhaustive patterns: `u64::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:80:12
|
LL | m!(0, ..core::u64::MAX);
| ^ pattern `std::u64::MAX` not covered
| ^ pattern `u64::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u64`
error[E0004]: non-exhaustive patterns: `18446744073709551614u64..=std::u64::MAX` not covered
error[E0004]: non-exhaustive patterns: `18446744073709551614u64..=u64::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:81:12
|
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `18446744073709551614u64..=std::u64::MAX` not covered
| ^ pattern `18446744073709551614u64..=u64::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u64`
@ -259,11 +259,11 @@ LL | m!(0, ALMOST_MIN..);
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u64`
error[E0004]: non-exhaustive patterns: `std::u64::MAX` not covered
error[E0004]: non-exhaustive patterns: `u64::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:83:12
|
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `std::u64::MAX` not covered
| ^ pattern `u64::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u64`
@ -286,20 +286,20 @@ LL | m!(0, ..VAL_1 | VAL_2..);
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u64`
error[E0004]: non-exhaustive patterns: `std::u128::MAX` not covered
error[E0004]: non-exhaustive patterns: `u128::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:93:12
|
LL | m!(0, ..core::u128::MAX);
| ^ pattern `std::u128::MAX` not covered
| ^ pattern `u128::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211454u128..=std::u128::MAX` not covered
error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211454u128..=u128::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:94:12
|
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `340282366920938463463374607431768211454u128..=std::u128::MAX` not covered
| ^ pattern `340282366920938463463374607431768211454u128..=u128::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
@ -313,11 +313,11 @@ LL | m!(0, ALMOST_MIN..);
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
error[E0004]: non-exhaustive patterns: `std::u128::MAX` not covered
error[E0004]: non-exhaustive patterns: `u128::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:96:12
|
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `std::u128::MAX` not covered
| ^ pattern `u128::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
@ -340,38 +340,38 @@ LL | m!(0, ..VAL_1 | VAL_2..);
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
error[E0004]: non-exhaustive patterns: `std::i8::MAX` not covered
error[E0004]: non-exhaustive patterns: `i8::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:109:12
|
LL | m!(0, ..core::i8::MAX);
| ^ pattern `std::i8::MAX` not covered
| ^ pattern `i8::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
error[E0004]: non-exhaustive patterns: `126i8..=std::i8::MAX` not covered
error[E0004]: non-exhaustive patterns: `126i8..=i8::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:110:12
|
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `126i8..=std::i8::MAX` not covered
| ^ pattern `126i8..=i8::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
error[E0004]: non-exhaustive patterns: `std::i8::MIN` not covered
error[E0004]: non-exhaustive patterns: `i8::MIN` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:111:12
|
LL | m!(0, ALMOST_MIN..);
| ^ pattern `std::i8::MIN` not covered
| ^ pattern `i8::MIN` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
error[E0004]: non-exhaustive patterns: `std::i8::MAX` not covered
error[E0004]: non-exhaustive patterns: `i8::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:112:12
|
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `std::i8::MAX` not covered
| ^ pattern `i8::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
@ -394,38 +394,38 @@ LL | m!(0, ..VAL_1 | VAL_2..);
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
error[E0004]: non-exhaustive patterns: `std::i16::MAX` not covered
error[E0004]: non-exhaustive patterns: `i16::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:122:12
|
LL | m!(0, ..core::i16::MAX);
| ^ pattern `std::i16::MAX` not covered
| ^ pattern `i16::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i16`
error[E0004]: non-exhaustive patterns: `32766i16..=std::i16::MAX` not covered
error[E0004]: non-exhaustive patterns: `32766i16..=i16::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:123:12
|
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `32766i16..=std::i16::MAX` not covered
| ^ pattern `32766i16..=i16::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i16`
error[E0004]: non-exhaustive patterns: `std::i16::MIN` not covered
error[E0004]: non-exhaustive patterns: `i16::MIN` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:124:12
|
LL | m!(0, ALMOST_MIN..);
| ^ pattern `std::i16::MIN` not covered
| ^ pattern `i16::MIN` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i16`
error[E0004]: non-exhaustive patterns: `std::i16::MAX` not covered
error[E0004]: non-exhaustive patterns: `i16::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:125:12
|
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `std::i16::MAX` not covered
| ^ pattern `i16::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i16`
@ -448,38 +448,38 @@ LL | m!(0, ..VAL_1 | VAL_2..);
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i16`
error[E0004]: non-exhaustive patterns: `std::i32::MAX` not covered
error[E0004]: non-exhaustive patterns: `i32::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:135:12
|
LL | m!(0, ..core::i32::MAX);
| ^ pattern `std::i32::MAX` not covered
| ^ pattern `i32::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i32`
error[E0004]: non-exhaustive patterns: `2147483646i32..=std::i32::MAX` not covered
error[E0004]: non-exhaustive patterns: `2147483646i32..=i32::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:136:12
|
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `2147483646i32..=std::i32::MAX` not covered
| ^ pattern `2147483646i32..=i32::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i32`
error[E0004]: non-exhaustive patterns: `std::i32::MIN` not covered
error[E0004]: non-exhaustive patterns: `i32::MIN` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:137:12
|
LL | m!(0, ALMOST_MIN..);
| ^ pattern `std::i32::MIN` not covered
| ^ pattern `i32::MIN` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i32`
error[E0004]: non-exhaustive patterns: `std::i32::MAX` not covered
error[E0004]: non-exhaustive patterns: `i32::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:138:12
|
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `std::i32::MAX` not covered
| ^ pattern `i32::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i32`
@ -502,38 +502,38 @@ LL | m!(0, ..VAL_1 | VAL_2..);
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i32`
error[E0004]: non-exhaustive patterns: `std::i64::MAX` not covered
error[E0004]: non-exhaustive patterns: `i64::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:148:12
|
LL | m!(0, ..core::i64::MAX);
| ^ pattern `std::i64::MAX` not covered
| ^ pattern `i64::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i64`
error[E0004]: non-exhaustive patterns: `9223372036854775806i64..=std::i64::MAX` not covered
error[E0004]: non-exhaustive patterns: `9223372036854775806i64..=i64::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:149:12
|
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `9223372036854775806i64..=std::i64::MAX` not covered
| ^ pattern `9223372036854775806i64..=i64::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i64`
error[E0004]: non-exhaustive patterns: `std::i64::MIN` not covered
error[E0004]: non-exhaustive patterns: `i64::MIN` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:150:12
|
LL | m!(0, ALMOST_MIN..);
| ^ pattern `std::i64::MIN` not covered
| ^ pattern `i64::MIN` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i64`
error[E0004]: non-exhaustive patterns: `std::i64::MAX` not covered
error[E0004]: non-exhaustive patterns: `i64::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:151:12
|
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `std::i64::MAX` not covered
| ^ pattern `i64::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i64`
@ -556,38 +556,38 @@ LL | m!(0, ..VAL_1 | VAL_2..);
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i64`
error[E0004]: non-exhaustive patterns: `std::i128::MAX` not covered
error[E0004]: non-exhaustive patterns: `i128::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:161:12
|
LL | m!(0, ..core::i128::MAX);
| ^ pattern `std::i128::MAX` not covered
| ^ pattern `i128::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i128`
error[E0004]: non-exhaustive patterns: `170141183460469231731687303715884105726i128..=std::i128::MAX` not covered
error[E0004]: non-exhaustive patterns: `170141183460469231731687303715884105726i128..=i128::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:162:12
|
LL | m!(0, ..ALMOST_MAX);
| ^ pattern `170141183460469231731687303715884105726i128..=std::i128::MAX` not covered
| ^ pattern `170141183460469231731687303715884105726i128..=i128::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i128`
error[E0004]: non-exhaustive patterns: `std::i128::MIN` not covered
error[E0004]: non-exhaustive patterns: `i128::MIN` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:163:12
|
LL | m!(0, ALMOST_MIN..);
| ^ pattern `std::i128::MIN` not covered
| ^ pattern `i128::MIN` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i128`
error[E0004]: non-exhaustive patterns: `std::i128::MAX` not covered
error[E0004]: non-exhaustive patterns: `i128::MAX` not covered
--> $DIR/half-open-range-pats-exhaustive-fail.rs:164:12
|
LL | m!(0, ..=ALMOST_MAX);
| ^ pattern `std::i128::MAX` not covered
| ^ pattern `i128::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i128`

View File

@ -4,15 +4,15 @@
// We wrap patterns in a tuple because top-level or-patterns were special-cased.
fn main() {
match (0u8, 0u8) {
//~^ ERROR non-exhaustive patterns: `(2u8..=std::u8::MAX, _)`
//~^ ERROR non-exhaustive patterns: `(2u8..=u8::MAX, _)`
(0 | 1, 2 | 3) => {}
}
match ((0u8,),) {
//~^ ERROR non-exhaustive patterns: `((4u8..=std::u8::MAX))`
//~^ ERROR non-exhaustive patterns: `((4u8..=u8::MAX))`
((0 | 1,) | (2 | 3,),) => {}
}
match (Some(0u8),) {
//~^ ERROR non-exhaustive patterns: `(Some(2u8..=std::u8::MAX))`
//~^ ERROR non-exhaustive patterns: `(Some(2u8..=u8::MAX))`
(None | Some(0 | 1),) => {}
}
}

View File

@ -1,26 +1,26 @@
error[E0004]: non-exhaustive patterns: `(2u8..=std::u8::MAX, _)` not covered
error[E0004]: non-exhaustive patterns: `(2u8..=u8::MAX, _)` not covered
--> $DIR/exhaustiveness-non-exhaustive.rs:6:11
|
LL | match (0u8, 0u8) {
| ^^^^^^^^^^ pattern `(2u8..=std::u8::MAX, _)` not covered
| ^^^^^^^^^^ pattern `(2u8..=u8::MAX, _)` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(u8, u8)`
error[E0004]: non-exhaustive patterns: `((4u8..=std::u8::MAX))` not covered
error[E0004]: non-exhaustive patterns: `((4u8..=u8::MAX))` not covered
--> $DIR/exhaustiveness-non-exhaustive.rs:10:11
|
LL | match ((0u8,),) {
| ^^^^^^^^^ pattern `((4u8..=std::u8::MAX))` not covered
| ^^^^^^^^^ pattern `((4u8..=u8::MAX))` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `((u8,),)`
error[E0004]: non-exhaustive patterns: `(Some(2u8..=std::u8::MAX))` not covered
error[E0004]: non-exhaustive patterns: `(Some(2u8..=u8::MAX))` not covered
--> $DIR/exhaustiveness-non-exhaustive.rs:14:11
|
LL | match (Some(0u8),) {
| ^^^^^^^^^^^^ pattern `(Some(2u8..=std::u8::MAX))` not covered
| ^^^^^^^^^^^^ pattern `(Some(2u8..=u8::MAX))` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(std::option::Option<u8>,)`

View File

@ -1,8 +1,8 @@
error[E0005]: refutable pattern in local binding: `std::i32::MIN..=-1i32` and `3i32..=std::i32::MAX` not covered
error[E0005]: refutable pattern in local binding: `i32::MIN..=-1i32` and `3i32..=i32::MAX` not covered
--> $DIR/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs:4:9
|
LL | let 0 | (1 | 2) = 0;
| ^^^^^^^^^^^ patterns `std::i32::MIN..=-1i32` and `3i32..=std::i32::MAX` not covered
| ^^^^^^^^^^^ patterns `i32::MIN..=-1i32` and `3i32..=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
@ -12,11 +12,11 @@ help: you might want to use `if let` to ignore the variant that isn't matched
LL | if let 0 | (1 | 2) = 0 { /* */ }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0004]: non-exhaustive patterns: `std::i32::MIN..=-1i32` and `3i32..=std::i32::MAX` not covered
error[E0004]: non-exhaustive patterns: `i32::MIN..=-1i32` and `3i32..=i32::MAX` not covered
--> $DIR/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs:5:11
|
LL | match 0 {
| ^ patterns `std::i32::MIN..=-1i32` and `3i32..=std::i32::MAX` not covered
| ^ patterns `i32::MIN..=-1i32` and `3i32..=i32::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i32`

View File

@ -10,11 +10,11 @@ note: the lint level is defined here
LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
error[E0004]: non-exhaustive patterns: `128u8..=std::u8::MAX` not covered
error[E0004]: non-exhaustive patterns: `128u8..=u8::MAX` not covered
--> $DIR/exhaustive_integer_patterns.rs:28:11
|
LL | match x {
| ^ pattern `128u8..=std::u8::MAX` not covered
| ^ pattern `128u8..=u8::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
@ -34,20 +34,20 @@ error: unreachable pattern
LL | -2..=20 => {}
| ^^^^^^^
error[E0004]: non-exhaustive patterns: `std::i8::MIN..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered
error[E0004]: non-exhaustive patterns: `i8::MIN..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered
--> $DIR/exhaustive_integer_patterns.rs:41:11
|
LL | match x {
| ^ patterns `std::i8::MIN..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered
| ^ patterns `i8::MIN..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
error[E0004]: non-exhaustive patterns: `std::i8::MIN` not covered
error[E0004]: non-exhaustive patterns: `i8::MIN` not covered
--> $DIR/exhaustive_integer_patterns.rs:83:11
|
LL | match 0i8 {
| ^^^ pattern `std::i8::MIN` not covered
| ^^^ pattern `i8::MIN` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
@ -61,20 +61,20 @@ LL | match 0i16 {
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i16`
error[E0004]: non-exhaustive patterns: `128u8..=std::u8::MAX` not covered
error[E0004]: non-exhaustive patterns: `128u8..=u8::MAX` not covered
--> $DIR/exhaustive_integer_patterns.rs:109:11
|
LL | match 0u8 {
| ^^^ pattern `128u8..=std::u8::MAX` not covered
| ^^^ pattern `128u8..=u8::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=std::u8::MAX, Some(_))` not covered
error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=u8::MAX, Some(_))` not covered
--> $DIR/exhaustive_integer_patterns.rs:121:11
|
LL | match (0u8, Some(())) {
| ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=std::u8::MAX, Some(_))` not covered
| ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=u8::MAX, Some(_))` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(u8, std::option::Option<()>)`
@ -102,20 +102,20 @@ note: the lint level is defined here
LL | #![deny(overlapping_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
error[E0004]: non-exhaustive patterns: `std::u128::MAX` not covered
error[E0004]: non-exhaustive patterns: `u128::MAX` not covered
--> $DIR/exhaustive_integer_patterns.rs:146:11
|
LL | match 0u128 {
| ^^^^^ pattern `std::u128::MAX` not covered
| ^^^^^ pattern `u128::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
error[E0004]: non-exhaustive patterns: `5u128..=std::u128::MAX` not covered
error[E0004]: non-exhaustive patterns: `5u128..=u128::MAX` not covered
--> $DIR/exhaustive_integer_patterns.rs:150:11
|
LL | match 0u128 {
| ^^^^^ pattern `5u128..=std::u128::MAX` not covered
| ^^^^^ pattern `5u128..=u128::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`

View File

@ -1,8 +1,8 @@
error[E0004]: non-exhaustive patterns: `&[0u8..=64u8, _, _, _]` and `&[66u8..=std::u8::MAX, _, _, _]` not covered
error[E0004]: non-exhaustive patterns: `&[0u8..=64u8, _, _, _]` and `&[66u8..=u8::MAX, _, _, _]` not covered
--> $DIR/match-byte-array-patterns-2.rs:4:11
|
LL | match buf {
| ^^^ patterns `&[0u8..=64u8, _, _, _]` and `&[66u8..=std::u8::MAX, _, _, _]` not covered
| ^^^ patterns `&[0u8..=64u8, _, _, _]` and `&[66u8..=u8::MAX, _, _, _]` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `&[u8; 4]`

View File

@ -1,8 +1,8 @@
error[E0004]: non-exhaustive patterns: `std::i32::MIN..=0i32` and `2i32..=std::i32::MAX` not covered
error[E0004]: non-exhaustive patterns: `i32::MIN..=0i32` and `2i32..=i32::MAX` not covered
--> $DIR/match-non-exhaustive.rs:2:11
|
LL | match 0 { 1 => () }
| ^ patterns `std::i32::MIN..=0i32` and `2i32..=std::i32::MAX` not covered
| ^ patterns `i32::MIN..=0i32` and `2i32..=i32::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i32`

View File

@ -11,8 +11,8 @@ fn main() {
match Some(10) { //~ ERROR non-exhaustive patterns: `Some(_)` not covered
None => {}
}
match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, std::i32::MIN..=3i32)`
// and `(_, _, 5i32..=std::i32::MAX)` not covered
match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, i32::MIN..=3i32)`
// and `(_, _, 5i32..=i32::MAX)` not covered
(_, _, 4) => {}
}
match (T::A, T::A) { //~ ERROR non-exhaustive patterns: `(A, A)` not covered

View File

@ -36,11 +36,11 @@ LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `std::option::Option<i32>`
error[E0004]: non-exhaustive patterns: `(_, _, std::i32::MIN..=3i32)` and `(_, _, 5i32..=std::i32::MAX)` not covered
error[E0004]: non-exhaustive patterns: `(_, _, i32::MIN..=3i32)` and `(_, _, 5i32..=i32::MAX)` not covered
--> $DIR/non-exhaustive-match.rs:14:11
|
LL | match (2, 3, 4) {
| ^^^^^^^^^ patterns `(_, _, std::i32::MIN..=3i32)` and `(_, _, 5i32..=std::i32::MAX)` not covered
| ^^^^^^^^^ patterns `(_, _, i32::MIN..=3i32)` and `(_, _, 5i32..=i32::MAX)` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(i32, i32, i32)`

View File

@ -5,5 +5,5 @@ fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) { }
fn main() {
let (1, (Some(1), 2..=3)) = (1, (None, 2));
//~^ ERROR refutable pattern in local binding: `(std::i32::MIN..=0i32, _)` and `(2i32..=std::i32::MAX, _)` not covered
//~^ ERROR refutable pattern in local binding: `(i32::MIN..=0i32, _)` and `(2i32..=i32::MAX, _)` not covered
}

View File

@ -6,11 +6,11 @@ LL | fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) { }
|
= note: the matched value is of type `(isize, (std::option::Option<isize>, isize))`
error[E0005]: refutable pattern in local binding: `(std::i32::MIN..=0i32, _)` and `(2i32..=std::i32::MAX, _)` not covered
error[E0005]: refutable pattern in local binding: `(i32::MIN..=0i32, _)` and `(2i32..=i32::MAX, _)` not covered
--> $DIR/refutable-pattern-errors.rs:7:9
|
LL | let (1, (Some(1), 2..=3)) = (1, (None, 2));
| ^^^^^^^^^^^^^^^^^^^^^ patterns `(std::i32::MIN..=0i32, _)` and `(2i32..=std::i32::MAX, _)` not covered
| ^^^^^^^^^^^^^^^^^^^^^ patterns `(i32::MIN..=0i32, _)` and `(2i32..=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,17 +1,17 @@
error[E0004]: non-exhaustive patterns: `std::isize::MIN..=-6isize` and `21isize..=std::isize::MAX` not covered
error[E0004]: non-exhaustive patterns: `isize::MIN..=-6isize` and `21isize..=isize::MAX` not covered
--> $DIR/precise_pointer_size_matching.rs:24:11
|
LL | match 0isize {
| ^^^^^^ patterns `std::isize::MIN..=-6isize` and `21isize..=std::isize::MAX` not covered
| ^^^^^^ patterns `isize::MIN..=-6isize` and `21isize..=isize::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `isize`
error[E0004]: non-exhaustive patterns: `0usize` and `21usize..=std::usize::MAX` not covered
error[E0004]: non-exhaustive patterns: `0usize` and `21usize..=usize::MAX` not covered
--> $DIR/precise_pointer_size_matching.rs:29:11
|
LL | match 0usize {
| ^^^^^^ patterns `0usize` and `21usize..=std::usize::MAX` not covered
| ^^^^^^ patterns `0usize` and `21usize..=usize::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `usize`

View File

@ -1,6 +1,6 @@
fn main() {
let A = 3;
//~^ ERROR refutable pattern in local binding: `std::i32::MIN..=1i32` and
//~^ ERROR refutable pattern in local binding: `i32::MIN..=1i32` and
//~| interpreted as a constant pattern, not a new variable
//~| HELP introduce a variable instead
//~| SUGGESTION a_var

View File

@ -1,4 +1,4 @@
error[E0005]: refutable pattern in local binding: `std::i32::MIN..=1i32` and `3i32..=std::i32::MAX` not covered
error[E0005]: refutable pattern in local binding: `i32::MIN..=1i32` and `3i32..=i32::MAX` not covered
--> $DIR/const-pat-non-exaustive-let-new-var.rs:2:9
|
LL | let A = 3;

View File

@ -42,6 +42,7 @@ Hey Windows Group! This bug has been identified as a good "Windows candidate".
In case it's useful, here are some [instructions] for tackling these sorts of
bugs. Maybe take a look?
Thanks! <3
[instructions]: https://rustc-dev-guide.rust-lang.org/notification-groups/windows.html
"""
label = "O-windows"
@ -52,6 +53,7 @@ Hey ARM Group! This bug has been identified as a good "ARM candidate".
In case it's useful, here are some [instructions] for tackling these sorts of
bugs. Maybe take a look?
Thanks! <3
[instructions]: https://rustc-dev-guide.rust-lang.org/notification-groups/arm.html
"""
label = "O-ARM"