remove StructuralEq trait
This commit is contained in:
parent
a58ec8ff03
commit
0df7810734
76 changed files with 273 additions and 536 deletions
|
@ -19,19 +19,6 @@ pub fn expand_deriving_eq(
|
||||||
) {
|
) {
|
||||||
let span = cx.with_def_site_ctxt(span);
|
let span = cx.with_def_site_ctxt(span);
|
||||||
|
|
||||||
let structural_trait_def = TraitDef {
|
|
||||||
span,
|
|
||||||
path: path_std!(marker::StructuralEq),
|
|
||||||
skip_path_as_bound: true, // crucial!
|
|
||||||
needs_copy_as_bound_if_packed: false,
|
|
||||||
additional_bounds: Vec::new(),
|
|
||||||
supports_unions: true,
|
|
||||||
methods: Vec::new(),
|
|
||||||
associated_types: Vec::new(),
|
|
||||||
is_const: false,
|
|
||||||
};
|
|
||||||
structural_trait_def.expand(cx, mitem, item, push);
|
|
||||||
|
|
||||||
let trait_def = TraitDef {
|
let trait_def = TraitDef {
|
||||||
span,
|
span,
|
||||||
path: path_std!(cmp::Eq),
|
path: path_std!(cmp::Eq),
|
||||||
|
|
|
@ -104,9 +104,6 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
|
||||||
#[lang = "structural_peq"]
|
#[lang = "structural_peq"]
|
||||||
pub trait StructuralPartialEq {}
|
pub trait StructuralPartialEq {}
|
||||||
|
|
||||||
#[lang = "structural_teq"]
|
|
||||||
pub trait StructuralEq {}
|
|
||||||
|
|
||||||
#[lang = "not"]
|
#[lang = "not"]
|
||||||
pub trait Not {
|
pub trait Not {
|
||||||
type Output;
|
type Output;
|
||||||
|
|
|
@ -100,9 +100,6 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
|
||||||
#[lang = "structural_peq"]
|
#[lang = "structural_peq"]
|
||||||
pub trait StructuralPartialEq {}
|
pub trait StructuralPartialEq {}
|
||||||
|
|
||||||
#[lang = "structural_teq"]
|
|
||||||
pub trait StructuralEq {}
|
|
||||||
|
|
||||||
#[lang = "not"]
|
#[lang = "not"]
|
||||||
pub trait Not {
|
pub trait Not {
|
||||||
type Output;
|
type Output;
|
||||||
|
|
|
@ -61,9 +61,6 @@ mod libc {
|
||||||
#[lang = "structural_peq"]
|
#[lang = "structural_peq"]
|
||||||
pub trait StructuralPartialEq {}
|
pub trait StructuralPartialEq {}
|
||||||
|
|
||||||
#[lang = "structural_teq"]
|
|
||||||
pub trait StructuralEq {}
|
|
||||||
|
|
||||||
#[lang = "drop_in_place"]
|
#[lang = "drop_in_place"]
|
||||||
#[allow(unconditional_recursion)]
|
#[allow(unconditional_recursion)]
|
||||||
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
|
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
|
||||||
|
|
|
@ -138,7 +138,7 @@ pub(crate) fn const_to_valtree_inner<'tcx>(
|
||||||
}
|
}
|
||||||
// Trait objects are not allowed in type level constants, as we have no concept for
|
// Trait objects are not allowed in type level constants, as we have no concept for
|
||||||
// resolving their backing type, even if we can do that at const eval time. We may
|
// resolving their backing type, even if we can do that at const eval time. We may
|
||||||
// hypothetically be able to allow `dyn StructuralEq` trait objects in the future,
|
// hypothetically be able to allow `dyn StructuralPartialEq` trait objects in the future,
|
||||||
// but it is unclear if this is useful.
|
// but it is unclear if this is useful.
|
||||||
ty::Dynamic(..) => Err(ValTreeCreationError::NonSupportedType),
|
ty::Dynamic(..) => Err(ValTreeCreationError::NonSupportedType),
|
||||||
|
|
||||||
|
|
|
@ -143,8 +143,6 @@ language_item_table! {
|
||||||
Unsize, sym::unsize, unsize_trait, Target::Trait, GenericRequirement::Minimum(1);
|
Unsize, sym::unsize, unsize_trait, Target::Trait, GenericRequirement::Minimum(1);
|
||||||
/// Trait injected by `#[derive(PartialEq)]`, (i.e. "Partial EQ").
|
/// Trait injected by `#[derive(PartialEq)]`, (i.e. "Partial EQ").
|
||||||
StructuralPeq, sym::structural_peq, structural_peq_trait, Target::Trait, GenericRequirement::None;
|
StructuralPeq, sym::structural_peq, structural_peq_trait, Target::Trait, GenericRequirement::None;
|
||||||
/// Trait injected by `#[derive(Eq)]`, (i.e. "Total EQ"; no, I will not apologize).
|
|
||||||
StructuralTeq, sym::structural_teq, structural_teq_trait, Target::Trait, GenericRequirement::None;
|
|
||||||
Copy, sym::copy, copy_trait, Target::Trait, GenericRequirement::Exact(0);
|
Copy, sym::copy, copy_trait, Target::Trait, GenericRequirement::Exact(0);
|
||||||
Clone, sym::clone, clone_trait, Target::Trait, GenericRequirement::None;
|
Clone, sym::clone, clone_trait, Target::Trait, GenericRequirement::None;
|
||||||
Sync, sym::sync, sync_trait, Target::Trait, GenericRequirement::Exact(0);
|
Sync, sym::sync, sync_trait, Target::Trait, GenericRequirement::Exact(0);
|
||||||
|
|
|
@ -1347,9 +1347,9 @@ rustc_queries! {
|
||||||
///
|
///
|
||||||
/// This is only correct for ADTs. Call `is_structural_eq_shallow` to handle all types
|
/// This is only correct for ADTs. Call `is_structural_eq_shallow` to handle all types
|
||||||
/// correctly.
|
/// correctly.
|
||||||
query has_structural_eq_impls(ty: Ty<'tcx>) -> bool {
|
query has_structural_eq_impl(ty: Ty<'tcx>) -> bool {
|
||||||
desc {
|
desc {
|
||||||
"computing whether `{}` implements `PartialStructuralEq` and `StructuralEq`",
|
"computing whether `{}` implements `StructuralPartialEq`",
|
||||||
ty
|
ty
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1249,19 +1249,18 @@ impl<'tcx> Ty<'tcx> {
|
||||||
/// Primitive types (`u32`, `str`) have structural equality by definition. For composite data
|
/// 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
|
/// 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
|
/// between all components (fields, array elements, etc.) of that type. For ADTs, structural
|
||||||
/// equality is indicated by an implementation of `PartialStructuralEq` and `StructuralEq` for
|
/// equality is indicated by an implementation of `StructuralPartialEq` for that type.
|
||||||
/// that type.
|
|
||||||
///
|
///
|
||||||
/// This function is "shallow" because it may return `true` for a composite type whose fields
|
/// 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`
|
/// are not `StructuralPartialEq`. 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
|
/// 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
|
/// 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.
|
/// down, you will need to use a type visitor.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_structural_eq_shallow(self, tcx: TyCtxt<'tcx>) -> bool {
|
pub fn is_structural_eq_shallow(self, tcx: TyCtxt<'tcx>) -> bool {
|
||||||
match self.kind() {
|
match self.kind() {
|
||||||
// Look for an impl of both `PartialStructuralEq` and `StructuralEq`.
|
// Look for an impl of `StructuralPartialEq`.
|
||||||
ty::Adt(..) => tcx.has_structural_eq_impls(self),
|
ty::Adt(..) => tcx.has_structural_eq_impl(self),
|
||||||
|
|
||||||
// Primitive types that satisfy `Eq`.
|
// Primitive types that satisfy `Eq`.
|
||||||
ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Str | ty::Never => true,
|
ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Str | ty::Never => true,
|
||||||
|
|
|
@ -110,7 +110,7 @@ mir_build_extern_static_requires_unsafe_unsafe_op_in_unsafe_fn_allowed =
|
||||||
mir_build_float_pattern = floating-point types cannot be used in patterns
|
mir_build_float_pattern = floating-point types cannot be used in patterns
|
||||||
|
|
||||||
mir_build_indirect_structural_match =
|
mir_build_indirect_structural_match =
|
||||||
to use a constant of type `{$non_sm_ty}` in a pattern, `{$non_sm_ty}` must be annotated with `#[derive(PartialEq, Eq)]`
|
to use a constant of type `{$non_sm_ty}` in a pattern, `{$non_sm_ty}` must be annotated with `#[derive(PartialEq)]`
|
||||||
|
|
||||||
mir_build_inform_irrefutable = `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
|
mir_build_inform_irrefutable = `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ mir_build_non_partial_eq_match =
|
||||||
to use a constant of type `{$non_peq_ty}` in a pattern, the type must implement `PartialEq`
|
to use a constant of type `{$non_peq_ty}` in a pattern, the type must implement `PartialEq`
|
||||||
|
|
||||||
mir_build_nontrivial_structural_match =
|
mir_build_nontrivial_structural_match =
|
||||||
to use a constant of type `{$non_sm_ty}` in a pattern, the constant's initializer must be trivial or `{$non_sm_ty}` must be annotated with `#[derive(PartialEq, Eq)]`
|
to use a constant of type `{$non_sm_ty}` in a pattern, the constant's initializer must be trivial or `{$non_sm_ty}` must be annotated with `#[derive(PartialEq)]`
|
||||||
|
|
||||||
mir_build_pattern_not_covered = refutable pattern in {$origin}
|
mir_build_pattern_not_covered = refutable pattern in {$origin}
|
||||||
.pattern_ty = the matched value is of type `{$pattern_ty}`
|
.pattern_ty = the matched value is of type `{$pattern_ty}`
|
||||||
|
@ -297,9 +297,9 @@ mir_build_trailing_irrefutable_let_patterns = trailing irrefutable {$count ->
|
||||||
} into the body
|
} into the body
|
||||||
|
|
||||||
mir_build_type_not_structural =
|
mir_build_type_not_structural =
|
||||||
to use a constant of type `{$non_sm_ty}` in a pattern, `{$non_sm_ty}` must be annotated with `#[derive(PartialEq, Eq)]`
|
to use a constant of type `{$non_sm_ty}` in a pattern, `{$non_sm_ty}` must be annotated with `#[derive(PartialEq)]`
|
||||||
|
|
||||||
mir_build_type_not_structural_more_info = see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
|
mir_build_type_not_structural_more_info = see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
mir_build_type_not_structural_tip = the traits must be derived, manual `impl`s are not sufficient
|
mir_build_type_not_structural_tip = the traits must be derived, manual `impl`s are not sufficient
|
||||||
|
|
||||||
|
|
|
@ -310,7 +310,6 @@ symbols! {
|
||||||
Some,
|
Some,
|
||||||
SpanCtxt,
|
SpanCtxt,
|
||||||
String,
|
String,
|
||||||
StructuralEq,
|
|
||||||
StructuralPartialEq,
|
StructuralPartialEq,
|
||||||
SubdiagnosticMessage,
|
SubdiagnosticMessage,
|
||||||
Sync,
|
Sync,
|
||||||
|
@ -1616,7 +1615,6 @@ symbols! {
|
||||||
struct_variant,
|
struct_variant,
|
||||||
structural_match,
|
structural_match,
|
||||||
structural_peq,
|
structural_peq,
|
||||||
structural_teq,
|
|
||||||
sub,
|
sub,
|
||||||
sub_assign,
|
sub_assign,
|
||||||
sub_with_overflow,
|
sub_with_overflow,
|
||||||
|
|
|
@ -39,7 +39,7 @@ pub fn search_for_structural_match_violation<'tcx>(
|
||||||
|
|
||||||
/// This implements the traversal over the structure of a given type to try to
|
/// This implements the traversal over the structure of a given type to try to
|
||||||
/// find instances of ADTs (specifically structs or enums) that do not implement
|
/// find instances of ADTs (specifically structs or enums) that do not implement
|
||||||
/// the structural-match traits (`StructuralPartialEq` and `StructuralEq`).
|
/// `StructuralPartialEq`.
|
||||||
struct Search<'tcx> {
|
struct Search<'tcx> {
|
||||||
span: Span,
|
span: Span,
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,12 @@ use rustc_infer::infer::TyCtxtInferExt;
|
||||||
use rustc_trait_selection::traits::{ObligationCause, ObligationCtxt};
|
use rustc_trait_selection::traits::{ObligationCause, ObligationCtxt};
|
||||||
|
|
||||||
/// This method returns true if and only if `adt_ty` itself has been marked as
|
/// This method returns true if and only if `adt_ty` itself has been marked as
|
||||||
/// eligible for structural-match: namely, if it implements both
|
/// eligible for structural-match: namely, if it implements
|
||||||
/// `StructuralPartialEq` and `StructuralEq` (which are respectively injected by
|
/// `StructuralPartialEq` (which is injected by `#[derive(PartialEq)]`).
|
||||||
/// `#[derive(PartialEq)]` and `#[derive(Eq)]`).
|
|
||||||
///
|
///
|
||||||
/// Note that this does *not* recursively check if the substructure of `adt_ty`
|
/// Note that this does *not* recursively check if the substructure of `adt_ty`
|
||||||
/// implements the traits.
|
/// implements the trait.
|
||||||
fn has_structural_eq_impls<'tcx>(tcx: TyCtxt<'tcx>, adt_ty: Ty<'tcx>) -> bool {
|
fn has_structural_eq_impl<'tcx>(tcx: TyCtxt<'tcx>, adt_ty: Ty<'tcx>) -> bool {
|
||||||
let infcx = &tcx.infer_ctxt().build();
|
let infcx = &tcx.infer_ctxt().build();
|
||||||
let cause = ObligationCause::dummy();
|
let cause = ObligationCause::dummy();
|
||||||
|
|
||||||
|
@ -21,11 +20,6 @@ fn has_structural_eq_impls<'tcx>(tcx: TyCtxt<'tcx>, adt_ty: Ty<'tcx>) -> bool {
|
||||||
let structural_peq_def_id =
|
let structural_peq_def_id =
|
||||||
infcx.tcx.require_lang_item(LangItem::StructuralPeq, Some(cause.span));
|
infcx.tcx.require_lang_item(LangItem::StructuralPeq, Some(cause.span));
|
||||||
ocx.register_bound(cause.clone(), ty::ParamEnv::empty(), adt_ty, structural_peq_def_id);
|
ocx.register_bound(cause.clone(), ty::ParamEnv::empty(), adt_ty, structural_peq_def_id);
|
||||||
// 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 structural_teq_def_id =
|
|
||||||
infcx.tcx.require_lang_item(LangItem::StructuralTeq, Some(cause.span));
|
|
||||||
ocx.register_bound(cause, ty::ParamEnv::empty(), adt_ty, structural_teq_def_id);
|
|
||||||
|
|
||||||
// We deliberately skip *reporting* fulfillment errors (via
|
// We deliberately skip *reporting* fulfillment errors (via
|
||||||
// `report_fulfillment_errors`), for two reasons:
|
// `report_fulfillment_errors`), for two reasons:
|
||||||
|
@ -40,5 +34,5 @@ fn has_structural_eq_impls<'tcx>(tcx: TyCtxt<'tcx>, adt_ty: Ty<'tcx>) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn provide(providers: &mut Providers) {
|
pub(crate) fn provide(providers: &mut Providers) {
|
||||||
providers.has_structural_eq_impls = has_structural_eq_impls;
|
providers.has_structural_eq_impl = has_structural_eq_impl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ pub trait Unsize<T: ?Sized> {
|
||||||
/// Required trait for constants used in pattern matches.
|
/// Required trait for constants used in pattern matches.
|
||||||
///
|
///
|
||||||
/// Any type that derives `PartialEq` automatically implements this trait,
|
/// Any type that derives `PartialEq` automatically implements this trait,
|
||||||
/// *regardless* of whether its type-parameters implement `Eq`.
|
/// *regardless* of whether its type-parameters implement `PartialEq`.
|
||||||
///
|
///
|
||||||
/// If a `const` item contains some type that does not implement this trait,
|
/// If a `const` item contains some type that does not implement this trait,
|
||||||
/// then that type either (1.) does not implement `PartialEq` (which means the
|
/// then that type either (1.) does not implement `PartialEq` (which means the
|
||||||
|
@ -200,7 +200,7 @@ pub trait Unsize<T: ?Sized> {
|
||||||
/// a pattern match.
|
/// a pattern match.
|
||||||
///
|
///
|
||||||
/// See also the [structural match RFC][RFC1445], and [issue 63438] which
|
/// See also the [structural match RFC][RFC1445], and [issue 63438] which
|
||||||
/// motivated migrating from attribute-based design to this trait.
|
/// motivated migrating from an attribute-based design to this trait.
|
||||||
///
|
///
|
||||||
/// [RFC1445]: https://github.com/rust-lang/rfcs/blob/master/text/1445-restrict-constants-in-patterns.md
|
/// [RFC1445]: https://github.com/rust-lang/rfcs/blob/master/text/1445-restrict-constants-in-patterns.md
|
||||||
/// [issue 63438]: https://github.com/rust-lang/rust/issues/63438
|
/// [issue 63438]: https://github.com/rust-lang/rust/issues/63438
|
||||||
|
@ -218,7 +218,7 @@ marker_impls! {
|
||||||
isize, i8, i16, i32, i64, i128,
|
isize, i8, i16, i32, i64, i128,
|
||||||
bool,
|
bool,
|
||||||
char,
|
char,
|
||||||
str /* Technically requires `[u8]: StructuralEq` */,
|
str /* Technically requires `[u8]: StructuralPartialEq` */,
|
||||||
(),
|
(),
|
||||||
{T, const N: usize} [T; N],
|
{T, const N: usize} [T; N],
|
||||||
{T} [T],
|
{T} [T],
|
||||||
|
@ -275,6 +275,7 @@ marker_impls! {
|
||||||
#[unstable(feature = "structural_match", issue = "31434")]
|
#[unstable(feature = "structural_match", issue = "31434")]
|
||||||
#[diagnostic::on_unimplemented(message = "the type `{Self}` does not `#[derive(Eq)]`")]
|
#[diagnostic::on_unimplemented(message = "the type `{Self}` does not `#[derive(Eq)]`")]
|
||||||
#[lang = "structural_teq"]
|
#[lang = "structural_teq"]
|
||||||
|
#[cfg(bootstrap)]
|
||||||
pub trait StructuralEq {
|
pub trait StructuralEq {
|
||||||
// Empty.
|
// Empty.
|
||||||
}
|
}
|
||||||
|
@ -282,6 +283,7 @@ pub trait StructuralEq {
|
||||||
// FIXME: Remove special cases of these types from the compiler pattern checking code and always check `T: StructuralEq` instead
|
// FIXME: Remove special cases of these types from the compiler pattern checking code and always check `T: StructuralEq` instead
|
||||||
marker_impls! {
|
marker_impls! {
|
||||||
#[unstable(feature = "structural_match", issue = "31434")]
|
#[unstable(feature = "structural_match", issue = "31434")]
|
||||||
|
#[cfg(bootstrap)]
|
||||||
StructuralEq for
|
StructuralEq for
|
||||||
usize, u8, u16, u32, u64, u128,
|
usize, u8, u16, u32, u64, u128,
|
||||||
isize, i8, i16, i32, i64, i128,
|
isize, i8, i16, i32, i64, i128,
|
||||||
|
@ -859,6 +861,7 @@ impl<T: ?Sized> Default for PhantomData<T> {
|
||||||
impl<T: ?Sized> StructuralPartialEq for PhantomData<T> {}
|
impl<T: ?Sized> StructuralPartialEq for PhantomData<T> {}
|
||||||
|
|
||||||
#[unstable(feature = "structural_match", issue = "31434")]
|
#[unstable(feature = "structural_match", issue = "31434")]
|
||||||
|
#[cfg(bootstrap)]
|
||||||
impl<T: ?Sized> StructuralEq for PhantomData<T> {}
|
impl<T: ?Sized> StructuralEq for PhantomData<T> {}
|
||||||
|
|
||||||
/// Compiler-internal trait used to indicate the type of enum discriminants.
|
/// Compiler-internal trait used to indicate the type of enum discriminants.
|
||||||
|
@ -1038,6 +1041,20 @@ pub trait PointerLike {}
|
||||||
#[unstable(feature = "adt_const_params", issue = "95174")]
|
#[unstable(feature = "adt_const_params", issue = "95174")]
|
||||||
#[diagnostic::on_unimplemented(message = "`{Self}` can't be used as a const parameter type")]
|
#[diagnostic::on_unimplemented(message = "`{Self}` can't be used as a const parameter type")]
|
||||||
#[allow(multiple_supertrait_upcastable)]
|
#[allow(multiple_supertrait_upcastable)]
|
||||||
|
#[cfg(not(bootstrap))]
|
||||||
|
pub trait ConstParamTy: StructuralPartialEq + Eq {}
|
||||||
|
|
||||||
|
/// A marker for types which can be used as types of `const` generic parameters.
|
||||||
|
///
|
||||||
|
/// These types must have a proper equivalence relation (`Eq`) and it must be automatically
|
||||||
|
/// derived (`StructuralPartialEq`). There's a hard-coded check in the compiler ensuring
|
||||||
|
/// that all fields are also `ConstParamTy`, which implies that recursively, all fields
|
||||||
|
/// are `StructuralPartialEq`.
|
||||||
|
#[lang = "const_param_ty"]
|
||||||
|
#[unstable(feature = "adt_const_params", issue = "95174")]
|
||||||
|
#[rustc_on_unimplemented(message = "`{Self}` can't be used as a const parameter type")]
|
||||||
|
#[allow(multiple_supertrait_upcastable)]
|
||||||
|
#[cfg(bootstrap)]
|
||||||
pub trait ConstParamTy: StructuralEq + StructuralPartialEq + Eq {}
|
pub trait ConstParamTy: StructuralEq + StructuralPartialEq + Eq {}
|
||||||
|
|
||||||
/// Derive macro generating an impl of the trait `ConstParamTy`.
|
/// Derive macro generating an impl of the trait `ConstParamTy`.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use crate::cmp::Ordering::{self, *};
|
use crate::cmp::Ordering::{self, *};
|
||||||
use crate::marker::ConstParamTy;
|
use crate::marker::ConstParamTy;
|
||||||
use crate::marker::{StructuralEq, StructuralPartialEq};
|
use crate::marker::StructuralPartialEq;
|
||||||
|
|
||||||
// Recursive macro for implementing n-ary tuple functions and operations
|
// Recursive macro for implementing n-ary tuple functions and operations
|
||||||
//
|
//
|
||||||
|
@ -64,7 +64,8 @@ macro_rules! tuple_impls {
|
||||||
maybe_tuple_doc! {
|
maybe_tuple_doc! {
|
||||||
$($T)+ @
|
$($T)+ @
|
||||||
#[unstable(feature = "structural_match", issue = "31434")]
|
#[unstable(feature = "structural_match", issue = "31434")]
|
||||||
impl<$($T),+> StructuralEq for ($($T,)+)
|
#[cfg(bootstrap)]
|
||||||
|
impl<$($T),+> crate::marker::StructuralEq for ($($T,)+)
|
||||||
{}
|
{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,6 @@ fn main() {
|
||||||
// This used to cause an ICE (https://github.com/rust-lang/rust/issues/78071)
|
// This used to cause an ICE (https://github.com/rust-lang/rust/issues/78071)
|
||||||
match FOO_REF_REF {
|
match FOO_REF_REF {
|
||||||
FOO_REF_REF => {},
|
FOO_REF_REF => {},
|
||||||
//~^ ERROR: to use a constant of type `Foo` in a pattern, `Foo` must be annotated
|
|
||||||
//~| NOTE: for more information, see issue #62411 <https://github.com/rust-lang/ru
|
|
||||||
Foo(_) => {},
|
Foo(_) => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
--> $DIR/ice-6254.rs:13:9
|
|
||||||
|
|
|
||||||
LL | FOO_REF_REF => {},
|
|
||||||
| ^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
|
||||||
= 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
|
|
||||||
= note: `-D indirect-structural-match` implied by `-D warnings`
|
|
||||||
= help: to override `-D warnings` add `#[allow(indirect_structural_match)]`
|
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
|
||||||
|
|
|
@ -8,13 +8,11 @@ impl std::marker::ConstParamTy for ImplementsConstParamTy {}
|
||||||
struct CantParam(ImplementsConstParamTy);
|
struct CantParam(ImplementsConstParamTy);
|
||||||
|
|
||||||
impl std::marker::ConstParamTy for CantParam {}
|
impl std::marker::ConstParamTy for CantParam {}
|
||||||
//~^ error: the type `CantParam` does not `#[derive(Eq)]`
|
//~^ error: the type `CantParam` does not `#[derive(PartialEq)]`
|
||||||
//~| error: the type `CantParam` does not `#[derive(PartialEq)]`
|
|
||||||
//~| the trait bound `CantParam: Eq` is not satisfied
|
//~| the trait bound `CantParam: Eq` is not satisfied
|
||||||
|
|
||||||
#[derive(std::marker::ConstParamTy)]
|
#[derive(std::marker::ConstParamTy)]
|
||||||
//~^ error: the type `CantParamDerive` does not `#[derive(Eq)]`
|
//~^ error: the type `CantParamDerive` does not `#[derive(PartialEq)]`
|
||||||
//~| error: the type `CantParamDerive` does not `#[derive(PartialEq)]`
|
|
||||||
//~| the trait bound `CantParamDerive: Eq` is not satisfied
|
//~| the trait bound `CantParamDerive: Eq` is not satisfied
|
||||||
struct CantParamDerive(ImplementsConstParamTy);
|
struct CantParamDerive(ImplementsConstParamTy);
|
||||||
|
|
||||||
|
|
|
@ -21,17 +21,8 @@ LL | impl std::marker::ConstParamTy for CantParam {}
|
||||||
note: required by a bound in `ConstParamTy`
|
note: required by a bound in `ConstParamTy`
|
||||||
--> $SRC_DIR/core/src/marker.rs:LL:COL
|
--> $SRC_DIR/core/src/marker.rs:LL:COL
|
||||||
|
|
||||||
error[E0277]: the type `CantParam` does not `#[derive(Eq)]`
|
|
||||||
--> $DIR/const_param_ty_impl_no_structural_eq.rs:10:36
|
|
||||||
|
|
|
||||||
LL | impl std::marker::ConstParamTy for CantParam {}
|
|
||||||
| ^^^^^^^^^ the trait `StructuralEq` is not implemented for `CantParam`
|
|
||||||
|
|
|
||||||
note: required by a bound in `ConstParamTy`
|
|
||||||
--> $SRC_DIR/core/src/marker.rs:LL:COL
|
|
||||||
|
|
||||||
error[E0277]: the trait bound `CantParamDerive: Eq` is not satisfied
|
error[E0277]: the trait bound `CantParamDerive: Eq` is not satisfied
|
||||||
--> $DIR/const_param_ty_impl_no_structural_eq.rs:15:10
|
--> $DIR/const_param_ty_impl_no_structural_eq.rs:14:10
|
||||||
|
|
|
|
||||||
LL | #[derive(std::marker::ConstParamTy)]
|
LL | #[derive(std::marker::ConstParamTy)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `CantParamDerive`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `CantParamDerive`
|
||||||
|
@ -46,7 +37,7 @@ LL | struct CantParamDerive(ImplementsConstParamTy);
|
||||||
|
|
|
|
||||||
|
|
||||||
error[E0277]: the type `CantParamDerive` does not `#[derive(PartialEq)]`
|
error[E0277]: the type `CantParamDerive` does not `#[derive(PartialEq)]`
|
||||||
--> $DIR/const_param_ty_impl_no_structural_eq.rs:15:10
|
--> $DIR/const_param_ty_impl_no_structural_eq.rs:14:10
|
||||||
|
|
|
|
||||||
LL | #[derive(std::marker::ConstParamTy)]
|
LL | #[derive(std::marker::ConstParamTy)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `StructuralPartialEq` is not implemented for `CantParamDerive`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `StructuralPartialEq` is not implemented for `CantParamDerive`
|
||||||
|
@ -55,16 +46,6 @@ note: required by a bound in `ConstParamTy`
|
||||||
--> $SRC_DIR/core/src/marker.rs:LL:COL
|
--> $SRC_DIR/core/src/marker.rs:LL:COL
|
||||||
= note: this error originates in the derive macro `std::marker::ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `std::marker::ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error[E0277]: the type `CantParamDerive` does not `#[derive(Eq)]`
|
error: aborting due to 4 previous errors
|
||||||
--> $DIR/const_param_ty_impl_no_structural_eq.rs:15:10
|
|
||||||
|
|
|
||||||
LL | #[derive(std::marker::ConstParamTy)]
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `StructuralEq` is not implemented for `CantParamDerive`
|
|
||||||
|
|
|
||||||
note: required by a bound in `ConstParamTy`
|
|
||||||
--> $SRC_DIR/core/src/marker.rs:LL:COL
|
|
||||||
= note: this error originates in the derive macro `std::marker::ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
||||||
|
|
||||||
error: aborting due to 6 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0277`.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
#![feature(adt_const_params, structural_match)]
|
#![feature(adt_const_params)]
|
||||||
|
|
||||||
union Union {
|
union Union {
|
||||||
a: u8,
|
a: u8,
|
||||||
|
@ -11,7 +11,6 @@ impl PartialEq for Union {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl Eq for Union {}
|
impl Eq for Union {}
|
||||||
impl std::marker::StructuralEq for Union {}
|
|
||||||
|
|
||||||
impl std::marker::ConstParamTy for Union {}
|
impl std::marker::ConstParamTy for Union {}
|
||||||
//~^ ERROR the type `Union` does not `#[derive(PartialEq)]`
|
//~^ ERROR the type `Union` does not `#[derive(PartialEq)]`
|
||||||
|
@ -28,7 +27,6 @@ impl PartialEq for UnionDerive {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl Eq for UnionDerive {}
|
impl Eq for UnionDerive {}
|
||||||
impl std::marker::StructuralEq for UnionDerive {}
|
|
||||||
|
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error: this trait cannot be derived for unions
|
error: this trait cannot be derived for unions
|
||||||
--> $DIR/const_param_ty_impl_union.rs:19:10
|
--> $DIR/const_param_ty_impl_union.rs:18:10
|
||||||
|
|
|
|
||||||
LL | #[derive(std::marker::ConstParamTy)]
|
LL | #[derive(std::marker::ConstParamTy)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0277]: the type `Union` does not `#[derive(PartialEq)]`
|
error[E0277]: the type `Union` does not `#[derive(PartialEq)]`
|
||||||
--> $DIR/const_param_ty_impl_union.rs:16:36
|
--> $DIR/const_param_ty_impl_union.rs:15:36
|
||||||
|
|
|
|
||||||
LL | impl std::marker::ConstParamTy for Union {}
|
LL | impl std::marker::ConstParamTy for Union {}
|
||||||
| ^^^^^ the trait `StructuralPartialEq` is not implemented for `Union`
|
| ^^^^^ the trait `StructuralPartialEq` is not implemented for `Union`
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error: to use a constant of type `TypeId` in a pattern, `TypeId` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `TypeId` in a pattern, `TypeId` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/typeid-equality-by-subtyping.rs:18:9
|
--> $DIR/typeid-equality-by-subtyping.rs:18:9
|
||||||
|
|
|
|
||||||
LL | WHAT_A_TYPE => 0,
|
LL | WHAT_A_TYPE => 0,
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error: `Inner` is forbidden as the type of a const generic parameter
|
error: `Inner` is forbidden as the type of a const generic parameter
|
||||||
--> $DIR/issue-74950.rs:20:23
|
--> $DIR/issue-74950.rs:19:23
|
||||||
|
|
|
|
||||||
LL | struct Outer<const I: Inner>;
|
LL | struct Outer<const I: Inner>;
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
@ -8,7 +8,7 @@ LL | struct Outer<const I: Inner>;
|
||||||
= help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
|
= help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
|
||||||
|
|
||||||
error: `Inner` is forbidden as the type of a const generic parameter
|
error: `Inner` is forbidden as the type of a const generic parameter
|
||||||
--> $DIR/issue-74950.rs:20:23
|
--> $DIR/issue-74950.rs:19:23
|
||||||
|
|
|
|
||||||
LL | struct Outer<const I: Inner>;
|
LL | struct Outer<const I: Inner>;
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
@ -18,7 +18,7 @@ LL | struct Outer<const I: Inner>;
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||||
|
|
||||||
error: `Inner` is forbidden as the type of a const generic parameter
|
error: `Inner` is forbidden as the type of a const generic parameter
|
||||||
--> $DIR/issue-74950.rs:20:23
|
--> $DIR/issue-74950.rs:19:23
|
||||||
|
|
|
|
||||||
LL | struct Outer<const I: Inner>;
|
LL | struct Outer<const I: Inner>;
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
@ -28,7 +28,7 @@ LL | struct Outer<const I: Inner>;
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||||
|
|
||||||
error: `Inner` is forbidden as the type of a const generic parameter
|
error: `Inner` is forbidden as the type of a const generic parameter
|
||||||
--> $DIR/issue-74950.rs:20:23
|
--> $DIR/issue-74950.rs:19:23
|
||||||
|
|
|
|
||||||
LL | struct Outer<const I: Inner>;
|
LL | struct Outer<const I: Inner>;
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
@ -37,15 +37,5 @@ LL | struct Outer<const I: Inner>;
|
||||||
= help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
|
= help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||||
|
|
||||||
error: `Inner` is forbidden as the type of a const generic parameter
|
error: aborting due to 4 previous errors
|
||||||
--> $DIR/issue-74950.rs:20:23
|
|
||||||
|
|
|
||||||
LL | struct Outer<const I: Inner>;
|
|
||||||
| ^^^^^
|
|
||||||
|
|
|
||||||
= note: the only supported types are integers, `bool` and `char`
|
|
||||||
= help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,11 @@ struct Inner;
|
||||||
// - impl PartialEq
|
// - impl PartialEq
|
||||||
// - impl Eq
|
// - impl Eq
|
||||||
// - impl StructuralPartialEq
|
// - impl StructuralPartialEq
|
||||||
// - impl StructuralEq
|
|
||||||
#[derive(PartialEq, Eq)]
|
#[derive(PartialEq, Eq)]
|
||||||
struct Outer<const I: Inner>;
|
struct Outer<const I: Inner>;
|
||||||
//[min]~^ `Inner` is forbidden
|
//[min]~^ `Inner` is forbidden
|
||||||
//[min]~| `Inner` is forbidden
|
//[min]~| `Inner` is forbidden
|
||||||
//[min]~| `Inner` is forbidden
|
//[min]~| `Inner` is forbidden
|
||||||
//[min]~| `Inner` is forbidden
|
//[min]~| `Inner` is forbidden
|
||||||
//[min]~| `Inner` is forbidden
|
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -11,14 +11,14 @@ fn main() {
|
||||||
let _ = Defaulted;
|
let _ = Defaulted;
|
||||||
match None {
|
match None {
|
||||||
consts::SOME => panic!(),
|
consts::SOME => panic!(),
|
||||||
//~^ must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ must be annotated with `#[derive(PartialEq)]`
|
||||||
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
match None {
|
match None {
|
||||||
<Defaulted as consts::AssocConst>::SOME => panic!(),
|
<Defaulted as consts::AssocConst>::SOME => panic!(),
|
||||||
//~^ must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ must be annotated with `#[derive(PartialEq)]`
|
||||||
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
error: to use a constant of type `CustomEq` in a pattern, `CustomEq` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `CustomEq` in a pattern, `CustomEq` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/cross-crate-fail.rs:13:9
|
--> $DIR/cross-crate-fail.rs:13:9
|
||||||
|
|
|
|
||||||
LL | consts::SOME => panic!(),
|
LL | consts::SOME => panic!(),
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: to use a constant of type `CustomEq` in a pattern, `CustomEq` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `CustomEq` in a pattern, `CustomEq` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/cross-crate-fail.rs:20:9
|
--> $DIR/cross-crate-fail.rs:20:9
|
||||||
|
|
|
|
||||||
LL | <Defaulted as consts::AssocConst>::SOME => panic!(),
|
LL | <Defaulted as consts::AssocConst>::SOME => panic!(),
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,9 @@ const BAR_BAZ: Foo = if 42 == 42 {
|
||||||
fn main() {
|
fn main() {
|
||||||
match Foo::Qux(CustomEq) {
|
match Foo::Qux(CustomEq) {
|
||||||
BAR_BAZ => panic!(),
|
BAR_BAZ => panic!(),
|
||||||
//~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ WARN must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| NOTE the traits must be derived
|
//~| NOTE the traits must be derived
|
||||||
//~| NOTE StructuralEq.html for details
|
//~| NOTE StructuralPartialEq.html for details
|
||||||
//~| WARN this was previously accepted
|
//~| WARN this was previously accepted
|
||||||
//~| NOTE see issue #73448
|
//~| NOTE see issue #73448
|
||||||
//~| NOTE `#[warn(nontrivial_structural_match)]` on by default
|
//~| NOTE `#[warn(nontrivial_structural_match)]` on by default
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
warning: to use a constant of type `CustomEq` in a pattern, the constant's initializer must be trivial or `CustomEq` must be annotated with `#[derive(PartialEq, Eq)]`
|
warning: to use a constant of type `CustomEq` in a pattern, the constant's initializer must be trivial or `CustomEq` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/custom-eq-branch-warn.rs:29:9
|
--> $DIR/custom-eq-branch-warn.rs:29:9
|
||||||
|
|
|
|
||||||
LL | BAR_BAZ => panic!(),
|
LL | BAR_BAZ => panic!(),
|
||||||
|
@ -7,7 +7,7 @@ LL | BAR_BAZ => panic!(),
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #73448 <https://github.com/rust-lang/rust/issues/73448>
|
= note: for more information, see issue #73448 <https://github.com/rust-lang/rust/issues/73448>
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
= note: `#[warn(nontrivial_structural_match)]` on by default
|
= note: `#[warn(nontrivial_structural_match)]` on by default
|
||||||
|
|
||||||
warning: 1 warning emitted
|
warning: 1 warning emitted
|
||||||
|
|
|
@ -7,9 +7,7 @@ const E_SL: &[E] = &[E::A];
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match &[][..] {
|
match &[][..] {
|
||||||
//~^ ERROR non-exhaustive patterns: `&_` not covered [E0004]
|
//~^ ERROR non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered [E0004]
|
||||||
E_SL => {}
|
E_SL => {}
|
||||||
//~^ WARN to use a constant of type `E` in a pattern, `E` must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,16 @@
|
||||||
warning: to use a constant of type `E` in a pattern, `E` must be annotated with `#[derive(PartialEq, Eq)]`
|
error[E0004]: non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered
|
||||||
--> $DIR/incomplete-slice.rs:11:9
|
|
||||||
|
|
|
||||||
LL | E_SL => {}
|
|
||||||
| ^^^^
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
|
||||||
= 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
|
|
||||||
= note: `#[warn(indirect_structural_match)]` on by default
|
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `&_` not covered
|
|
||||||
--> $DIR/incomplete-slice.rs:9:11
|
--> $DIR/incomplete-slice.rs:9:11
|
||||||
|
|
|
|
||||||
LL | match &[][..] {
|
LL | match &[][..] {
|
||||||
| ^^^^^^^ pattern `&_` not covered
|
| ^^^^^^^ patterns `&[]` and `&[_, _, ..]` not covered
|
||||||
|
|
|
|
||||||
= note: the matched value is of type `&[E]`
|
= 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
|
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_SL => {},
|
LL ~ E_SL => {},
|
||||||
LL + &_ => todo!()
|
LL + &[] | &[_, _, ..] => todo!()
|
||||||
|
|
|
|
||||||
|
|
||||||
error: aborting due to 1 previous error; 1 warning emitted
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0004`.
|
For more information about this error, try `rustc --explain E0004`.
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
#![deny(unreachable_patterns)]
|
|
||||||
|
|
||||||
#[derive(PartialEq)]
|
|
||||||
struct Opaque(i32);
|
|
||||||
|
|
||||||
impl Eq for Opaque {}
|
|
||||||
|
|
||||||
const FOO: Opaque = Opaque(42);
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
match FOO {
|
|
||||||
FOO => {},
|
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
error: to use a constant of type `Opaque` in a pattern, `Opaque` must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
--> $DIR/issue-78057.rs:12:9
|
|
||||||
|
|
|
||||||
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: aborting due to 1 previous error
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ const BAR_BAZ: Foo = if 42 == 42 {
|
||||||
fn main() {
|
fn main() {
|
||||||
match Foo::Qux(NoEq) {
|
match Foo::Qux(NoEq) {
|
||||||
BAR_BAZ => panic!(),
|
BAR_BAZ => panic!(),
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/no-eq-branch-fail.rs:21:9
|
--> $DIR/no-eq-branch-fail.rs:21:9
|
||||||
|
|
|
|
||||||
LL | BAR_BAZ => panic!(),
|
LL | BAR_BAZ => panic!(),
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// Eventually this will be rejected (when the future-compat lints are turned into hard errors), and
|
|
||||||
// then this test can be removed. But meanwhile we should ensure that this works and does not ICE.
|
|
||||||
struct NoDerive(#[allow(dead_code)] i32);
|
struct NoDerive(#[allow(dead_code)] i32);
|
||||||
|
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
|
@ -11,8 +9,6 @@ const WRAP_UNSAFE_EMBEDDED: &&WrapEmbedded = &&WrapEmbedded(std::ptr::null());
|
||||||
fn main() {
|
fn main() {
|
||||||
let b = match WRAP_UNSAFE_EMBEDDED {
|
let b = match WRAP_UNSAFE_EMBEDDED {
|
||||||
WRAP_UNSAFE_EMBEDDED => true,
|
WRAP_UNSAFE_EMBEDDED => true,
|
||||||
//~^ WARN: must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
//~| previously accepted
|
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
assert!(b);
|
assert!(b);
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
warning: to use a constant of type `WrapEmbedded` in a pattern, `WrapEmbedded` must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
--> $DIR/null-raw-ptr-issue-119270.rs:13:9
|
|
||||||
|
|
|
||||||
LL | WRAP_UNSAFE_EMBEDDED => true,
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
|
||||||
= 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
|
|
||||||
= note: `#[warn(indirect_structural_match)]` on by default
|
|
||||||
|
|
||||||
warning: 1 warning emitted
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ fn main() {
|
||||||
|
|
||||||
match None {
|
match None {
|
||||||
NO_PARTIAL_EQ_NONE => println!("NO_PARTIAL_EQ_NONE"),
|
NO_PARTIAL_EQ_NONE => println!("NO_PARTIAL_EQ_NONE"),
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
_ => panic!("whoops"),
|
_ => panic!("whoops"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error: to use a constant of type `NoPartialEq` in a pattern, `NoPartialEq` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `NoPartialEq` in a pattern, `NoPartialEq` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/reject_non_partial_eq.rs:28:9
|
--> $DIR/reject_non_partial_eq.rs:28:9
|
||||||
|
|
|
|
||||||
LL | NO_PARTIAL_EQ_NONE => println!("NO_PARTIAL_EQ_NONE"),
|
LL | NO_PARTIAL_EQ_NONE => println!("NO_PARTIAL_EQ_NONE"),
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|
|
@ -40,65 +40,65 @@ fn main() {
|
||||||
|
|
||||||
const ENUM: Derive<NoDerive> = Derive::Some(NoDerive);
|
const ENUM: Derive<NoDerive> = Derive::Some(NoDerive);
|
||||||
match Derive::Some(NoDerive) { ENUM => dbg!(ENUM), _ => panic!("whoops"), };
|
match Derive::Some(NoDerive) { ENUM => dbg!(ENUM), _ => panic!("whoops"), };
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| NOTE the traits must be derived
|
//~| NOTE the traits must be derived
|
||||||
//~| NOTE StructuralEq.html for details
|
//~| NOTE StructuralPartialEq.html for details
|
||||||
|
|
||||||
const FIELD: OND = TrivialEq(Some(NoDerive)).0;
|
const FIELD: OND = TrivialEq(Some(NoDerive)).0;
|
||||||
match Some(NoDerive) { FIELD => dbg!(FIELD), _ => panic!("whoops"), };
|
match Some(NoDerive) { FIELD => dbg!(FIELD), _ => panic!("whoops"), };
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| NOTE the traits must be derived
|
//~| NOTE the traits must be derived
|
||||||
//~| NOTE StructuralEq.html for details
|
//~| NOTE StructuralPartialEq.html for details
|
||||||
|
|
||||||
const NO_DERIVE_SOME: OND = Some(NoDerive);
|
const NO_DERIVE_SOME: OND = Some(NoDerive);
|
||||||
const INDIRECT: OND = NO_DERIVE_SOME;
|
const INDIRECT: OND = NO_DERIVE_SOME;
|
||||||
match Some(NoDerive) {INDIRECT => dbg!(INDIRECT), _ => panic!("whoops"), };
|
match Some(NoDerive) {INDIRECT => dbg!(INDIRECT), _ => panic!("whoops"), };
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| NOTE the traits must be derived
|
//~| NOTE the traits must be derived
|
||||||
//~| NOTE StructuralEq.html for details
|
//~| NOTE StructuralPartialEq.html for details
|
||||||
|
|
||||||
const TUPLE: (OND, OND) = (None, Some(NoDerive));
|
const TUPLE: (OND, OND) = (None, Some(NoDerive));
|
||||||
match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), };
|
match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), };
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| NOTE the traits must be derived
|
//~| NOTE the traits must be derived
|
||||||
//~| NOTE StructuralEq.html for details
|
//~| NOTE StructuralPartialEq.html for details
|
||||||
|
|
||||||
const TYPE_ASCRIPTION: OND = type_ascribe!(Some(NoDerive), OND);
|
const TYPE_ASCRIPTION: OND = type_ascribe!(Some(NoDerive), OND);
|
||||||
match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), };
|
match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), };
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| NOTE the traits must be derived
|
//~| NOTE the traits must be derived
|
||||||
//~| NOTE StructuralEq.html for details
|
//~| NOTE StructuralPartialEq.html for details
|
||||||
|
|
||||||
const ARRAY: [OND; 2] = [None, Some(NoDerive)];
|
const ARRAY: [OND; 2] = [None, Some(NoDerive)];
|
||||||
match [None, Some(NoDerive)] { ARRAY => dbg!(ARRAY), _ => panic!("whoops"), };
|
match [None, Some(NoDerive)] { ARRAY => dbg!(ARRAY), _ => panic!("whoops"), };
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| NOTE the traits must be derived
|
//~| NOTE the traits must be derived
|
||||||
//~| NOTE StructuralEq.html for details
|
//~| NOTE StructuralPartialEq.html for details
|
||||||
|
|
||||||
const REPEAT: [OND; 2] = [Some(NoDerive); 2];
|
const REPEAT: [OND; 2] = [Some(NoDerive); 2];
|
||||||
match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), };
|
match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), };
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| NOTE the traits must be derived
|
//~| NOTE the traits must be derived
|
||||||
//~| NOTE StructuralEq.html for details
|
//~| NOTE StructuralPartialEq.html for details
|
||||||
|
|
||||||
trait Trait: Sized { const ASSOC: Option<Self>; }
|
trait Trait: Sized { const ASSOC: Option<Self>; }
|
||||||
impl Trait for NoDerive { const ASSOC: Option<NoDerive> = Some(NoDerive); }
|
impl Trait for NoDerive { const ASSOC: Option<NoDerive> = Some(NoDerive); }
|
||||||
match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => panic!("whoops"), };
|
match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => panic!("whoops"), };
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| NOTE the traits must be derived
|
//~| NOTE the traits must be derived
|
||||||
//~| NOTE StructuralEq.html for details
|
//~| NOTE StructuralPartialEq.html for details
|
||||||
|
|
||||||
const BLOCK: OND = { NoDerive; Some(NoDerive) };
|
const BLOCK: OND = { NoDerive; Some(NoDerive) };
|
||||||
match Some(NoDerive) { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), };
|
match Some(NoDerive) { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), };
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| NOTE the traits must be derived
|
//~| NOTE the traits must be derived
|
||||||
//~| NOTE StructuralEq.html for details
|
//~| NOTE StructuralPartialEq.html for details
|
||||||
|
|
||||||
const ADDR_OF: &OND = &Some(NoDerive);
|
const ADDR_OF: &OND = &Some(NoDerive);
|
||||||
match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops"), };
|
match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops"), };
|
||||||
//~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ WARN must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| NOTE the traits must be derived
|
//~| NOTE the traits must be derived
|
||||||
//~| NOTE StructuralEq.html for details
|
//~| NOTE StructuralPartialEq.html for details
|
||||||
//~| WARN previously accepted by the compiler but is being phased out
|
//~| WARN previously accepted by the compiler but is being phased out
|
||||||
//~| NOTE for more information, see issue #62411
|
//~| NOTE for more information, see issue #62411
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,85 +1,85 @@
|
||||||
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/reject_non_structural.rs:42:36
|
--> $DIR/reject_non_structural.rs:42:36
|
||||||
|
|
|
|
||||||
LL | match Derive::Some(NoDerive) { ENUM => dbg!(ENUM), _ => panic!("whoops"), };
|
LL | match Derive::Some(NoDerive) { ENUM => dbg!(ENUM), _ => panic!("whoops"), };
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/reject_non_structural.rs:48:28
|
--> $DIR/reject_non_structural.rs:48:28
|
||||||
|
|
|
|
||||||
LL | match Some(NoDerive) { FIELD => dbg!(FIELD), _ => panic!("whoops"), };
|
LL | match Some(NoDerive) { FIELD => dbg!(FIELD), _ => panic!("whoops"), };
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/reject_non_structural.rs:55:27
|
--> $DIR/reject_non_structural.rs:55:27
|
||||||
|
|
|
|
||||||
LL | match Some(NoDerive) {INDIRECT => dbg!(INDIRECT), _ => panic!("whoops"), };
|
LL | match Some(NoDerive) {INDIRECT => dbg!(INDIRECT), _ => panic!("whoops"), };
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/reject_non_structural.rs:61:36
|
--> $DIR/reject_non_structural.rs:61:36
|
||||||
|
|
|
|
||||||
LL | match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), };
|
LL | match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), };
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/reject_non_structural.rs:67:28
|
--> $DIR/reject_non_structural.rs:67:28
|
||||||
|
|
|
|
||||||
LL | match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), };
|
LL | match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), };
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/reject_non_structural.rs:73:36
|
--> $DIR/reject_non_structural.rs:73:36
|
||||||
|
|
|
|
||||||
LL | match [None, Some(NoDerive)] { ARRAY => dbg!(ARRAY), _ => panic!("whoops"), };
|
LL | match [None, Some(NoDerive)] { ARRAY => dbg!(ARRAY), _ => panic!("whoops"), };
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/reject_non_structural.rs:79:33
|
--> $DIR/reject_non_structural.rs:79:33
|
||||||
|
|
|
|
||||||
LL | match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), };
|
LL | match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), };
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/reject_non_structural.rs:86:28
|
--> $DIR/reject_non_structural.rs:86:28
|
||||||
|
|
|
|
||||||
LL | match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => panic!("whoops"), };
|
LL | match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => panic!("whoops"), };
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/reject_non_structural.rs:92:28
|
--> $DIR/reject_non_structural.rs:92:28
|
||||||
|
|
|
|
||||||
LL | match Some(NoDerive) { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), };
|
LL | match Some(NoDerive) { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), };
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/reject_non_structural.rs:98:29
|
--> $DIR/reject_non_structural.rs:98:29
|
||||||
|
|
|
|
||||||
LL | match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops"), };
|
LL | match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops"), };
|
||||||
|
@ -88,7 +88,7 @@ LL | match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops")
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/reject_non_structural.rs:14:9
|
--> $DIR/reject_non_structural.rs:14:9
|
||||||
|
|
|
|
||||||
|
|
|
@ -24,18 +24,18 @@ impl Eq for NoDerive { }
|
||||||
fn main() {
|
fn main() {
|
||||||
const INDEX: Option<NoDerive> = [None, Some(NoDerive(10))][0];
|
const INDEX: Option<NoDerive> = [None, Some(NoDerive(10))][0];
|
||||||
match None { Some(_) => panic!("whoops"), INDEX => dbg!(INDEX), };
|
match None { Some(_) => panic!("whoops"), INDEX => dbg!(INDEX), };
|
||||||
//~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ WARN must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| WARN this was previously accepted
|
//~| WARN this was previously accepted
|
||||||
|
|
||||||
const fn build() -> Option<NoDerive> { None }
|
const fn build() -> Option<NoDerive> { None }
|
||||||
const CALL: Option<NoDerive> = build();
|
const CALL: Option<NoDerive> = build();
|
||||||
match None { Some(_) => panic!("whoops"), CALL => dbg!(CALL), };
|
match None { Some(_) => panic!("whoops"), CALL => dbg!(CALL), };
|
||||||
//~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ WARN must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| WARN this was previously accepted
|
//~| WARN this was previously accepted
|
||||||
|
|
||||||
impl NoDerive { const fn none() -> Option<NoDerive> { None } }
|
impl NoDerive { const fn none() -> Option<NoDerive> { None } }
|
||||||
const METHOD_CALL: Option<NoDerive> = NoDerive::none();
|
const METHOD_CALL: Option<NoDerive> = NoDerive::none();
|
||||||
match None { Some(_) => panic!("whoops"), METHOD_CALL => dbg!(METHOD_CALL), };
|
match None { Some(_) => panic!("whoops"), METHOD_CALL => dbg!(METHOD_CALL), };
|
||||||
//~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ WARN must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| WARN this was previously accepted
|
//~| WARN this was previously accepted
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
warning: to use a constant of type `NoDerive` in a pattern, the constant's initializer must be trivial or `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
warning: to use a constant of type `NoDerive` in a pattern, the constant's initializer must be trivial or `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/warn_corner_cases.rs:26:47
|
--> $DIR/warn_corner_cases.rs:26:47
|
||||||
|
|
|
|
||||||
LL | match None { Some(_) => panic!("whoops"), INDEX => dbg!(INDEX), };
|
LL | match None { Some(_) => panic!("whoops"), INDEX => dbg!(INDEX), };
|
||||||
|
@ -7,10 +7,10 @@ LL | match None { Some(_) => panic!("whoops"), INDEX => dbg!(INDEX), };
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #73448 <https://github.com/rust-lang/rust/issues/73448>
|
= note: for more information, see issue #73448 <https://github.com/rust-lang/rust/issues/73448>
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
= note: `#[warn(nontrivial_structural_match)]` on by default
|
= note: `#[warn(nontrivial_structural_match)]` on by default
|
||||||
|
|
||||||
warning: to use a constant of type `NoDerive` in a pattern, the constant's initializer must be trivial or `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
warning: to use a constant of type `NoDerive` in a pattern, the constant's initializer must be trivial or `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/warn_corner_cases.rs:32:47
|
--> $DIR/warn_corner_cases.rs:32:47
|
||||||
|
|
|
|
||||||
LL | match None { Some(_) => panic!("whoops"), CALL => dbg!(CALL), };
|
LL | match None { Some(_) => panic!("whoops"), CALL => dbg!(CALL), };
|
||||||
|
@ -19,9 +19,9 @@ LL | match None { Some(_) => panic!("whoops"), CALL => dbg!(CALL), };
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #73448 <https://github.com/rust-lang/rust/issues/73448>
|
= note: for more information, see issue #73448 <https://github.com/rust-lang/rust/issues/73448>
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
warning: to use a constant of type `NoDerive` in a pattern, the constant's initializer must be trivial or `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
warning: to use a constant of type `NoDerive` in a pattern, the constant's initializer must be trivial or `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/warn_corner_cases.rs:38:47
|
--> $DIR/warn_corner_cases.rs:38:47
|
||||||
|
|
|
|
||||||
LL | match None { Some(_) => panic!("whoops"), METHOD_CALL => dbg!(METHOD_CALL), };
|
LL | match None { Some(_) => panic!("whoops"), METHOD_CALL => dbg!(METHOD_CALL), };
|
||||||
|
@ -30,7 +30,7 @@ LL | match None { Some(_) => panic!("whoops"), METHOD_CALL => dbg!(METHOD_CA
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #73448 <https://github.com/rust-lang/rust/issues/73448>
|
= note: for more information, see issue #73448 <https://github.com/rust-lang/rust/issues/73448>
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
warning: 3 warnings emitted
|
warning: 3 warnings emitted
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ fn main() {
|
||||||
const C: &S = &S;
|
const C: &S = &S;
|
||||||
match C {
|
match C {
|
||||||
C => {}
|
C => {}
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
}
|
}
|
||||||
const K: &T = &T;
|
const K: &T = &T;
|
||||||
match K {
|
match K {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error: to use a constant of type `S` in a pattern, `S` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `S` in a pattern, `S` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/match_ice.rs:11:9
|
--> $DIR/match_ice.rs:11:9
|
||||||
|
|
|
|
||||||
LL | C => {}
|
LL | C => {}
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,6 @@ impl ::core::cmp::PartialEq for Empty {
|
||||||
fn eq(&self, other: &Empty) -> bool { true }
|
fn eq(&self, other: &Empty) -> bool { true }
|
||||||
}
|
}
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl ::core::marker::StructuralEq for Empty { }
|
|
||||||
#[automatically_derived]
|
|
||||||
impl ::core::cmp::Eq for Empty {
|
impl ::core::cmp::Eq for Empty {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -132,8 +130,6 @@ impl ::core::cmp::PartialEq for Point {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl ::core::marker::StructuralEq for Point { }
|
|
||||||
#[automatically_derived]
|
|
||||||
impl ::core::cmp::Eq for Point {
|
impl ::core::cmp::Eq for Point {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -219,8 +215,6 @@ impl ::core::cmp::PartialEq for PackedPoint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl ::core::marker::StructuralEq for PackedPoint { }
|
|
||||||
#[automatically_derived]
|
|
||||||
impl ::core::cmp::Eq for PackedPoint {
|
impl ::core::cmp::Eq for PackedPoint {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -333,8 +327,6 @@ impl ::core::cmp::PartialEq for Big {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl ::core::marker::StructuralEq for Big { }
|
|
||||||
#[automatically_derived]
|
|
||||||
impl ::core::cmp::Eq for Big {
|
impl ::core::cmp::Eq for Big {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -500,8 +492,6 @@ impl ::core::cmp::PartialEq for Unsized {
|
||||||
fn eq(&self, other: &Unsized) -> bool { self.0 == other.0 }
|
fn eq(&self, other: &Unsized) -> bool { self.0 == other.0 }
|
||||||
}
|
}
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl ::core::marker::StructuralEq for Unsized { }
|
|
||||||
#[automatically_derived]
|
|
||||||
impl ::core::cmp::Eq for Unsized {
|
impl ::core::cmp::Eq for Unsized {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -616,8 +606,6 @@ impl<T: ::core::cmp::PartialEq + Trait, U: ::core::cmp::PartialEq>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl<T: Trait, U> ::core::marker::StructuralEq for Generic<T, U> { }
|
|
||||||
#[automatically_derived]
|
|
||||||
impl<T: ::core::cmp::Eq + Trait, U: ::core::cmp::Eq> ::core::cmp::Eq for
|
impl<T: ::core::cmp::Eq + Trait, U: ::core::cmp::Eq> ::core::cmp::Eq for
|
||||||
Generic<T, U> where T::A: ::core::cmp::Eq {
|
Generic<T, U> where T::A: ::core::cmp::Eq {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -739,8 +727,6 @@ impl<T: ::core::cmp::PartialEq + ::core::marker::Copy + Trait,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl<T: Trait, U> ::core::marker::StructuralEq for PackedGeneric<T, U> { }
|
|
||||||
#[automatically_derived]
|
|
||||||
impl<T: ::core::cmp::Eq + ::core::marker::Copy + Trait, U: ::core::cmp::Eq +
|
impl<T: ::core::cmp::Eq + ::core::marker::Copy + Trait, U: ::core::cmp::Eq +
|
||||||
::core::marker::Copy> ::core::cmp::Eq for PackedGeneric<T, U> where
|
::core::marker::Copy> ::core::cmp::Eq for PackedGeneric<T, U> where
|
||||||
T::A: ::core::cmp::Eq + ::core::marker::Copy {
|
T::A: ::core::cmp::Eq + ::core::marker::Copy {
|
||||||
|
@ -825,8 +811,6 @@ impl ::core::cmp::PartialEq for Enum0 {
|
||||||
fn eq(&self, other: &Enum0) -> bool { match *self {} }
|
fn eq(&self, other: &Enum0) -> bool { match *self {} }
|
||||||
}
|
}
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl ::core::marker::StructuralEq for Enum0 { }
|
|
||||||
#[automatically_derived]
|
|
||||||
impl ::core::cmp::Eq for Enum0 {
|
impl ::core::cmp::Eq for Enum0 {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -897,8 +881,6 @@ impl ::core::cmp::PartialEq for Enum1 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl ::core::marker::StructuralEq for Enum1 { }
|
|
||||||
#[automatically_derived]
|
|
||||||
impl ::core::cmp::Eq for Enum1 {
|
impl ::core::cmp::Eq for Enum1 {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -965,8 +947,6 @@ impl ::core::cmp::PartialEq for Fieldless1 {
|
||||||
fn eq(&self, other: &Fieldless1) -> bool { true }
|
fn eq(&self, other: &Fieldless1) -> bool { true }
|
||||||
}
|
}
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl ::core::marker::StructuralEq for Fieldless1 { }
|
|
||||||
#[automatically_derived]
|
|
||||||
impl ::core::cmp::Eq for Fieldless1 {
|
impl ::core::cmp::Eq for Fieldless1 {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -1041,8 +1021,6 @@ impl ::core::cmp::PartialEq for Fieldless {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl ::core::marker::StructuralEq for Fieldless { }
|
|
||||||
#[automatically_derived]
|
|
||||||
impl ::core::cmp::Eq for Fieldless {
|
impl ::core::cmp::Eq for Fieldless {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -1150,8 +1128,6 @@ impl ::core::cmp::PartialEq for Mixed {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl ::core::marker::StructuralEq for Mixed { }
|
|
||||||
#[automatically_derived]
|
|
||||||
impl ::core::cmp::Eq for Mixed {
|
impl ::core::cmp::Eq for Mixed {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -1279,8 +1255,6 @@ impl ::core::cmp::PartialEq for Fielded {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl ::core::marker::StructuralEq for Fielded { }
|
|
||||||
#[automatically_derived]
|
|
||||||
impl ::core::cmp::Eq for Fielded {
|
impl ::core::cmp::Eq for Fielded {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -1402,8 +1376,6 @@ impl<T: ::core::cmp::PartialEq, U: ::core::cmp::PartialEq>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl<T, U> ::core::marker::StructuralEq for EnumGeneric<T, U> { }
|
|
||||||
#[automatically_derived]
|
|
||||||
impl<T: ::core::cmp::Eq, U: ::core::cmp::Eq> ::core::cmp::Eq for
|
impl<T: ::core::cmp::Eq, U: ::core::cmp::Eq> ::core::cmp::Eq for
|
||||||
EnumGeneric<T, U> {
|
EnumGeneric<T, U> {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -3,5 +3,5 @@ const CONST_STRING: String = String::new();
|
||||||
fn main() {
|
fn main() {
|
||||||
let empty_str = String::from("");
|
let empty_str = String::from("");
|
||||||
if let CONST_STRING = empty_str {}
|
if let CONST_STRING = empty_str {}
|
||||||
//~^ ERROR to use a constant of type `Vec<u8>` in a pattern, `Vec<u8>` must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR to use a constant of type `Vec<u8>` in a pattern, `Vec<u8>` must be annotated with `#[derive(PartialEq)]`
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error: to use a constant of type `Vec<u8>` in a pattern, `Vec<u8>` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `Vec<u8>` in a pattern, `Vec<u8>` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/issue-115599.rs:5:12
|
--> $DIR/issue-115599.rs:5:12
|
||||||
|
|
|
|
||||||
LL | if let CONST_STRING = empty_str {}
|
LL | if let CONST_STRING = empty_str {}
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ const CONSTANT: &&MyType = &&MyType;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
if let CONSTANT = &&MyType {
|
if let CONSTANT = &&MyType {
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
println!("did match!");
|
println!("did match!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error: to use a constant of type `MyType` in a pattern, `MyType` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `MyType` in a pattern, `MyType` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/const-partial_eq-fallback-ice.rs:14:12
|
--> $DIR/const-partial_eq-fallback-ice.rs:14:12
|
||||||
|
|
|
|
||||||
LL | if let CONSTANT = &&MyType {
|
LL | if let CONSTANT = &&MyType {
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|
|
@ -29,65 +29,63 @@ const BAZ: Baz = Baz::Baz1;
|
||||||
fn main() {
|
fn main() {
|
||||||
match FOO {
|
match FOO {
|
||||||
FOO => {}
|
FOO => {}
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
match FOO_REF {
|
match FOO_REF {
|
||||||
FOO_REF => {}
|
FOO_REF => {}
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
Foo(_) => {}
|
Foo(_) => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This used to cause an ICE (https://github.com/rust-lang/rust/issues/78071)
|
// This used to cause an ICE (https://github.com/rust-lang/rust/issues/78071)
|
||||||
match FOO_REF_REF {
|
match FOO_REF_REF {
|
||||||
FOO_REF_REF => {}
|
FOO_REF_REF => {}
|
||||||
//~^ WARNING must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
//~| WARNING this was previously accepted by the compiler but is being phased out
|
|
||||||
Foo(_) => {}
|
Foo(_) => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
match BAR {
|
match BAR {
|
||||||
Bar => {}
|
Bar => {}
|
||||||
BAR => {}
|
BAR => {}
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR unreachable pattern
|
||||||
_ => {}
|
_ => {}
|
||||||
|
//~^ ERROR unreachable pattern
|
||||||
}
|
}
|
||||||
|
|
||||||
match BAR {
|
match BAR {
|
||||||
BAR => {}
|
BAR => {}
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
Bar => {}
|
Bar => {}
|
||||||
|
//~^ ERROR unreachable pattern
|
||||||
_ => {}
|
_ => {}
|
||||||
|
//~^ ERROR unreachable pattern
|
||||||
}
|
}
|
||||||
|
|
||||||
match BAR {
|
match BAR {
|
||||||
BAR => {}
|
BAR => {}
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
BAR => {} // should not be emitting unreachable warning
|
||||||
BAR => {}
|
//~^ ERROR unreachable pattern
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
_ => {} // should not be emitting unreachable warning
|
||||||
_ => {}
|
//~^ ERROR unreachable pattern
|
||||||
}
|
}
|
||||||
|
|
||||||
match BAZ {
|
match BAZ {
|
||||||
BAZ => {}
|
BAZ => {}
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
Baz::Baz1 => {} // should not be emitting unreachable warning
|
||||||
Baz::Baz1 => {}
|
//~^ ERROR unreachable pattern
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
match BAZ {
|
match BAZ {
|
||||||
Baz::Baz1 => {}
|
Baz::Baz1 => {}
|
||||||
BAZ => {}
|
BAZ => {}
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR unreachable pattern
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
match BAZ {
|
match BAZ {
|
||||||
BAZ => {}
|
BAZ => {}
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
Baz::Baz2 => {}
|
Baz::Baz2 => {}
|
||||||
_ => {}
|
_ => {} // should not be emitting unreachable warning
|
||||||
|
//~^ ERROR unreachable pattern
|
||||||
}
|
}
|
||||||
|
|
||||||
type Quux = fn(usize, usize) -> usize;
|
type Quux = fn(usize, usize) -> usize;
|
||||||
|
|
|
@ -1,98 +1,5 @@
|
||||||
error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
--> $DIR/consts-opaque.rs:31:9
|
|
||||||
|
|
|
||||||
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: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
--> $DIR/consts-opaque.rs:37:9
|
|
||||||
|
|
|
||||||
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
|
|
||||||
|
|
||||||
warning: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
--> $DIR/consts-opaque.rs:44:9
|
|
||||||
|
|
|
||||||
LL | FOO_REF_REF => {}
|
|
||||||
| ^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
|
||||||
= 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
|
|
||||||
= note: `#[warn(indirect_structural_match)]` on by default
|
|
||||||
|
|
||||||
error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
--> $DIR/consts-opaque.rs:52:9
|
|
||||||
|
|
|
||||||
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: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
--> $DIR/consts-opaque.rs:58:9
|
|
||||||
|
|
|
||||||
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: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
--> $DIR/consts-opaque.rs:65:9
|
|
||||||
|
|
|
||||||
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: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
--> $DIR/consts-opaque.rs:67:9
|
|
||||||
|
|
|
||||||
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: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
--> $DIR/consts-opaque.rs:73: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:81: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:87: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
|
|
||||||
|
|
||||||
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
||||||
--> $DIR/consts-opaque.rs:98:9
|
--> $DIR/consts-opaque.rs:96:9
|
||||||
|
|
|
|
||||||
LL | QUUX => {}
|
LL | QUUX => {}
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
@ -102,7 +9,7 @@ LL | QUUX => {}
|
||||||
= note: `#[warn(pointer_structural_match)]` on by default
|
= note: `#[warn(pointer_structural_match)]` on by default
|
||||||
|
|
||||||
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
||||||
--> $DIR/consts-opaque.rs:100:9
|
--> $DIR/consts-opaque.rs:98:9
|
||||||
|
|
|
|
||||||
LL | QUUX => {}
|
LL | QUUX => {}
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
@ -110,6 +17,15 @@ LL | QUUX => {}
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
|
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
|
||||||
|
|
||||||
|
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
||||||
|
--> $DIR/consts-opaque.rs:108:9
|
||||||
|
|
|
||||||
|
LL | WRAPQUUX => {}
|
||||||
|
| ^^^^^^^^
|
||||||
|
|
|
||||||
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
|
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
|
||||||
|
|
||||||
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
||||||
--> $DIR/consts-opaque.rs:110:9
|
--> $DIR/consts-opaque.rs:110:9
|
||||||
|
|
|
|
||||||
|
@ -120,7 +36,7 @@ LL | WRAPQUUX => {}
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
|
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
|
||||||
|
|
||||||
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
||||||
--> $DIR/consts-opaque.rs:112:9
|
--> $DIR/consts-opaque.rs:117:9
|
||||||
|
|
|
|
||||||
LL | WRAPQUUX => {}
|
LL | WRAPQUUX => {}
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
@ -129,7 +45,7 @@ LL | WRAPQUUX => {}
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
|
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
|
||||||
|
|
||||||
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
||||||
--> $DIR/consts-opaque.rs:119:9
|
--> $DIR/consts-opaque.rs:127:9
|
||||||
|
|
|
|
||||||
LL | WRAPQUUX => {}
|
LL | WRAPQUUX => {}
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
@ -138,16 +54,7 @@ LL | WRAPQUUX => {}
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
|
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
|
||||||
|
|
||||||
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
||||||
--> $DIR/consts-opaque.rs:129:9
|
--> $DIR/consts-opaque.rs:139:9
|
||||||
|
|
|
||||||
LL | WRAPQUUX => {}
|
|
||||||
| ^^^^^^^^
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
|
|
||||||
|
|
||||||
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
|
||||||
--> $DIR/consts-opaque.rs:141:9
|
|
||||||
|
|
|
|
||||||
LL | WHOKNOWSQUUX => {}
|
LL | WHOKNOWSQUUX => {}
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
@ -156,7 +63,7 @@ LL | WHOKNOWSQUUX => {}
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
|
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
|
||||||
|
|
||||||
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
||||||
--> $DIR/consts-opaque.rs:144:9
|
--> $DIR/consts-opaque.rs:142:9
|
||||||
|
|
|
|
||||||
LL | WHOKNOWSQUUX => {}
|
LL | WHOKNOWSQUUX => {}
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
@ -164,14 +71,89 @@ LL | WHOKNOWSQUUX => {}
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
|
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
|
||||||
|
|
||||||
|
error: unreachable pattern
|
||||||
|
--> $DIR/consts-opaque.rs:48:9
|
||||||
|
|
|
||||||
|
LL | Bar => {}
|
||||||
|
| --- matches any value
|
||||||
|
LL | BAR => {}
|
||||||
|
| ^^^ 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:50:9
|
||||||
|
|
|
||||||
|
LL | Bar => {}
|
||||||
|
| --- matches any value
|
||||||
|
...
|
||||||
|
LL | _ => {}
|
||||||
|
| ^ unreachable pattern
|
||||||
|
|
||||||
|
error: unreachable pattern
|
||||||
|
--> $DIR/consts-opaque.rs:56:9
|
||||||
|
|
|
||||||
|
LL | BAR => {}
|
||||||
|
| --- matches any value
|
||||||
|
LL | Bar => {}
|
||||||
|
| ^^^ unreachable pattern
|
||||||
|
|
||||||
|
error: unreachable pattern
|
||||||
|
--> $DIR/consts-opaque.rs:58:9
|
||||||
|
|
|
||||||
|
LL | BAR => {}
|
||||||
|
| --- matches any value
|
||||||
|
...
|
||||||
|
LL | _ => {}
|
||||||
|
| ^ unreachable pattern
|
||||||
|
|
||||||
|
error: unreachable pattern
|
||||||
|
--> $DIR/consts-opaque.rs:64:9
|
||||||
|
|
|
||||||
|
LL | BAR => {}
|
||||||
|
| --- matches any value
|
||||||
|
LL | BAR => {} // should not be emitting unreachable warning
|
||||||
|
| ^^^ unreachable pattern
|
||||||
|
|
||||||
|
error: unreachable pattern
|
||||||
|
--> $DIR/consts-opaque.rs:66:9
|
||||||
|
|
|
||||||
|
LL | BAR => {}
|
||||||
|
| --- matches any value
|
||||||
|
...
|
||||||
|
LL | _ => {} // should not be emitting unreachable warning
|
||||||
|
| ^ unreachable pattern
|
||||||
|
|
||||||
|
error: unreachable pattern
|
||||||
|
--> $DIR/consts-opaque.rs:72:9
|
||||||
|
|
|
||||||
|
LL | Baz::Baz1 => {} // should not be emitting unreachable warning
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
|
error: unreachable pattern
|
||||||
|
--> $DIR/consts-opaque.rs:79:9
|
||||||
|
|
|
||||||
|
LL | BAZ => {}
|
||||||
|
| ^^^
|
||||||
|
|
||||||
|
error: unreachable pattern
|
||||||
|
--> $DIR/consts-opaque.rs:87:9
|
||||||
|
|
|
||||||
|
LL | _ => {} // should not be emitting unreachable warning
|
||||||
|
| ^
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `Wrap(_)` not covered
|
error[E0004]: non-exhaustive patterns: `Wrap(_)` not covered
|
||||||
--> $DIR/consts-opaque.rs:127:11
|
--> $DIR/consts-opaque.rs:125:11
|
||||||
|
|
|
|
||||||
LL | match WRAPQUUX {
|
LL | match WRAPQUUX {
|
||||||
| ^^^^^^^^ pattern `Wrap(_)` not covered
|
| ^^^^^^^^ pattern `Wrap(_)` not covered
|
||||||
|
|
|
|
||||||
note: `Wrap<fn(usize, usize) -> usize>` defined here
|
note: `Wrap<fn(usize, usize) -> usize>` defined here
|
||||||
--> $DIR/consts-opaque.rs:106:12
|
--> $DIR/consts-opaque.rs:104:12
|
||||||
|
|
|
|
||||||
LL | struct Wrap<T>(T);
|
LL | struct Wrap<T>(T);
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
@ -181,6 +163,6 @@ help: ensure that all possible cases are being handled by adding a match arm wit
|
||||||
LL | WRAPQUUX => {}, Wrap(_) => todo!()
|
LL | WRAPQUUX => {}, Wrap(_) => todo!()
|
||||||
| ++++++++++++++++++++
|
| ++++++++++++++++++++
|
||||||
|
|
||||||
error: aborting due to 10 previous errors; 9 warnings emitted
|
error: aborting due to 10 previous errors; 8 warnings emitted
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0004`.
|
For more information about this error, try `rustc --explain E0004`.
|
||||||
|
|
|
@ -20,7 +20,7 @@ const WRAP_DIRECT_INLINE: WrapInline = WrapInline(NoDerive(0));
|
||||||
fn main() {
|
fn main() {
|
||||||
match WRAP_DIRECT_INLINE {
|
match WRAP_DIRECT_INLINE {
|
||||||
WRAP_DIRECT_INLINE => { panic!("WRAP_DIRECT_INLINE matched itself"); }
|
WRAP_DIRECT_INLINE => { panic!("WRAP_DIRECT_INLINE matched itself"); }
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
_ => { println!("WRAP_DIRECT_INLINE did not match itself"); }
|
_ => { println!("WRAP_DIRECT_INLINE did not match itself"); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/cant-hide-behind-direct-struct-embedded.rs:22:9
|
--> $DIR/cant-hide-behind-direct-struct-embedded.rs:22:9
|
||||||
|
|
|
|
||||||
LL | WRAP_DIRECT_INLINE => { panic!("WRAP_DIRECT_INLINE matched itself"); }
|
LL | WRAP_DIRECT_INLINE => { panic!("WRAP_DIRECT_INLINE matched itself"); }
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ const WRAP_DIRECT_PARAM: WrapParam<NoDerive> = WrapParam(NoDerive(0));
|
||||||
fn main() {
|
fn main() {
|
||||||
match WRAP_DIRECT_PARAM {
|
match WRAP_DIRECT_PARAM {
|
||||||
WRAP_DIRECT_PARAM => { panic!("WRAP_DIRECT_PARAM matched itself"); }
|
WRAP_DIRECT_PARAM => { panic!("WRAP_DIRECT_PARAM matched itself"); }
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
_ => { println!("WRAP_DIRECT_PARAM did not match itself"); }
|
_ => { println!("WRAP_DIRECT_PARAM did not match itself"); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/cant-hide-behind-direct-struct-param.rs:22:9
|
--> $DIR/cant-hide-behind-direct-struct-param.rs:22:9
|
||||||
|
|
|
|
||||||
LL | WRAP_DIRECT_PARAM => { panic!("WRAP_DIRECT_PARAM matched itself"); }
|
LL | WRAP_DIRECT_PARAM => { panic!("WRAP_DIRECT_PARAM matched itself"); }
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ const WRAP_DOUBLY_INDIRECT_INLINE: & &WrapInline = & &WrapInline(& & NoDerive(0)
|
||||||
fn main() {
|
fn main() {
|
||||||
match WRAP_DOUBLY_INDIRECT_INLINE {
|
match WRAP_DOUBLY_INDIRECT_INLINE {
|
||||||
WRAP_DOUBLY_INDIRECT_INLINE => { panic!("WRAP_DOUBLY_INDIRECT_INLINE matched itself"); }
|
WRAP_DOUBLY_INDIRECT_INLINE => { panic!("WRAP_DOUBLY_INDIRECT_INLINE matched itself"); }
|
||||||
//~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ WARN must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| WARN this was previously accepted
|
//~| WARN this was previously accepted
|
||||||
_ => { println!("WRAP_DOUBLY_INDIRECT_INLINE correctly did not match itself"); }
|
_ => { println!("WRAP_DOUBLY_INDIRECT_INLINE correctly did not match itself"); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/cant-hide-behind-doubly-indirect-embedded.rs:24:9
|
--> $DIR/cant-hide-behind-doubly-indirect-embedded.rs:24:9
|
||||||
|
|
|
|
||||||
LL | WRAP_DOUBLY_INDIRECT_INLINE => { panic!("WRAP_DOUBLY_INDIRECT_INLINE matched itself"); }
|
LL | WRAP_DOUBLY_INDIRECT_INLINE => { panic!("WRAP_DOUBLY_INDIRECT_INLINE matched itself"); }
|
||||||
|
@ -7,7 +7,7 @@ LL | WRAP_DOUBLY_INDIRECT_INLINE => { panic!("WRAP_DOUBLY_INDIRECT_INLIN
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/cant-hide-behind-doubly-indirect-embedded.rs:7:9
|
--> $DIR/cant-hide-behind-doubly-indirect-embedded.rs:7:9
|
||||||
|
|
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ const WRAP_DOUBLY_INDIRECT_PARAM: & &WrapParam<NoDerive> = & &WrapParam(& & NoDe
|
||||||
fn main() {
|
fn main() {
|
||||||
match WRAP_DOUBLY_INDIRECT_PARAM {
|
match WRAP_DOUBLY_INDIRECT_PARAM {
|
||||||
WRAP_DOUBLY_INDIRECT_PARAM => { panic!("WRAP_DOUBLY_INDIRECT_PARAM matched itself"); }
|
WRAP_DOUBLY_INDIRECT_PARAM => { panic!("WRAP_DOUBLY_INDIRECT_PARAM matched itself"); }
|
||||||
//~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ WARN must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| WARN this was previously accepted
|
//~| WARN this was previously accepted
|
||||||
_ => { println!("WRAP_DOUBLY_INDIRECT_PARAM correctly did not match itself"); }
|
_ => { println!("WRAP_DOUBLY_INDIRECT_PARAM correctly did not match itself"); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/cant-hide-behind-doubly-indirect-param.rs:24:9
|
--> $DIR/cant-hide-behind-doubly-indirect-param.rs:24:9
|
||||||
|
|
|
|
||||||
LL | WRAP_DOUBLY_INDIRECT_PARAM => { panic!("WRAP_DOUBLY_INDIRECT_PARAM matched itself"); }
|
LL | WRAP_DOUBLY_INDIRECT_PARAM => { panic!("WRAP_DOUBLY_INDIRECT_PARAM matched itself"); }
|
||||||
|
@ -7,7 +7,7 @@ LL | WRAP_DOUBLY_INDIRECT_PARAM => { panic!("WRAP_DOUBLY_INDIRECT_PARAM
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/cant-hide-behind-doubly-indirect-param.rs:7:9
|
--> $DIR/cant-hide-behind-doubly-indirect-param.rs:7:9
|
||||||
|
|
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ const WRAP_INDIRECT_INLINE: & &WrapInline = & &WrapInline(NoDerive(0));
|
||||||
fn main() {
|
fn main() {
|
||||||
match WRAP_INDIRECT_INLINE {
|
match WRAP_INDIRECT_INLINE {
|
||||||
WRAP_INDIRECT_INLINE => { panic!("WRAP_INDIRECT_INLINE matched itself"); }
|
WRAP_INDIRECT_INLINE => { panic!("WRAP_INDIRECT_INLINE matched itself"); }
|
||||||
//~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ WARN must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| WARN this was previously accepted
|
//~| WARN this was previously accepted
|
||||||
_ => { println!("WRAP_INDIRECT_INLINE did not match itself"); }
|
_ => { println!("WRAP_INDIRECT_INLINE did not match itself"); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/cant-hide-behind-indirect-struct-embedded.rs:24:9
|
--> $DIR/cant-hide-behind-indirect-struct-embedded.rs:24:9
|
||||||
|
|
|
|
||||||
LL | WRAP_INDIRECT_INLINE => { panic!("WRAP_INDIRECT_INLINE matched itself"); }
|
LL | WRAP_INDIRECT_INLINE => { panic!("WRAP_INDIRECT_INLINE matched itself"); }
|
||||||
|
@ -7,7 +7,7 @@ LL | WRAP_INDIRECT_INLINE => { panic!("WRAP_INDIRECT_INLINE matched itse
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/cant-hide-behind-indirect-struct-embedded.rs:7:9
|
--> $DIR/cant-hide-behind-indirect-struct-embedded.rs:7:9
|
||||||
|
|
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ const WRAP_INDIRECT_PARAM: & &WrapParam<NoDerive> = & &WrapParam(NoDerive(0));
|
||||||
fn main() {
|
fn main() {
|
||||||
match WRAP_INDIRECT_PARAM {
|
match WRAP_INDIRECT_PARAM {
|
||||||
WRAP_INDIRECT_PARAM => { panic!("WRAP_INDIRECT_PARAM matched itself"); }
|
WRAP_INDIRECT_PARAM => { panic!("WRAP_INDIRECT_PARAM matched itself"); }
|
||||||
//~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ WARN must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| WARN this was previously accepted
|
//~| WARN this was previously accepted
|
||||||
_ => { println!("WRAP_INDIRECT_PARAM correctly did not match itself"); }
|
_ => { println!("WRAP_INDIRECT_PARAM correctly did not match itself"); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
|
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/cant-hide-behind-indirect-struct-param.rs:24:9
|
--> $DIR/cant-hide-behind-indirect-struct-param.rs:24:9
|
||||||
|
|
|
|
||||||
LL | WRAP_INDIRECT_PARAM => { panic!("WRAP_INDIRECT_PARAM matched itself"); }
|
LL | WRAP_INDIRECT_PARAM => { panic!("WRAP_INDIRECT_PARAM matched itself"); }
|
||||||
|
@ -7,7 +7,7 @@ LL | WRAP_INDIRECT_PARAM => { panic!("WRAP_INDIRECT_PARAM matched itself
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/cant-hide-behind-indirect-struct-param.rs:7:9
|
--> $DIR/cant-hide-behind-indirect-struct-param.rs:7:9
|
||||||
|
|
|
|
||||||
|
|
|
@ -8,16 +8,6 @@ LL | impl std::marker::StructuralPartialEq for Foo { }
|
||||||
= help: add `#![feature(structural_match)]` to the crate attributes to enable
|
= help: add `#![feature(structural_match)]` to the crate attributes to enable
|
||||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||||
|
|
||||||
error[E0658]: use of unstable library feature 'structural_match'
|
error: aborting due to 1 previous error
|
||||||
--> $DIR/feature-gate.rs:31:6
|
|
||||||
|
|
|
||||||
LL | impl std::marker::StructuralEq for Foo { }
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: see issue #31434 <https://github.com/rust-lang/rust/issues/31434> for more information
|
|
||||||
= help: add `#![feature(structural_match)]` to the crate attributes to enable
|
|
||||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0658`.
|
For more information about this error, try `rustc --explain E0658`.
|
||||||
|
|
|
@ -28,8 +28,6 @@ fn main() { //[with_gate]~ ERROR fatal error triggered by #[rustc_error]
|
||||||
|
|
||||||
impl std::marker::StructuralPartialEq for Foo { }
|
impl std::marker::StructuralPartialEq for Foo { }
|
||||||
//[no_gate]~^ ERROR use of unstable library feature 'structural_match'
|
//[no_gate]~^ ERROR use of unstable library feature 'structural_match'
|
||||||
impl std::marker::StructuralEq for Foo { }
|
|
||||||
//[no_gate]~^ ERROR use of unstable library feature 'structural_match'
|
|
||||||
|
|
||||||
impl PartialEq<Foo> for Foo {
|
impl PartialEq<Foo> for Foo {
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
|
|
|
@ -13,7 +13,7 @@ const A: &[B] = &[];
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
match &[][..] {
|
match &[][..] {
|
||||||
A => (),
|
A => (),
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error: to use a constant of type `B` in a pattern, `B` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `B` in a pattern, `B` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/issue-61188-match-slice-forbidden-without-eq.rs:15:9
|
--> $DIR/issue-61188-match-slice-forbidden-without-eq.rs:15:9
|
||||||
|
|
|
|
||||||
LL | A => (),
|
LL | A => (),
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|
|
@ -29,14 +29,14 @@ fn main() {
|
||||||
|
|
||||||
match RR_B0 {
|
match RR_B0 {
|
||||||
RR_B1 => { println!("CLAIM RR0: {:?} matches {:?}", RR_B1, RR_B0); }
|
RR_B1 => { println!("CLAIM RR0: {:?} matches {:?}", RR_B1, RR_B0); }
|
||||||
//~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ WARN must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| WARN this was previously accepted
|
//~| WARN this was previously accepted
|
||||||
_ => { }
|
_ => { }
|
||||||
}
|
}
|
||||||
|
|
||||||
match RR_B1 {
|
match RR_B1 {
|
||||||
RR_B1 => { println!("CLAIM RR1: {:?} matches {:?}", RR_B1, RR_B1); }
|
RR_B1 => { println!("CLAIM RR1: {:?} matches {:?}", RR_B1, RR_B1); }
|
||||||
//~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ WARN must be annotated with `#[derive(PartialEq)]`
|
||||||
//~| WARN this was previously accepted
|
//~| WARN this was previously accepted
|
||||||
_ => { }
|
_ => { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
warning: to use a constant of type `B` in a pattern, `B` must be annotated with `#[derive(PartialEq, Eq)]`
|
warning: to use a constant of type `B` in a pattern, `B` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/issue-62307-match-ref-ref-forbidden-without-eq.rs:31:9
|
--> $DIR/issue-62307-match-ref-ref-forbidden-without-eq.rs:31:9
|
||||||
|
|
|
|
||||||
LL | RR_B1 => { println!("CLAIM RR0: {:?} matches {:?}", RR_B1, RR_B0); }
|
LL | RR_B1 => { println!("CLAIM RR0: {:?} matches {:?}", RR_B1, RR_B0); }
|
||||||
|
@ -7,14 +7,14 @@ LL | RR_B1 => { println!("CLAIM RR0: {:?} matches {:?}", RR_B1, RR_B0);
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/issue-62307-match-ref-ref-forbidden-without-eq.rs:13:9
|
--> $DIR/issue-62307-match-ref-ref-forbidden-without-eq.rs:13:9
|
||||||
|
|
|
|
||||||
LL | #![warn(indirect_structural_match, nontrivial_structural_match)]
|
LL | #![warn(indirect_structural_match, nontrivial_structural_match)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
warning: to use a constant of type `B` in a pattern, `B` must be annotated with `#[derive(PartialEq, Eq)]`
|
warning: to use a constant of type `B` in a pattern, `B` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/issue-62307-match-ref-ref-forbidden-without-eq.rs:38:9
|
--> $DIR/issue-62307-match-ref-ref-forbidden-without-eq.rs:38:9
|
||||||
|
|
|
|
||||||
LL | RR_B1 => { println!("CLAIM RR1: {:?} matches {:?}", RR_B1, RR_B1); }
|
LL | RR_B1 => { println!("CLAIM RR1: {:?} matches {:?}", RR_B1, RR_B1); }
|
||||||
|
@ -23,7 +23,7 @@ LL | RR_B1 => { println!("CLAIM RR1: {:?} matches {:?}", RR_B1, RR_B1);
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
warning: 2 warnings emitted
|
warning: 2 warnings emitted
|
||||||
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
#[derive(PartialEq)]
|
|
||||||
struct Foo {
|
|
||||||
x: u32
|
|
||||||
}
|
|
||||||
|
|
||||||
const FOO: Foo = Foo { x: 0 };
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let y = Foo { x: 1 };
|
|
||||||
match y {
|
|
||||||
FOO => { }
|
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
_ => { }
|
|
||||||
}
|
|
||||||
|
|
||||||
let x = 0.0;
|
|
||||||
match x {
|
|
||||||
f32::INFINITY => { }
|
|
||||||
//~^ WARNING floating-point types cannot be used in patterns
|
|
||||||
//~| WARNING this was previously accepted by the compiler but is being phased out
|
|
||||||
_ => { }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
--> $DIR/match-forbidden-without-eq.rs:11:9
|
|
||||||
|
|
|
||||||
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
|
|
||||||
|
|
||||||
warning: floating-point types cannot be used in patterns
|
|
||||||
--> $DIR/match-forbidden-without-eq.rs:18:9
|
|
||||||
|
|
|
||||||
LL | f32::INFINITY => { }
|
|
||||||
| ^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
|
||||||
= note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
|
|
||||||
= note: `#[warn(illegal_floating_point_literal_pattern)]` on by default
|
|
||||||
|
|
||||||
error: aborting due to 1 previous error; 1 warning emitted
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
// Issue 62307 pointed out a case where the structural-match checking
|
|
||||||
// was too shallow.
|
|
||||||
//
|
|
||||||
// Here we check similar behavior for non-empty arrays of types that
|
|
||||||
// do not derive `Eq`.
|
|
||||||
//
|
|
||||||
// (Current behavior for empty arrays differs and thus is not tested
|
|
||||||
// here; see rust-lang/rust#62336.)
|
|
||||||
|
|
||||||
#[derive(PartialEq, Debug)]
|
|
||||||
struct B(i32);
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
const FOO: [B; 1] = [B(0)];
|
|
||||||
match [B(1)] {
|
|
||||||
FOO => { }
|
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
error: to use a constant of type `B` in a pattern, `B` must be annotated with `#[derive(PartialEq, Eq)]`
|
|
||||||
--> $DIR/match-nonempty-array-forbidden-without-eq.rs:16:9
|
|
||||||
|
|
|
||||||
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: aborting due to 1 previous error
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ fn main() {
|
||||||
let y = Foo { x: 1 };
|
let y = Foo { x: 1 };
|
||||||
match y {
|
match y {
|
||||||
FOO => { }
|
FOO => { }
|
||||||
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
//~^ ERROR must be annotated with `#[derive(PartialEq)]`
|
||||||
_ => { }
|
_ => { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
|
error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq)]`
|
||||||
--> $DIR/match-requires-both-partialeq-and-eq.rs:17:9
|
--> $DIR/match-requires-both-partialeq-and-eq.rs:17:9
|
||||||
|
|
|
|
||||||
LL | FOO => { }
|
LL | FOO => { }
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= note: the traits must be derived, manual `impl`s are not sufficient
|
= 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
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|
|
@ -507,9 +507,6 @@ trait Clone: Sized {
|
||||||
#[lang = "structural_peq"]
|
#[lang = "structural_peq"]
|
||||||
trait StructuralPartialEq {}
|
trait StructuralPartialEq {}
|
||||||
|
|
||||||
#[lang = "structural_teq"]
|
|
||||||
trait StructuralEq {}
|
|
||||||
|
|
||||||
const fn drop<T: ~const Destruct>(_: T) {}
|
const fn drop<T: ~const Destruct>(_: T) {}
|
||||||
|
|
||||||
extern "rust-intrinsic" {
|
extern "rust-intrinsic" {
|
||||||
|
|
|
@ -124,7 +124,7 @@ error: demangling-alt(<c::Foo_<{c::Foo { s: "abc", ch: 'x', slice: &[1, 2, 3] }}
|
||||||
LL | #[rustc_symbol_name]
|
LL | #[rustc_symbol_name]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: symbol-name(_RMsf_CsCRATE_HASH_1cINtB<REF>_4Bar_KVNtB<REF>_3BarS1xh7b_s_1xt1000_EE)
|
error: symbol-name(_RMsd_CsCRATE_HASH_1cINtB<REF>_4Bar_KVNtB<REF>_3BarS1xh7b_s_1xt1000_EE)
|
||||||
--> $DIR/const-generics-structural-demangling.rs:93:5
|
--> $DIR/const-generics-structural-demangling.rs:93:5
|
||||||
|
|
|
|
||||||
LL | #[rustc_symbol_name]
|
LL | #[rustc_symbol_name]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue