diff --git a/compiler/rustc_builtin_macros/src/deriving/clone.rs b/compiler/rustc_builtin_macros/src/deriving/clone.rs index 957c8035399a2..b91c4fe9c436f 100644 --- a/compiler/rustc_builtin_macros/src/deriving/clone.rs +++ b/compiler/rustc_builtin_macros/src/deriving/clone.rs @@ -4,7 +4,7 @@ use crate::deriving::path_std; use rustc_ast::ptr::P; use rustc_ast::{self as ast, Expr, GenericArg, Generics, ItemKind, MetaItem, VariantData}; -use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_expand::base::{Annotatable, BuiltinDerive, ExtCtxt}; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::Span; @@ -37,7 +37,7 @@ pub fn expand_deriving_clone( ItemKind::Struct(_, Generics { ref params, .. }) | ItemKind::Enum(_, Generics { ref params, .. }) => { let container_id = cx.current_expansion.id.expn_data().parent; - if cx.resolver.has_derive_copy(container_id) + if cx.resolver.has_derive(container_id, BuiltinDerive::Copy) && !params.iter().any(|param| match param.kind { ast::GenericParamKind::Type { .. } => true, _ => false, diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs index 21174ca4c8bf9..c2fed5409379a 100644 --- a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs +++ b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs @@ -6,7 +6,7 @@ use crate::deriving::{path_local, path_std, pathvec_std}; use rustc_ast::ptr::P; use rustc_ast::{self as ast, BinOpKind, Expr, MetaItem}; -use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_expand::base::{Annotatable, BuiltinDerive, ExtCtxt}; use rustc_span::symbol::{sym, Ident, Symbol}; use rustc_span::Span; @@ -63,9 +63,12 @@ pub fn expand_deriving_partial_ord( }; // avoid defining extra methods if we can - // c-like enums, enums without any fields and structs without fields - // can safely define only `partial_cmp`. - let methods = if is_type_without_fields(item) { + // c-like enums, enums without any fields, structs without fields, + // as well as types that derive `PartialEq` can safely define only `partial_cmp`. + let container_id = cx.current_expansion.id.expn_data().parent; + let methods = if is_type_without_fields(item) + || cx.resolver.has_derive(container_id, BuiltinDerive::PartialEq) + { vec![partial_cmp_def] } else { vec![ diff --git a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs index 68c11868af888..a040dfd223726 100644 --- a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs @@ -186,7 +186,7 @@ use rustc_ast::{self as ast, BinOpKind, EnumDef, Expr, Generics, PatKind}; use rustc_ast::{GenericArg, GenericParamKind, VariantData}; use rustc_attr as attr; use rustc_data_structures::map_in_place::MapInPlace; -use rustc_expand::base::{Annotatable, ExtCtxt}; +use rustc_expand::base::{Annotatable, BuiltinDerive, ExtCtxt}; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::Span; @@ -410,7 +410,8 @@ impl<'a> TraitDef<'a> { _ => unreachable!(), }; let container_id = cx.current_expansion.id.expn_data().parent; - let always_copy = has_no_type_params && cx.resolver.has_derive_copy(container_id); + let always_copy = + has_no_type_params && cx.resolver.has_derive(container_id, BuiltinDerive::Copy); let use_temporaries = is_packed && always_copy; let newitem = match item.kind { diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs index 335f3b7a9a011..a3caea290c8f7 100644 --- a/compiler/rustc_expand/src/base.rs +++ b/compiler/rustc_expand/src/base.rs @@ -726,8 +726,8 @@ pub struct SyntaxExtension { /// Built-in macros have a couple of special properties like availability /// in `#[no_implicit_prelude]` modules, so we have to keep this flag. pub is_builtin: bool, - /// We have to identify macros providing a `Copy` impl early for compatibility reasons. - pub is_derive_copy: bool, + /// Keeps track of which builtin derives (if any) this is + pub derive: Option, } impl SyntaxExtension { @@ -756,7 +756,7 @@ impl SyntaxExtension { helper_attrs: Vec::new(), edition, is_builtin: false, - is_derive_copy: false, + derive: None, kind, } } @@ -789,6 +789,7 @@ impl SyntaxExtension { .span_diagnostic .span_err(span, "macros cannot have const stability attributes"); } + let derive = if is_builtin { BuiltinDerive::from_name(name) } else { None }; SyntaxExtension { kind, @@ -801,7 +802,7 @@ impl SyntaxExtension { helper_attrs, edition, is_builtin, - is_derive_copy: is_builtin && name == sym::Copy, + derive, } } @@ -855,6 +856,25 @@ impl SyntaxExtension { } } +/// Built-in derives +/// Only derives that are being used for special casing expansion are represented here +#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq)] +pub enum BuiltinDerive { + Copy, + PartialEq, +} + +impl BuiltinDerive { + /// Possibly turn a symbol into a built-in derive + fn from_name(name: Symbol) -> Option { + match name { + sym::Copy => Some(Self::Copy), + sym::PartialEq => Some(Self::PartialEq), + _ => None, + } + } +} + /// Result of resolving a macro invocation. pub enum InvocationRes { Single(Lrc), @@ -894,8 +914,8 @@ pub trait ResolverExpand { fn lint_node_id(&mut self, expn_id: ExpnId) -> NodeId; // Resolver interfaces for specific built-in macros. - /// Does `#[derive(...)]` attribute with the given `ExpnId` have built-in `Copy` inside it? - fn has_derive_copy(&self, expn_id: ExpnId) -> bool; + /// Does `#[derive(...)]` attribute with the given `ExpnId` have the given built-in derive inside it? + fn has_derive(&self, expn_id: ExpnId, derive: BuiltinDerive) -> bool; /// Path resolution logic for `#[cfg_accessible(path)]`. fn cfg_accessible(&mut self, expn_id: ExpnId, path: &ast::Path) -> Result; } diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index f764fbc3f8dac..9d6ec5d1d905f 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -33,7 +33,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap}; use rustc_data_structures::ptr_key::PtrKey; use rustc_data_structures::sync::Lrc; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder}; -use rustc_expand::base::SyntaxExtension; +use rustc_expand::base::{BuiltinDerive, SyntaxExtension}; use rustc_hir::def::Namespace::*; use rustc_hir::def::{self, CtorOf, DefKind, NonMacroAttrKind, PartialRes}; use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, CRATE_DEF_INDEX}; @@ -967,10 +967,10 @@ pub struct Resolver<'a> { multi_segment_macro_resolutions: Vec<(Vec, Span, MacroKind, ParentScope<'a>, Option)>, builtin_attrs: Vec<(Ident, ParentScope<'a>)>, - /// `derive(Copy)` marks items they are applied to so they are treated specially later. + /// built-in derives mark items they are applied to so they are treated specially later. /// Derive macros cannot modify the item themselves and have to store the markers in the global /// context, so they attach the markers to derive container IDs using this resolver table. - containers_deriving_copy: FxHashSet, + containers_derives: FxHashMap>, /// Parent scopes in which the macros were invoked. /// FIXME: `derives` are missing in these parent scopes and need to be taken from elsewhere. invocation_parent_scopes: FxHashMap>, @@ -1318,7 +1318,7 @@ impl<'a> Resolver<'a> { single_segment_macro_resolutions: Default::default(), multi_segment_macro_resolutions: Default::default(), builtin_attrs: Default::default(), - containers_deriving_copy: Default::default(), + containers_derives: Default::default(), active_features: features .declared_lib_features .iter() diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs index c8dbe68512857..da06a553aecfa 100644 --- a/compiler/rustc_resolve/src/macros.rs +++ b/compiler/rustc_resolve/src/macros.rs @@ -14,7 +14,9 @@ use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::ptr_key::PtrKey; use rustc_data_structures::sync::Lrc; use rustc_errors::struct_span_err; -use rustc_expand::base::{Indeterminate, InvocationRes, ResolverExpand, SyntaxExtension}; +use rustc_expand::base::{ + BuiltinDerive, Indeterminate, InvocationRes, ResolverExpand, SyntaxExtension, +}; use rustc_expand::compile_declarative_macro; use rustc_expand::expand::{AstFragment, Invocation, InvocationKind}; use rustc_feature::is_builtin_attr_name; @@ -285,8 +287,11 @@ impl<'a> ResolverExpand for Resolver<'a> { helper_attrs.extend( ext.helper_attrs.iter().map(|name| Ident::new(*name, span)), ); - if ext.is_derive_copy { - self.containers_deriving_copy.insert(invoc_id); + if let Some(derive) = ext.derive { + self.containers_derives + .entry(invoc_id) + .or_default() + .insert(derive); } ext } @@ -347,8 +352,8 @@ impl<'a> ResolverExpand for Resolver<'a> { .map_or(ast::CRATE_NODE_ID, |id| self.def_id_to_node_id[*id]) } - fn has_derive_copy(&self, expn_id: ExpnId) -> bool { - self.containers_deriving_copy.contains(&expn_id) + fn has_derive(&self, expn_id: ExpnId, derive: BuiltinDerive) -> bool { + self.containers_derives.get(&expn_id).map(|d| d.contains(&derive)).unwrap_or(false) } // The function that implements the resolution logic of `#[cfg_accessible(path)]`. diff --git a/src/test/ui/derives/derives-span-Hash-enum.rs b/src/test/ui/derives/derives-span-Hash-enum.rs index 8ce7df18f06fd..bb656e5c2fe3c 100644 --- a/src/test/ui/derives/derives-span-Hash-enum.rs +++ b/src/test/ui/derives/derives-span-Hash-enum.rs @@ -1,5 +1,6 @@ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' + struct Error; #[derive(Hash)] diff --git a/src/test/ui/derives/derives-span-Hash-enum.stderr b/src/test/ui/derives/derives-span-Hash-enum.stderr index 08ddc66dd0f4f..1ae7abd740fc4 100644 --- a/src/test/ui/derives/derives-span-Hash-enum.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: Hash` is not satisfied - --> $DIR/derives-span-Hash-enum.rs:8:6 + --> $DIR/derives-span-Hash-enum.rs:9:6 | LL | Error | ^^^^^ the trait `Hash` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs index 4e7a8d71a18f4..0bc6f98d9825b 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs @@ -6,11 +6,7 @@ struct Error; #[derive(PartialOrd,PartialEq)] enum Enum { A { - x: Error //~ ERROR can't compare `Error` with `Error` - //~| ERROR can't compare `Error` with `Error` - //~| ERROR can't compare `Error` with `Error` - //~| ERROR can't compare `Error` with `Error` - //~| ERROR can't compare `Error` with `Error` + x: Error //~ ERROR } } diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr index 0736e71460b3d..9f2f47add1278 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr @@ -8,46 +8,6 @@ LL | x: Error = note: required by `std::cmp::PartialOrd::partial_cmp` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:9:6 - | -LL | x: Error - | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` - | - = help: the trait `PartialOrd` is not implemented for `Error` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:9:6 - | -LL | x: Error - | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` - | - = help: the trait `PartialOrd` is not implemented for `Error` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:9:6 - | -LL | x: Error - | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` - | - = help: the trait `PartialOrd` is not implemented for `Error` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:9:6 - | -LL | x: Error - | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` - | - = help: the trait `PartialOrd` is not implemented for `Error` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 5 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum.rs b/src/test/ui/derives/derives-span-PartialOrd-enum.rs index d0a6c5ab52ad7..ee4423f3bee7a 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum.rs +++ b/src/test/ui/derives/derives-span-PartialOrd-enum.rs @@ -6,11 +6,7 @@ struct Error; #[derive(PartialOrd,PartialEq)] enum Enum { A( - Error //~ ERROR can't compare `Error` with `Error` - //~| ERROR can't compare `Error` with `Error` - //~| ERROR can't compare `Error` with `Error` - //~| ERROR can't compare `Error` with `Error` - //~| ERROR can't compare `Error` with `Error` + Error //~ ERROR ) } diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr index d88321b97973b..25073c5718c9d 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr @@ -8,46 +8,6 @@ LL | Error = note: required by `std::cmp::PartialOrd::partial_cmp` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-enum.rs:9:6 - | -LL | Error - | ^^^^^ no implementation for `Error < Error` and `Error > Error` - | - = help: the trait `PartialOrd` is not implemented for `Error` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-enum.rs:9:6 - | -LL | Error - | ^^^^^ no implementation for `Error < Error` and `Error > Error` - | - = help: the trait `PartialOrd` is not implemented for `Error` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-enum.rs:9:6 - | -LL | Error - | ^^^^^ no implementation for `Error < Error` and `Error > Error` - | - = help: the trait `PartialOrd` is not implemented for `Error` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-enum.rs:9:6 - | -LL | Error - | ^^^^^ no implementation for `Error < Error` and `Error > Error` - | - = help: the trait `PartialOrd` is not implemented for `Error` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 5 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/derives/derives-span-PartialOrd-struct.rs b/src/test/ui/derives/derives-span-PartialOrd-struct.rs index a596a2e32959d..48435e0cd45a5 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-struct.rs +++ b/src/test/ui/derives/derives-span-PartialOrd-struct.rs @@ -5,11 +5,7 @@ struct Error; #[derive(PartialOrd,PartialEq)] struct Struct { - x: Error //~ ERROR can't compare `Error` with `Error` - //~| ERROR can't compare `Error` with `Error` - //~| ERROR can't compare `Error` with `Error` - //~| ERROR can't compare `Error` with `Error` - //~| ERROR can't compare `Error` with `Error` + x: Error //~ ERROR } fn main() {} diff --git a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr index 3023517752844..b514dd9993f7f 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr @@ -8,46 +8,6 @@ LL | x: Error = note: required by `std::cmp::PartialOrd::partial_cmp` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-struct.rs:8:5 - | -LL | x: Error - | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` - | - = help: the trait `PartialOrd` is not implemented for `Error` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-struct.rs:8:5 - | -LL | x: Error - | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` - | - = help: the trait `PartialOrd` is not implemented for `Error` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-struct.rs:8:5 - | -LL | x: Error - | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` - | - = help: the trait `PartialOrd` is not implemented for `Error` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-struct.rs:8:5 - | -LL | x: Error - | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` - | - = help: the trait `PartialOrd` is not implemented for `Error` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 5 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs index 6dd1623471045..2aa412e6d1d8f 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs @@ -5,11 +5,7 @@ struct Error; #[derive(PartialOrd,PartialEq)] struct Struct( - Error //~ ERROR can't compare `Error` with `Error` - //~| ERROR can't compare `Error` with `Error` - //~| ERROR can't compare `Error` with `Error` - //~| ERROR can't compare `Error` with `Error` - //~| ERROR can't compare `Error` with `Error` + Error //~ ERROR ); fn main() {} diff --git a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr index 3abf1ded8df8f..c098f6bfb36ac 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr @@ -8,46 +8,6 @@ LL | Error = note: required by `std::cmp::PartialOrd::partial_cmp` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-tuple-struct.rs:8:5 - | -LL | Error - | ^^^^^ no implementation for `Error < Error` and `Error > Error` - | - = help: the trait `PartialOrd` is not implemented for `Error` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-tuple-struct.rs:8:5 - | -LL | Error - | ^^^^^ no implementation for `Error < Error` and `Error > Error` - | - = help: the trait `PartialOrd` is not implemented for `Error` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-tuple-struct.rs:8:5 - | -LL | Error - | ^^^^^ no implementation for `Error < Error` and `Error > Error` - | - = help: the trait `PartialOrd` is not implemented for `Error` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-tuple-struct.rs:8:5 - | -LL | Error - | ^^^^^ no implementation for `Error < Error` and `Error > Error` - | - = help: the trait `PartialOrd` is not implemented for `Error` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 5 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-34229.rs b/src/test/ui/issues/issue-34229.rs index 625fcb0a6f607..f36eb00efc500 100644 --- a/src/test/ui/issues/issue-34229.rs +++ b/src/test/ui/issues/issue-34229.rs @@ -1,9 +1,7 @@ -#[derive(PartialEq)] struct Comparable; -#[derive(PartialEq, PartialOrd)] struct Nope(Comparable); +#[derive(PartialEq)] +struct Comparable; +#[derive(PartialEq, PartialOrd)] +struct Nope(Comparable); //~^ ERROR can't compare `Comparable` -//~| ERROR can't compare `Comparable` -//~| ERROR can't compare `Comparable` -//~| ERROR can't compare `Comparable` -//~| ERROR can't compare `Comparable` fn main() {} diff --git a/src/test/ui/issues/issue-34229.stderr b/src/test/ui/issues/issue-34229.stderr index d25189e783759..b85a5e5accf50 100644 --- a/src/test/ui/issues/issue-34229.stderr +++ b/src/test/ui/issues/issue-34229.stderr @@ -1,53 +1,13 @@ error[E0277]: can't compare `Comparable` with `Comparable` - --> $DIR/issue-34229.rs:2:46 + --> $DIR/issue-34229.rs:4:13 | -LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable); - | ^^^^^^^^^^ no implementation for `Comparable < Comparable` and `Comparable > Comparable` +LL | struct Nope(Comparable); + | ^^^^^^^^^^ no implementation for `Comparable < Comparable` and `Comparable > Comparable` | = help: the trait `PartialOrd` is not implemented for `Comparable` = note: required by `std::cmp::PartialOrd::partial_cmp` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: can't compare `Comparable` with `Comparable` - --> $DIR/issue-34229.rs:2:46 - | -LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable); - | ^^^^^^^^^^ no implementation for `Comparable < Comparable` and `Comparable > Comparable` - | - = help: the trait `PartialOrd` is not implemented for `Comparable` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `Comparable` with `Comparable` - --> $DIR/issue-34229.rs:2:46 - | -LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable); - | ^^^^^^^^^^ no implementation for `Comparable < Comparable` and `Comparable > Comparable` - | - = help: the trait `PartialOrd` is not implemented for `Comparable` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `Comparable` with `Comparable` - --> $DIR/issue-34229.rs:2:46 - | -LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable); - | ^^^^^^^^^^ no implementation for `Comparable < Comparable` and `Comparable > Comparable` - | - = help: the trait `PartialOrd` is not implemented for `Comparable` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `Comparable` with `Comparable` - --> $DIR/issue-34229.rs:2:46 - | -LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable); - | ^^^^^^^^^^ no implementation for `Comparable < Comparable` and `Comparable > Comparable` - | - = help: the trait `PartialOrd` is not implemented for `Comparable` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 5 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/range/range_traits-1.rs b/src/test/ui/range/range_traits-1.rs index 4f57c32e913e1..e28e47435c2c2 100644 --- a/src/test/ui/range/range_traits-1.rs +++ b/src/test/ui/range/range_traits-1.rs @@ -4,45 +4,21 @@ use std::ops::*; struct AllTheRanges { a: Range, //~^ ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare //~| ERROR Ord b: RangeTo, //~^ ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare //~| ERROR Ord c: RangeFrom, //~^ ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare //~| ERROR Ord d: RangeFull, //~^ ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare //~| ERROR Ord e: RangeInclusive, //~^ ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare //~| ERROR Ord f: RangeToInclusive, //~^ ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare - //~| ERROR can't compare //~| ERROR Ord } diff --git a/src/test/ui/range/range_traits-1.stderr b/src/test/ui/range/range_traits-1.stderr index 165fcd415ce7e..e2c1eeb292a7b 100644 --- a/src/test/ui/range/range_traits-1.stderr +++ b/src/test/ui/range/range_traits-1.stderr @@ -9,7 +9,7 @@ LL | a: Range, = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `std::ops::RangeTo` with `std::ops::RangeTo` - --> $DIR/range_traits-1.rs:12:5 + --> $DIR/range_traits-1.rs:8:5 | LL | b: RangeTo, | ^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeTo < std::ops::RangeTo` and `std::ops::RangeTo > std::ops::RangeTo` @@ -19,7 +19,7 @@ LL | b: RangeTo, = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `std::ops::RangeFrom` with `std::ops::RangeFrom` - --> $DIR/range_traits-1.rs:19:5 + --> $DIR/range_traits-1.rs:11:5 | LL | c: RangeFrom, | ^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeFrom < std::ops::RangeFrom` and `std::ops::RangeFrom > std::ops::RangeFrom` @@ -29,7 +29,7 @@ LL | c: RangeFrom, = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `std::ops::RangeFull` with `std::ops::RangeFull` - --> $DIR/range_traits-1.rs:26:5 + --> $DIR/range_traits-1.rs:14:5 | LL | d: RangeFull, | ^^^^^^^^^^^^ no implementation for `std::ops::RangeFull < std::ops::RangeFull` and `std::ops::RangeFull > std::ops::RangeFull` @@ -39,7 +39,7 @@ LL | d: RangeFull, = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `std::ops::RangeInclusive` with `std::ops::RangeInclusive` - --> $DIR/range_traits-1.rs:33:5 + --> $DIR/range_traits-1.rs:17:5 | LL | e: RangeInclusive, | ^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeInclusive < std::ops::RangeInclusive` and `std::ops::RangeInclusive > std::ops::RangeInclusive` @@ -49,247 +49,7 @@ LL | e: RangeInclusive, = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `std::ops::RangeToInclusive` with `std::ops::RangeToInclusive` - --> $DIR/range_traits-1.rs:40:5 - | -LL | f: RangeToInclusive, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeToInclusive < std::ops::RangeToInclusive` and `std::ops::RangeToInclusive > std::ops::RangeToInclusive` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeToInclusive` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::Range` with `std::ops::Range` - --> $DIR/range_traits-1.rs:5:5 - | -LL | a: Range, - | ^^^^^^^^^^^^^^^ no implementation for `std::ops::Range < std::ops::Range` and `std::ops::Range > std::ops::Range` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::Range` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeTo` with `std::ops::RangeTo` - --> $DIR/range_traits-1.rs:12:5 - | -LL | b: RangeTo, - | ^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeTo < std::ops::RangeTo` and `std::ops::RangeTo > std::ops::RangeTo` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeTo` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeFrom` with `std::ops::RangeFrom` - --> $DIR/range_traits-1.rs:19:5 - | -LL | c: RangeFrom, - | ^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeFrom < std::ops::RangeFrom` and `std::ops::RangeFrom > std::ops::RangeFrom` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeFrom` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeFull` with `std::ops::RangeFull` - --> $DIR/range_traits-1.rs:26:5 - | -LL | d: RangeFull, - | ^^^^^^^^^^^^ no implementation for `std::ops::RangeFull < std::ops::RangeFull` and `std::ops::RangeFull > std::ops::RangeFull` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeFull` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeInclusive` with `std::ops::RangeInclusive` - --> $DIR/range_traits-1.rs:33:5 - | -LL | e: RangeInclusive, - | ^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeInclusive < std::ops::RangeInclusive` and `std::ops::RangeInclusive > std::ops::RangeInclusive` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeInclusive` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeToInclusive` with `std::ops::RangeToInclusive` - --> $DIR/range_traits-1.rs:40:5 - | -LL | f: RangeToInclusive, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeToInclusive < std::ops::RangeToInclusive` and `std::ops::RangeToInclusive > std::ops::RangeToInclusive` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeToInclusive` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::Range` with `std::ops::Range` - --> $DIR/range_traits-1.rs:5:5 - | -LL | a: Range, - | ^^^^^^^^^^^^^^^ no implementation for `std::ops::Range < std::ops::Range` and `std::ops::Range > std::ops::Range` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::Range` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeTo` with `std::ops::RangeTo` - --> $DIR/range_traits-1.rs:12:5 - | -LL | b: RangeTo, - | ^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeTo < std::ops::RangeTo` and `std::ops::RangeTo > std::ops::RangeTo` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeTo` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeFrom` with `std::ops::RangeFrom` - --> $DIR/range_traits-1.rs:19:5 - | -LL | c: RangeFrom, - | ^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeFrom < std::ops::RangeFrom` and `std::ops::RangeFrom > std::ops::RangeFrom` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeFrom` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeFull` with `std::ops::RangeFull` - --> $DIR/range_traits-1.rs:26:5 - | -LL | d: RangeFull, - | ^^^^^^^^^^^^ no implementation for `std::ops::RangeFull < std::ops::RangeFull` and `std::ops::RangeFull > std::ops::RangeFull` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeFull` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeInclusive` with `std::ops::RangeInclusive` - --> $DIR/range_traits-1.rs:33:5 - | -LL | e: RangeInclusive, - | ^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeInclusive < std::ops::RangeInclusive` and `std::ops::RangeInclusive > std::ops::RangeInclusive` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeInclusive` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeToInclusive` with `std::ops::RangeToInclusive` - --> $DIR/range_traits-1.rs:40:5 - | -LL | f: RangeToInclusive, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeToInclusive < std::ops::RangeToInclusive` and `std::ops::RangeToInclusive > std::ops::RangeToInclusive` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeToInclusive` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::Range` with `std::ops::Range` - --> $DIR/range_traits-1.rs:5:5 - | -LL | a: Range, - | ^^^^^^^^^^^^^^^ no implementation for `std::ops::Range < std::ops::Range` and `std::ops::Range > std::ops::Range` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::Range` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeTo` with `std::ops::RangeTo` - --> $DIR/range_traits-1.rs:12:5 - | -LL | b: RangeTo, - | ^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeTo < std::ops::RangeTo` and `std::ops::RangeTo > std::ops::RangeTo` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeTo` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeFrom` with `std::ops::RangeFrom` - --> $DIR/range_traits-1.rs:19:5 - | -LL | c: RangeFrom, - | ^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeFrom < std::ops::RangeFrom` and `std::ops::RangeFrom > std::ops::RangeFrom` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeFrom` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeFull` with `std::ops::RangeFull` - --> $DIR/range_traits-1.rs:26:5 - | -LL | d: RangeFull, - | ^^^^^^^^^^^^ no implementation for `std::ops::RangeFull < std::ops::RangeFull` and `std::ops::RangeFull > std::ops::RangeFull` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeFull` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeInclusive` with `std::ops::RangeInclusive` - --> $DIR/range_traits-1.rs:33:5 - | -LL | e: RangeInclusive, - | ^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeInclusive < std::ops::RangeInclusive` and `std::ops::RangeInclusive > std::ops::RangeInclusive` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeInclusive` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeToInclusive` with `std::ops::RangeToInclusive` - --> $DIR/range_traits-1.rs:40:5 - | -LL | f: RangeToInclusive, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeToInclusive < std::ops::RangeToInclusive` and `std::ops::RangeToInclusive > std::ops::RangeToInclusive` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeToInclusive` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::Range` with `std::ops::Range` - --> $DIR/range_traits-1.rs:5:5 - | -LL | a: Range, - | ^^^^^^^^^^^^^^^ no implementation for `std::ops::Range < std::ops::Range` and `std::ops::Range > std::ops::Range` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::Range` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeTo` with `std::ops::RangeTo` - --> $DIR/range_traits-1.rs:12:5 - | -LL | b: RangeTo, - | ^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeTo < std::ops::RangeTo` and `std::ops::RangeTo > std::ops::RangeTo` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeTo` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeFrom` with `std::ops::RangeFrom` - --> $DIR/range_traits-1.rs:19:5 - | -LL | c: RangeFrom, - | ^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeFrom < std::ops::RangeFrom` and `std::ops::RangeFrom > std::ops::RangeFrom` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeFrom` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeFull` with `std::ops::RangeFull` - --> $DIR/range_traits-1.rs:26:5 - | -LL | d: RangeFull, - | ^^^^^^^^^^^^ no implementation for `std::ops::RangeFull < std::ops::RangeFull` and `std::ops::RangeFull > std::ops::RangeFull` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeFull` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeInclusive` with `std::ops::RangeInclusive` - --> $DIR/range_traits-1.rs:33:5 - | -LL | e: RangeInclusive, - | ^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeInclusive < std::ops::RangeInclusive` and `std::ops::RangeInclusive > std::ops::RangeInclusive` - | - = help: the trait `PartialOrd` is not implemented for `std::ops::RangeInclusive` - = note: required by `std::cmp::PartialOrd::partial_cmp` - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: can't compare `std::ops::RangeToInclusive` with `std::ops::RangeToInclusive` - --> $DIR/range_traits-1.rs:40:5 + --> $DIR/range_traits-1.rs:20:5 | LL | f: RangeToInclusive, | ^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeToInclusive < std::ops::RangeToInclusive` and `std::ops::RangeToInclusive > std::ops::RangeToInclusive` @@ -308,7 +68,7 @@ LL | a: Range, = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `std::ops::RangeTo: Ord` is not satisfied - --> $DIR/range_traits-1.rs:12:5 + --> $DIR/range_traits-1.rs:8:5 | LL | b: RangeTo, | ^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeTo` @@ -317,7 +77,7 @@ LL | b: RangeTo, = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `std::ops::RangeFrom: Ord` is not satisfied - --> $DIR/range_traits-1.rs:19:5 + --> $DIR/range_traits-1.rs:11:5 | LL | c: RangeFrom, | ^^^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeFrom` @@ -326,7 +86,7 @@ LL | c: RangeFrom, = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `std::ops::RangeFull: Ord` is not satisfied - --> $DIR/range_traits-1.rs:26:5 + --> $DIR/range_traits-1.rs:14:5 | LL | d: RangeFull, | ^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeFull` @@ -335,7 +95,7 @@ LL | d: RangeFull, = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `std::ops::RangeInclusive: Ord` is not satisfied - --> $DIR/range_traits-1.rs:33:5 + --> $DIR/range_traits-1.rs:17:5 | LL | e: RangeInclusive, | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeInclusive` @@ -344,7 +104,7 @@ LL | e: RangeInclusive, = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `std::ops::RangeToInclusive: Ord` is not satisfied - --> $DIR/range_traits-1.rs:40:5 + --> $DIR/range_traits-1.rs:20:5 | LL | f: RangeToInclusive, | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Ord` is not implemented for `std::ops::RangeToInclusive` @@ -352,6 +112,6 @@ LL | f: RangeToInclusive, = note: required by `std::cmp::Ord::cmp` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 36 previous errors +error: aborting due to 12 previous errors For more information about this error, try `rustc --explain E0277`.