interpret: remove PartialOrd from a bunch of types that do not have or need a sensible order

This commit is contained in:
Ralf Jung 2022-11-26 10:10:34 +01:00
parent f8a2e491eb
commit 77071f7e3a
6 changed files with 8 additions and 8 deletions

View File

@ -36,7 +36,7 @@ pub use init_mask::{InitChunk, InitChunkIter};
/// module provides higher-level access. /// module provides higher-level access.
// Note: for performance reasons when interning, some of the `Allocation` fields can be partially // Note: for performance reasons when interning, some of the `Allocation` fields can be partially
// hashed. (see the `Hash` impl below for more details), so the impl is not derived. // hashed. (see the `Hash` impl below for more details), so the impl is not derived.
#[derive(Clone, Eq, PartialEq, PartialOrd, Ord, TyEncodable, TyDecodable)] #[derive(Clone, Eq, PartialEq, TyEncodable, TyDecodable)]
#[derive(HashStable)] #[derive(HashStable)]
pub struct Allocation<Prov: Provenance = AllocId, Extra = ()> { pub struct Allocation<Prov: Provenance = AllocId, Extra = ()> {
/// The actual bytes of the allocation. /// The actual bytes of the allocation.
@ -108,7 +108,7 @@ impl hash::Hash for Allocation {
/// Here things are different because only const allocations are interned. This /// Here things are different because only const allocations are interned. This
/// means that both the inner type (`Allocation`) and the outer type /// means that both the inner type (`Allocation`) and the outer type
/// (`ConstAllocation`) are used quite a bit. /// (`ConstAllocation`) are used quite a bit.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable)] #[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable)]
#[rustc_pass_by_value] #[rustc_pass_by_value]
pub struct ConstAllocation<'tcx>(pub Interned<'tcx, Allocation>); pub struct ConstAllocation<'tcx>(pub Interned<'tcx, Allocation>);

View File

@ -12,7 +12,7 @@ type Block = u64;
/// is initialized. If it is `false` the byte is uninitialized. /// is initialized. If it is `false` the byte is uninitialized.
// Note: for performance reasons when interning, some of the `InitMask` fields can be partially // Note: for performance reasons when interning, some of the `InitMask` fields can be partially
// hashed. (see the `Hash` impl below for more details), so the impl is not derived. // hashed. (see the `Hash` impl below for more details), so the impl is not derived.
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, TyEncodable, TyDecodable)] #[derive(Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable)]
#[derive(HashStable)] #[derive(HashStable)]
pub struct InitMask { pub struct InitMask {
blocks: Vec<Block>, blocks: Vec<Block>,

View File

@ -10,7 +10,7 @@ use super::{alloc_range, AllocError, AllocId, AllocRange, AllocResult, Provenanc
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
/// Stores the provenance information of pointers stored in memory. /// Stores the provenance information of pointers stored in memory.
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] #[derive(Clone, PartialEq, Eq, Hash, Debug)]
#[derive(HashStable)] #[derive(HashStable)]
pub struct ProvenanceMap<Prov = AllocId> { pub struct ProvenanceMap<Prov = AllocId> {
/// Provenance in this map applies from the given offset for an entire pointer-size worth of /// Provenance in this map applies from the given offset for an entire pointer-size worth of

View File

@ -173,7 +173,7 @@ impl Provenance for AllocId {
/// Represents a pointer in the Miri engine. /// Represents a pointer in the Miri engine.
/// ///
/// Pointers are "tagged" with provenance information; typically the `AllocId` they belong to. /// Pointers are "tagged" with provenance information; typically the `AllocId` they belong to.
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, TyEncodable, TyDecodable, Hash)] #[derive(Copy, Clone, Eq, PartialEq, TyEncodable, TyDecodable, Hash)]
#[derive(HashStable)] #[derive(HashStable)]
pub struct Pointer<Prov = AllocId> { pub struct Pointer<Prov = AllocId> {
pub(super) offset: Size, // kept private to avoid accidental misinterpretation (meaning depends on `Prov` type) pub(super) offset: Size, // kept private to avoid accidental misinterpretation (meaning depends on `Prov` type)

View File

@ -28,7 +28,7 @@ pub struct ConstAlloc<'tcx> {
/// Represents a constant value in Rust. `Scalar` and `Slice` are optimizations for /// Represents a constant value in Rust. `Scalar` and `Slice` are optimizations for
/// array length computations, enum discriminants and the pattern matching logic. /// array length computations, enum discriminants and the pattern matching logic.
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, TyEncodable, TyDecodable, Hash)] #[derive(Copy, Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable, Hash)]
#[derive(HashStable, Lift)] #[derive(HashStable, Lift)]
pub enum ConstValue<'tcx> { pub enum ConstValue<'tcx> {
/// Used only for types with `layout::abi::Scalar` ABI. /// Used only for types with `layout::abi::Scalar` ABI.
@ -110,7 +110,7 @@ impl<'tcx> ConstValue<'tcx> {
/// ///
/// These variants would be private if there was a convenient way to achieve that in Rust. /// These variants would be private if there was a convenient way to achieve that in Rust.
/// Do *not* match on a `Scalar`! Use the various `to_*` methods instead. /// Do *not* match on a `Scalar`! Use the various `to_*` methods instead.
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, TyEncodable, TyDecodable, Hash)] #[derive(Clone, Copy, Eq, PartialEq, TyEncodable, TyDecodable, Hash)]
#[derive(HashStable)] #[derive(HashStable)]
pub enum Scalar<Prov = AllocId> { pub enum Scalar<Prov = AllocId> {
/// The raw bytes of a simple value. /// The raw bytes of a simple value.

View File

@ -158,7 +158,7 @@ impl ThreadClockSet {
/// Error returned by finding a data race /// Error returned by finding a data race
/// should be elaborated upon. /// should be elaborated upon.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct DataRace; pub struct DataRace;
/// Externally stored memory cell clocks /// Externally stored memory cell clocks