Skip to main content

rustc_middle/mir/
coverage.rs

1//! Metadata from source code coverage analysis and instrumentation.
2
3use std::fmt::{self, Debug, Formatter};
4
5use rustc_data_structures::fx::FxIndexMap;
6use rustc_hir::HirId;
7use rustc_index::{Idx, IndexVec};
8use rustc_macros::{StableHash, TyDecodable, TyEncodable};
9use rustc_span::Span;
10
11#[automatically_derived]
impl ::core::marker::Copy for BlockMarkerId { }
impl BlockMarkerId {
    #[doc = r" Maximum value the index can take, as a `u32`."]
    pub const MAX_AS_U32: u32 = 0xFFFF_FF00;
    #[doc = r" Maximum value the index can take."]
    pub const MAX: Self = Self::from_u32(0xFFFF_FF00);
    #[doc = r" Zero value of the index."]
    pub const ZERO: Self = Self::from_u32(0);
    #[doc = r" Creates a new index from a given `usize`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_usize(value: usize) -> Self {
        if !(value <= (0xFFFF_FF00 as usize)) {
            ::core::panicking::panic("assertion failed: value <= (0xFFFF_FF00 as usize)")
        };
        unsafe { Self::from_u32_unchecked(value as u32) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u32(value: u32) -> Self {
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u16`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u16(value: u16) -> Self {
        let value = value as u32;
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Safety"]
    #[doc = r""]
    #[doc =
    r" The provided value must be less than or equal to the maximum value for the newtype."]
    #[doc =
    r" Providing a value outside this range is undefined due to layout restrictions."]
    #[doc = r""]
    #[doc = r" Prefer using `from_u32`."]
    #[inline]
    pub const unsafe fn from_u32_unchecked(value: u32) -> Self {
        Self {
            private_use_as_methods_instead: unsafe {
                std::mem::transmute(value)
            },
        }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn index(self) -> usize { self.as_usize() }
    #[doc = r" Extracts the value of this index as a `u32`."]
    #[inline]
    pub const fn as_u32(self) -> u32 {
        unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for BlockMarkerId {
    type Output = Self;
    #[inline]
    fn add(self, other: usize) -> Self {
        Self::from_usize(self.index() + other)
    }
}
impl std::ops::AddAssign<usize> for BlockMarkerId {
    #[inline]
    fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for BlockMarkerId {
    #[inline]
    fn new(value: usize) -> Self { Self::from_usize(value) }
    #[inline]
    fn index(self) -> usize { self.as_usize() }
}
impl ::rustc_data_structures::stable_hash::StableHash for BlockMarkerId {
    fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
        hcx: &mut __Hcx,
        hasher: &mut ::rustc_data_structures::stable_hash::StableHasher) {
        self.as_u32().stable_hash(hcx, hasher)
    }
}
impl From<BlockMarkerId> for u32 {
    #[inline]
    fn from(v: BlockMarkerId) -> u32 { v.as_u32() }
}
impl From<BlockMarkerId> for usize {
    #[inline]
    fn from(v: BlockMarkerId) -> usize { v.as_usize() }
}
impl From<usize> for BlockMarkerId {
    #[inline]
    fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for BlockMarkerId {
    #[inline]
    fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for BlockMarkerId {}
impl ::std::cmp::PartialEq for BlockMarkerId {
    fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for BlockMarkerId {}
impl ::std::hash::Hash for BlockMarkerId {
    fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
        self.as_u32().hash(state)
    }
}
impl<D: ::rustc_serialize::Decoder> ::rustc_serialize::Decodable<D> for
    BlockMarkerId {
    fn decode(d: &mut D) -> Self { Self::from_u32(d.read_u32()) }
}
impl<E: ::rustc_serialize::Encoder> ::rustc_serialize::Encodable<E> for
    BlockMarkerId {
    fn encode(&self, e: &mut E) { e.emit_u32(self.as_u32()); }
}
impl ::std::fmt::Debug for BlockMarkerId {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        fmt.write_fmt(format_args!("BlockMarkerId({0})", self.as_u32()))
    }
}rustc_index::newtype_index! {
12    /// Used by [`CoverageKind::BlockMarker`] to mark blocks during THIR-to-MIR
13    /// lowering, so that those blocks can be identified later.
14    #[stable_hash]
15    #[encodable]
16    #[debug_format = "BlockMarkerId({})"]
17    pub struct BlockMarkerId {}
18}
19
20#[automatically_derived]
impl ::core::marker::Copy for CounterId { }
impl CounterId {
    #[doc = r" Maximum value the index can take, as a `u32`."]
    pub const MAX_AS_U32: u32 = 0xFFFF_FF00;
    #[doc = r" Maximum value the index can take."]
    pub const MAX: Self = Self::from_u32(0xFFFF_FF00);
    #[doc = r" Zero value of the index."]
    pub const ZERO: Self = Self::from_u32(0);
    #[doc = r" Creates a new index from a given `usize`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_usize(value: usize) -> Self {
        if !(value <= (0xFFFF_FF00 as usize)) {
            ::core::panicking::panic("assertion failed: value <= (0xFFFF_FF00 as usize)")
        };
        unsafe { Self::from_u32_unchecked(value as u32) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u32(value: u32) -> Self {
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u16`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u16(value: u16) -> Self {
        let value = value as u32;
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Safety"]
    #[doc = r""]
    #[doc =
    r" The provided value must be less than or equal to the maximum value for the newtype."]
    #[doc =
    r" Providing a value outside this range is undefined due to layout restrictions."]
    #[doc = r""]
    #[doc = r" Prefer using `from_u32`."]
    #[inline]
    pub const unsafe fn from_u32_unchecked(value: u32) -> Self {
        Self {
            private_use_as_methods_instead: unsafe {
                std::mem::transmute(value)
            },
        }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn index(self) -> usize { self.as_usize() }
    #[doc = r" Extracts the value of this index as a `u32`."]
    #[inline]
    pub const fn as_u32(self) -> u32 {
        unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for CounterId {
    type Output = Self;
    #[inline]
    fn add(self, other: usize) -> Self {
        Self::from_usize(self.index() + other)
    }
}
impl std::ops::AddAssign<usize> for CounterId {
    #[inline]
    fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for CounterId {
    #[inline]
    fn new(value: usize) -> Self { Self::from_usize(value) }
    #[inline]
    fn index(self) -> usize { self.as_usize() }
}
impl ::std::iter::Step for CounterId {
    #[inline]
    fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
        <usize as
                ::std::iter::Step>::steps_between(&Self::index(*start),
            &Self::index(*end))
    }
    #[inline]
    fn forward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_add(u).map(Self::from_usize)
    }
    #[inline]
    fn backward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_sub(u).map(Self::from_usize)
    }
    #[inline]
    fn forward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_add(u);
        (Self::from_usize(s), o)
    }
    #[inline]
    fn backward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_sub(u);
        (Self::from_usize(s), o)
    }
}
impl ::std::cmp::Ord for CounterId {
    #[inline]
    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
        self.as_u32().cmp(&other.as_u32())
    }
}
impl ::std::cmp::PartialOrd for CounterId {
    #[inline]
    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
        Some(self.cmp(other))
    }
}
impl ::rustc_data_structures::stable_hash::StableHash for CounterId {
    fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
        hcx: &mut __Hcx,
        hasher: &mut ::rustc_data_structures::stable_hash::StableHasher) {
        self.as_u32().stable_hash(hcx, hasher)
    }
}
impl From<CounterId> for u32 {
    #[inline]
    fn from(v: CounterId) -> u32 { v.as_u32() }
}
impl From<CounterId> for usize {
    #[inline]
    fn from(v: CounterId) -> usize { v.as_usize() }
}
impl From<usize> for CounterId {
    #[inline]
    fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for CounterId {
    #[inline]
    fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for CounterId {}
impl ::std::cmp::PartialEq for CounterId {
    fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for CounterId {}
impl ::std::hash::Hash for CounterId {
    fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
        self.as_u32().hash(state)
    }
}
impl<D: ::rustc_serialize::Decoder> ::rustc_serialize::Decodable<D> for
    CounterId {
    fn decode(d: &mut D) -> Self { Self::from_u32(d.read_u32()) }
}
impl<E: ::rustc_serialize::Encoder> ::rustc_serialize::Encodable<E> for
    CounterId {
    fn encode(&self, e: &mut E) { e.emit_u32(self.as_u32()); }
}
impl ::std::fmt::Debug for CounterId {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        fmt.write_fmt(format_args!("CounterId({0})", self.as_u32()))
    }
}rustc_index::newtype_index! {
21    /// ID of a coverage counter. Values ascend from 0.
22    ///
23    /// Before MIR inlining, counter IDs are local to their enclosing function.
24    /// After MIR inlining, coverage statements may have been inlined into
25    /// another function, so use the statement's source-scope to find which
26    /// function/instance its IDs are meaningful for.
27    ///
28    /// Note that LLVM handles counter IDs as `uint32_t`, so there is no need
29    /// to use a larger representation on the Rust side.
30    #[stable_hash]
31    #[encodable]
32    #[orderable]
33    #[debug_format = "CounterId({})"]
34    pub struct CounterId {}
35}
36
37#[automatically_derived]
impl ::core::marker::Copy for ExpressionId { }
impl ExpressionId {
    #[doc = r" Maximum value the index can take, as a `u32`."]
    pub const MAX_AS_U32: u32 = 0xFFFF_FF00;
    #[doc = r" Maximum value the index can take."]
    pub const MAX: Self = Self::from_u32(0xFFFF_FF00);
    #[doc = r" Zero value of the index."]
    pub const ZERO: Self = Self::from_u32(0);
    #[doc = r" Creates a new index from a given `usize`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_usize(value: usize) -> Self {
        if !(value <= (0xFFFF_FF00 as usize)) {
            ::core::panicking::panic("assertion failed: value <= (0xFFFF_FF00 as usize)")
        };
        unsafe { Self::from_u32_unchecked(value as u32) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u32(value: u32) -> Self {
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u16`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u16(value: u16) -> Self {
        let value = value as u32;
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Safety"]
    #[doc = r""]
    #[doc =
    r" The provided value must be less than or equal to the maximum value for the newtype."]
    #[doc =
    r" Providing a value outside this range is undefined due to layout restrictions."]
    #[doc = r""]
    #[doc = r" Prefer using `from_u32`."]
    #[inline]
    pub const unsafe fn from_u32_unchecked(value: u32) -> Self {
        Self {
            private_use_as_methods_instead: unsafe {
                std::mem::transmute(value)
            },
        }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn index(self) -> usize { self.as_usize() }
    #[doc = r" Extracts the value of this index as a `u32`."]
    #[inline]
    pub const fn as_u32(self) -> u32 {
        unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for ExpressionId {
    type Output = Self;
    #[inline]
    fn add(self, other: usize) -> Self {
        Self::from_usize(self.index() + other)
    }
}
impl std::ops::AddAssign<usize> for ExpressionId {
    #[inline]
    fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for ExpressionId {
    #[inline]
    fn new(value: usize) -> Self { Self::from_usize(value) }
    #[inline]
    fn index(self) -> usize { self.as_usize() }
}
impl ::std::iter::Step for ExpressionId {
    #[inline]
    fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
        <usize as
                ::std::iter::Step>::steps_between(&Self::index(*start),
            &Self::index(*end))
    }
    #[inline]
    fn forward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_add(u).map(Self::from_usize)
    }
    #[inline]
    fn backward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_sub(u).map(Self::from_usize)
    }
    #[inline]
    fn forward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_add(u);
        (Self::from_usize(s), o)
    }
    #[inline]
    fn backward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_sub(u);
        (Self::from_usize(s), o)
    }
}
impl ::std::cmp::Ord for ExpressionId {
    #[inline]
    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
        self.as_u32().cmp(&other.as_u32())
    }
}
impl ::std::cmp::PartialOrd for ExpressionId {
    #[inline]
    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
        Some(self.cmp(other))
    }
}
impl ::rustc_data_structures::stable_hash::StableHash for ExpressionId {
    fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
        hcx: &mut __Hcx,
        hasher: &mut ::rustc_data_structures::stable_hash::StableHasher) {
        self.as_u32().stable_hash(hcx, hasher)
    }
}
impl From<ExpressionId> for u32 {
    #[inline]
    fn from(v: ExpressionId) -> u32 { v.as_u32() }
}
impl From<ExpressionId> for usize {
    #[inline]
    fn from(v: ExpressionId) -> usize { v.as_usize() }
}
impl From<usize> for ExpressionId {
    #[inline]
    fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for ExpressionId {
    #[inline]
    fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for ExpressionId {}
impl ::std::cmp::PartialEq for ExpressionId {
    fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for ExpressionId {}
impl ::std::hash::Hash for ExpressionId {
    fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
        self.as_u32().hash(state)
    }
}
impl<D: ::rustc_serialize::Decoder> ::rustc_serialize::Decodable<D> for
    ExpressionId {
    fn decode(d: &mut D) -> Self { Self::from_u32(d.read_u32()) }
}
impl<E: ::rustc_serialize::Encoder> ::rustc_serialize::Encodable<E> for
    ExpressionId {
    fn encode(&self, e: &mut E) { e.emit_u32(self.as_u32()); }
}
impl ::std::fmt::Debug for ExpressionId {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        fmt.write_fmt(format_args!("ExpressionId({0})", self.as_u32()))
    }
}rustc_index::newtype_index! {
38    /// ID of a coverage-counter expression. Values ascend from 0.
39    ///
40    /// Before MIR inlining, expression IDs are local to their enclosing function.
41    /// After MIR inlining, coverage statements may have been inlined into
42    /// another function, so use the statement's source-scope to find which
43    /// function/instance its IDs are meaningful for.
44    ///
45    /// Note that LLVM handles expression IDs as `uint32_t`, so there is no need
46    /// to use a larger representation on the Rust side.
47    #[stable_hash]
48    #[encodable]
49    #[orderable]
50    #[debug_format = "ExpressionId({})"]
51    pub struct ExpressionId {}
52}
53
54/// Enum that can hold a constant zero value, the ID of an physical coverage
55/// counter, or the ID of a coverage-counter expression.
56#[derive(#[automatically_derived]
impl ::core::marker::Copy for CovTerm { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for CovTerm { }
#[automatically_derived]
impl ::core::clone::Clone for CovTerm {
    #[inline]
    fn clone(&self) -> CovTerm {
        let _: ::core::clone::AssertParamIsClone<CounterId>;
        let _: ::core::clone::AssertParamIsClone<ExpressionId>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for CovTerm { }
#[automatically_derived]
impl ::core::cmp::PartialEq for CovTerm {
    #[inline]
    fn eq(&self, other: &CovTerm) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (CovTerm::Counter(__self_0), CovTerm::Counter(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (CovTerm::Expression(__self_0), CovTerm::Expression(__arg1_0))
                    => __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for CovTerm {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<CounterId>;
        let _: ::core::cmp::AssertParamIsEq<ExpressionId>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for CovTerm {
    #[inline]
    fn partial_cmp(&self, other: &CovTerm)
        -> ::core::option::Option<::core::cmp::Ordering> {
        ::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for CovTerm {
    #[inline]
    fn cmp(&self, other: &CovTerm) -> ::core::cmp::Ordering {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) {
            ::core::cmp::Ordering::Equal =>
                match (self, other) {
                    (CovTerm::Counter(__self_0), CovTerm::Counter(__arg1_0)) =>
                        ::core::cmp::Ord::cmp(__self_0, __arg1_0),
                    (CovTerm::Expression(__self_0),
                        CovTerm::Expression(__arg1_0)) =>
                        ::core::cmp::Ord::cmp(__self_0, __arg1_0),
                    _ => ::core::cmp::Ordering::Equal,
                },
            cmp => cmp,
        }
    }
}Ord)]
57#[derive(const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for CovTerm {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        CovTerm::Zero => { 0usize }
                        CovTerm::Counter(ref __binding_0) => { 1usize }
                        CovTerm::Expression(ref __binding_0) => { 2usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    CovTerm::Zero => {}
                    CovTerm::Counter(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    CovTerm::Expression(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for CovTerm {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { CovTerm::Zero }
                    1usize => {
                        CovTerm::Counter(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    2usize => {
                        CovTerm::Expression(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `CovTerm`, expected 0..3, actual {0}",
                                n));
                    }
                }
            }
        }
    };TyDecodable, #[automatically_derived]
impl ::core::hash::Hash for CovTerm {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            CovTerm::Counter(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            CovTerm::Expression(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            _ => {}
        }
    }
}Hash, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for CovTerm {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    CovTerm::Zero => {}
                    CovTerm::Counter(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    CovTerm::Expression(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
58pub enum CovTerm {
59    Zero,
60    Counter(CounterId),
61    Expression(ExpressionId),
62}
63
64impl Debug for CovTerm {
65    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
66        match self {
67            Self::Zero => f.write_fmt(format_args!("Zero"))write!(f, "Zero"),
68            Self::Counter(id) => f.debug_tuple("Counter").field(&id.as_u32()).finish(),
69            Self::Expression(id) => f.debug_tuple("Expression").field(&id.as_u32()).finish(),
70        }
71    }
72}
73
74/// The specific relationship between [`CoverageKind::Point`] and its [`HirId`].
75#[derive(#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for PointKind { }
#[automatically_derived]
impl ::core::clone::Clone for PointKind {
    #[inline]
    fn clone(&self) -> PointKind { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for PointKind { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for PointKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                PointKind::Expr => "Expr",
                PointKind::ImplicitElse => "ImplicitElse",
                PointKind::FunctionEnd => "FunctionEnd",
            })
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for PointKind { }
#[automatically_derived]
impl ::core::cmp::PartialEq for PointKind {
    #[inline]
    fn eq(&self, other: &PointKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for PointKind {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        PointKind::Expr => { 0usize }
                        PointKind::ImplicitElse => { 1usize }
                        PointKind::FunctionEnd => { 2usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for PointKind {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { PointKind::Expr }
                    1usize => { PointKind::ImplicitElse }
                    2usize => { PointKind::FunctionEnd }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `PointKind`, expected 0..3, actual {0}",
                                n));
                    }
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for PointKind {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    PointKind::Expr => {}
                    PointKind::ImplicitElse => {}
                    PointKind::FunctionEnd => {}
                }
            }
        }
    };StableHash)]
76pub enum PointKind {
77    /// Inserted just before evaluating an expression.
78    Expr,
79    /// Inserted when a one-sided `if` expression generates its synthetic `else {}`.
80    /// The absent `else` has no node, so [`HirId`] is the `if` expression.
81    ImplicitElse,
82    /// Inserted at the end of a function's body. [`HirId`] is the function itself.
83    FunctionEnd,
84}
85
86#[derive(#[automatically_derived]
impl ::core::clone::Clone for CoverageKind {
    #[inline]
    fn clone(&self) -> CoverageKind {
        match self {
            CoverageKind::Point { point_kind: __self_0, hir_id: __self_1 } =>
                CoverageKind::Point {
                    point_kind: ::core::clone::Clone::clone(__self_0),
                    hir_id: ::core::clone::Clone::clone(__self_1),
                },
            CoverageKind::BlockMarker { id: __self_0 } =>
                CoverageKind::BlockMarker {
                    id: ::core::clone::Clone::clone(__self_0),
                },
            CoverageKind::VirtualCounter { bcb: __self_0 } =>
                CoverageKind::VirtualCounter {
                    bcb: ::core::clone::Clone::clone(__self_0),
                },
        }
    }
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for CoverageKind { }
#[automatically_derived]
impl ::core::cmp::PartialEq for CoverageKind {
    #[inline]
    fn eq(&self, other: &CoverageKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (CoverageKind::Point { point_kind: __self_0, hir_id: __self_1
                    }, CoverageKind::Point {
                    point_kind: __arg1_0, hir_id: __arg1_1 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (CoverageKind::BlockMarker { id: __self_0 },
                    CoverageKind::BlockMarker { id: __arg1_0 }) =>
                    __self_0 == __arg1_0,
                (CoverageKind::VirtualCounter { bcb: __self_0 },
                    CoverageKind::VirtualCounter { bcb: __arg1_0 }) =>
                    __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for CoverageKind {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        CoverageKind::Point {
                            point_kind: ref __binding_0, hir_id: ref __binding_1 } => {
                            0usize
                        }
                        CoverageKind::BlockMarker { id: ref __binding_0 } => {
                            1usize
                        }
                        CoverageKind::VirtualCounter { bcb: ref __binding_0 } => {
                            2usize
                        }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    CoverageKind::Point {
                        point_kind: ref __binding_0, hir_id: ref __binding_1 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    CoverageKind::BlockMarker { id: ref __binding_0 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    CoverageKind::VirtualCounter { bcb: ref __binding_0 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for CoverageKind {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => {
                        CoverageKind::Point {
                            point_kind: ::rustc_serialize::Decodable::decode(__decoder),
                            hir_id: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    1usize => {
                        CoverageKind::BlockMarker {
                            id: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    2usize => {
                        CoverageKind::VirtualCounter {
                            bcb: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `CoverageKind`, expected 0..3, actual {0}",
                                n));
                    }
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for CoverageKind
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    CoverageKind::Point {
                        point_kind: ref __binding_0, hir_id: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    CoverageKind::BlockMarker { id: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    CoverageKind::VirtualCounter { bcb: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
87pub enum CoverageKind {
88    /// Associates a HIR node (such as an expression) with a particular point in
89    /// MIR control-flow. The relationship between the node and the point is
90    /// indicated by [`PointKind`]. Injected during MIR building.
91    Point { point_kind: PointKind, hir_id: HirId },
92
93    /// Marks its enclosing basic block with an ID that can be referred to by
94    /// side data in [`CoverageEarlyInfo`].
95    ///
96    /// Should be erased before codegen (at some point after `InstrumentCoverage`).
97    BlockMarker { id: BlockMarkerId },
98
99    /// Marks its enclosing basic block with the ID of the coverage graph node
100    /// that it was part of during the `InstrumentCoverage` MIR pass.
101    ///
102    /// During codegen, this might be lowered to `llvm.instrprof.increment` or
103    /// to a no-op, depending on the outcome of counter-creation.
104    VirtualCounter { bcb: BasicCoverageBlock },
105}
106
107impl Debug for CoverageKind {
108    fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
109        match self {
110            CoverageKind::Point { point_kind, hir_id } => {
111                fmt.write_fmt(format_args!("Point({0:?}, {1:?}", point_kind, hir_id))write!(fmt, "Point({point_kind:?}, {hir_id:?}")
112            }
113            CoverageKind::BlockMarker { id } => fmt.write_fmt(format_args!("BlockMarker({0:?})", id.index()))write!(fmt, "BlockMarker({:?})", id.index()),
114            CoverageKind::VirtualCounter { bcb } => fmt.write_fmt(format_args!("VirtualCounter({0:?})", bcb))write!(fmt, "VirtualCounter({bcb:?})"),
115        }
116    }
117}
118
119impl CoverageKind {
120    /// Returns true if this kind of coverage statement is a marker inserted during
121    /// MIR building, for use by analysis in the `InstrumentCoverage` pass, and is
122    /// no longer needed after that pass.
123    pub fn is_removed_after_analysis(&self) -> bool {
124        match self {
125            CoverageKind::Point { .. } | CoverageKind::BlockMarker { .. } => true,
126            CoverageKind::VirtualCounter { .. } => false,
127        }
128    }
129}
130
131#[derive(#[automatically_derived]
impl ::core::marker::Copy for Op { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for Op { }
#[automatically_derived]
impl ::core::clone::Clone for Op {
    #[inline]
    fn clone(&self) -> Op { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Op {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self { Op::Subtract => "Subtract", Op::Add => "Add", })
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for Op { }
#[automatically_derived]
impl ::core::cmp::PartialEq for Op {
    #[inline]
    fn eq(&self, other: &Op) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Op {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::hash::Hash for Op {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}Hash, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for Op {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self { Op::Subtract => {} Op::Add => {} }
            }
        }
    };StableHash)]
132#[derive(const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for Op {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        Op::Subtract => { 0usize }
                        Op::Add => { 1usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for Op {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { Op::Subtract }
                    1usize => { Op::Add }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `Op`, expected 0..2, actual {0}",
                                n));
                    }
                }
            }
        }
    };TyDecodable)]
133pub enum Op {
134    Subtract,
135    Add,
136}
137
138impl Op {
139    pub fn is_add(&self) -> bool {
140        #[allow(non_exhaustive_omitted_patterns)] match self {
    Self::Add => true,
    _ => false,
}matches!(self, Self::Add)
141    }
142
143    pub fn is_subtract(&self) -> bool {
144        #[allow(non_exhaustive_omitted_patterns)] match self {
    Self::Subtract => true,
    _ => false,
}matches!(self, Self::Subtract)
145    }
146}
147
148#[derive(#[automatically_derived]
impl ::core::clone::Clone for Expression {
    #[inline]
    fn clone(&self) -> Expression {
        Expression {
            lhs: ::core::clone::Clone::clone(&self.lhs),
            op: ::core::clone::Clone::clone(&self.op),
            rhs: ::core::clone::Clone::clone(&self.rhs),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Expression {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "Expression",
            "lhs", &self.lhs, "op", &self.op, "rhs", &&self.rhs)
    }
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for Expression { }
#[automatically_derived]
impl ::core::cmp::PartialEq for Expression {
    #[inline]
    fn eq(&self, other: &Expression) -> bool {
        self.lhs == other.lhs && self.op == other.op && self.rhs == other.rhs
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Expression {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<CovTerm>;
        let _: ::core::cmp::AssertParamIsEq<Op>;
    }
}Eq)]
149#[derive(const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for Expression {
            fn encode(&self, __encoder: &mut __E) {
                let Expression {
                        lhs: ref __binding_0,
                        op: ref __binding_1,
                        rhs: ref __binding_2 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for Expression {
            fn decode(__decoder: &mut __D) -> Self {
                Expression {
                    lhs: ::rustc_serialize::Decodable::decode(__decoder),
                    op: ::rustc_serialize::Decodable::decode(__decoder),
                    rhs: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, #[automatically_derived]
impl ::core::hash::Hash for Expression {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.lhs, state);
        ::core::hash::Hash::hash(&self.op, state);
        ::core::hash::Hash::hash(&self.rhs, state)
    }
}Hash, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for Expression {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    Expression {
                        lhs: ref __binding_0,
                        op: ref __binding_1,
                        rhs: ref __binding_2 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
150pub struct Expression {
151    pub lhs: CovTerm,
152    pub op: Op,
153    pub rhs: CovTerm,
154}
155
156#[derive(#[automatically_derived]
impl ::core::clone::Clone for MappingKind {
    #[inline]
    fn clone(&self) -> MappingKind {
        match self {
            MappingKind::Code { bcb: __self_0 } =>
                MappingKind::Code {
                    bcb: ::core::clone::Clone::clone(__self_0),
                },
            MappingKind::Branch { true_bcb: __self_0, false_bcb: __self_1 } =>
                MappingKind::Branch {
                    true_bcb: ::core::clone::Clone::clone(__self_0),
                    false_bcb: ::core::clone::Clone::clone(__self_1),
                },
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for MappingKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            MappingKind::Code { bcb: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Code",
                    "bcb", &__self_0),
            MappingKind::Branch { true_bcb: __self_0, false_bcb: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "Branch", "true_bcb", __self_0, "false_bcb", &__self_1),
        }
    }
}Debug)]
157#[derive(const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for MappingKind {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        MappingKind::Code { bcb: ref __binding_0 } => { 0usize }
                        MappingKind::Branch {
                            true_bcb: ref __binding_0, false_bcb: ref __binding_1 } => {
                            1usize
                        }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    MappingKind::Code { bcb: ref __binding_0 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    MappingKind::Branch {
                        true_bcb: ref __binding_0, false_bcb: ref __binding_1 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                }
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for MappingKind {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => {
                        MappingKind::Code {
                            bcb: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    1usize => {
                        MappingKind::Branch {
                            true_bcb: ::rustc_serialize::Decodable::decode(__decoder),
                            false_bcb: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `MappingKind`, expected 0..2, actual {0}",
                                n));
                    }
                }
            }
        }
    };TyDecodable, #[automatically_derived]
impl ::core::hash::Hash for MappingKind {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            MappingKind::Code { bcb: __self_0 } =>
                ::core::hash::Hash::hash(__self_0, state),
            MappingKind::Branch { true_bcb: __self_0, false_bcb: __self_1 } =>
                {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
        }
    }
}Hash, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for MappingKind
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    MappingKind::Code { bcb: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    MappingKind::Branch {
                        true_bcb: ref __binding_0, false_bcb: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
158pub enum MappingKind {
159    /// Associates a normal region of code with a counter/expression/zero.
160    Code { bcb: BasicCoverageBlock },
161    /// Associates a branch region with separate counters for true and false.
162    Branch { true_bcb: BasicCoverageBlock, false_bcb: BasicCoverageBlock },
163}
164
165#[derive(#[automatically_derived]
impl ::core::clone::Clone for Mapping {
    #[inline]
    fn clone(&self) -> Mapping {
        Mapping {
            kind: ::core::clone::Clone::clone(&self.kind),
            span: ::core::clone::Clone::clone(&self.span),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Mapping {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "Mapping",
            "kind", &self.kind, "span", &&self.span)
    }
}Debug)]
166#[derive(const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for Mapping {
            fn encode(&self, __encoder: &mut __E) {
                let Mapping { kind: ref __binding_0, span: ref __binding_1 } =
                    *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for Mapping {
            fn decode(__decoder: &mut __D) -> Self {
                Mapping {
                    kind: ::rustc_serialize::Decodable::decode(__decoder),
                    span: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, #[automatically_derived]
impl ::core::hash::Hash for Mapping {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.kind, state);
        ::core::hash::Hash::hash(&self.span, state)
    }
}Hash, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for Mapping {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    Mapping { kind: ref __binding_0, span: ref __binding_1 } =>
                        {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
167pub struct Mapping {
168    pub kind: MappingKind,
169    pub span: Span,
170}
171
172/// Coverage information for a function, collected during the `InstrumentCoverage`
173/// MIR pass and stored in the `mir::Body` for later use by coverage codegen.
174#[derive(#[automatically_derived]
impl ::core::clone::Clone for CoverageMirInfo {
    #[inline]
    fn clone(&self) -> CoverageMirInfo {
        CoverageMirInfo {
            function_source_hash: ::core::clone::Clone::clone(&self.function_source_hash),
            node_flow_data: ::core::clone::Clone::clone(&self.node_flow_data),
            priority_list: ::core::clone::Clone::clone(&self.priority_list),
            mappings: ::core::clone::Clone::clone(&self.mappings),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for CoverageMirInfo {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f,
            "CoverageMirInfo", "function_source_hash",
            &self.function_source_hash, "node_flow_data",
            &self.node_flow_data, "priority_list", &self.priority_list,
            "mappings", &&self.mappings)
    }
}Debug)]
175#[derive(const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for CoverageMirInfo {
            fn encode(&self, __encoder: &mut __E) {
                let CoverageMirInfo {
                        function_source_hash: ref __binding_0,
                        node_flow_data: ref __binding_1,
                        priority_list: ref __binding_2,
                        mappings: ref __binding_3 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_3,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for CoverageMirInfo {
            fn decode(__decoder: &mut __D) -> Self {
                CoverageMirInfo {
                    function_source_hash: ::rustc_serialize::Decodable::decode(__decoder),
                    node_flow_data: ::rustc_serialize::Decodable::decode(__decoder),
                    priority_list: ::rustc_serialize::Decodable::decode(__decoder),
                    mappings: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, #[automatically_derived]
impl ::core::hash::Hash for CoverageMirInfo {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.function_source_hash, state);
        ::core::hash::Hash::hash(&self.node_flow_data, state);
        ::core::hash::Hash::hash(&self.priority_list, state);
        ::core::hash::Hash::hash(&self.mappings, state)
    }
}Hash, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            CoverageMirInfo {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    CoverageMirInfo {
                        function_source_hash: ref __binding_0,
                        node_flow_data: ref __binding_1,
                        priority_list: ref __binding_2,
                        mappings: ref __binding_3 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
176pub struct CoverageMirInfo {
177    pub function_source_hash: u64,
178
179    /// Used in conjunction with `priority_list` to create physical counters
180    /// and counter expressions, after MIR optimizations.
181    pub node_flow_data: NodeFlowData<BasicCoverageBlock>,
182    pub priority_list: Vec<BasicCoverageBlock>,
183
184    pub mappings: Vec<Mapping>,
185}
186
187/// Coverage information for a function, collected in advance at the THIR/MIR
188/// boundary during MIR building, and attached to the corresponding `mir::Body`.
189///
190/// This side-data is "early" in that it must be collected prior to the main
191/// instrumentation step, in contrast to the main [`CoverageMirInfo`] produced
192/// by instrumentation itself.
193///
194/// Used by the `InstrumentCoverage` MIR pass.
195#[derive(#[automatically_derived]
impl ::core::clone::Clone for CoverageEarlyInfo {
    #[inline]
    fn clone(&self) -> CoverageEarlyInfo {
        CoverageEarlyInfo {
            num_block_markers: ::core::clone::Clone::clone(&self.num_block_markers),
            branch_spans: ::core::clone::Clone::clone(&self.branch_spans),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for CoverageEarlyInfo {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "CoverageEarlyInfo", "num_block_markers", &self.num_block_markers,
            "branch_spans", &&self.branch_spans)
    }
}Debug)]
196#[derive(const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for CoverageEarlyInfo {
            fn encode(&self, __encoder: &mut __E) {
                let CoverageEarlyInfo {
                        num_block_markers: ref __binding_0,
                        branch_spans: ref __binding_1 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for CoverageEarlyInfo {
            fn decode(__decoder: &mut __D) -> Self {
                CoverageEarlyInfo {
                    num_block_markers: ::rustc_serialize::Decodable::decode(__decoder),
                    branch_spans: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, #[automatically_derived]
impl ::core::hash::Hash for CoverageEarlyInfo {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.num_block_markers, state);
        ::core::hash::Hash::hash(&self.branch_spans, state)
    }
}Hash, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            CoverageEarlyInfo {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    CoverageEarlyInfo {
                        num_block_markers: ref __binding_0,
                        branch_spans: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
197pub struct CoverageEarlyInfo {
198    /// 1 more than the highest-numbered [`CoverageKind::BlockMarker`] that was
199    /// injected into the MIR body. This makes it possible to allocate per-ID
200    /// data structures without having to scan the entire body first.
201    pub num_block_markers: usize,
202    pub branch_spans: Vec<BranchSpan>,
203}
204
205#[derive(#[automatically_derived]
impl ::core::clone::Clone for BranchSpan {
    #[inline]
    fn clone(&self) -> BranchSpan {
        BranchSpan {
            span: ::core::clone::Clone::clone(&self.span),
            true_marker: ::core::clone::Clone::clone(&self.true_marker),
            false_marker: ::core::clone::Clone::clone(&self.false_marker),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for BranchSpan {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "BranchSpan",
            "span", &self.span, "true_marker", &self.true_marker,
            "false_marker", &&self.false_marker)
    }
}Debug)]
206#[derive(const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for BranchSpan {
            fn encode(&self, __encoder: &mut __E) {
                let BranchSpan {
                        span: ref __binding_0,
                        true_marker: ref __binding_1,
                        false_marker: ref __binding_2 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for BranchSpan {
            fn decode(__decoder: &mut __D) -> Self {
                BranchSpan {
                    span: ::rustc_serialize::Decodable::decode(__decoder),
                    true_marker: ::rustc_serialize::Decodable::decode(__decoder),
                    false_marker: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, #[automatically_derived]
impl ::core::hash::Hash for BranchSpan {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.span, state);
        ::core::hash::Hash::hash(&self.true_marker, state);
        ::core::hash::Hash::hash(&self.false_marker, state)
    }
}Hash, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for BranchSpan {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    BranchSpan {
                        span: ref __binding_0,
                        true_marker: ref __binding_1,
                        false_marker: ref __binding_2 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
207pub struct BranchSpan {
208    pub span: Span,
209    pub true_marker: BlockMarkerId,
210    pub false_marker: BlockMarkerId,
211}
212
213/// Contains information needed during codegen, obtained by inspecting the
214/// function's MIR after MIR optimizations.
215///
216/// Returned by the [`coverage_codegen_info`](crate::ty::TyCtxt::coverage_codegen_info) query.
217#[derive(#[automatically_derived]
impl ::core::clone::Clone for CoverageCodegenInfo {
    #[inline]
    fn clone(&self) -> CoverageCodegenInfo {
        CoverageCodegenInfo {
            num_counters: ::core::clone::Clone::clone(&self.num_counters),
            phys_counter_for_node: ::core::clone::Clone::clone(&self.phys_counter_for_node),
            term_for_bcb: ::core::clone::Clone::clone(&self.term_for_bcb),
            expressions: ::core::clone::Clone::clone(&self.expressions),
        }
    }
}Clone, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for CoverageCodegenInfo {
            fn encode(&self, __encoder: &mut __E) {
                let CoverageCodegenInfo {
                        num_counters: ref __binding_0,
                        phys_counter_for_node: ref __binding_1,
                        term_for_bcb: ref __binding_2,
                        expressions: ref __binding_3 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_3,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for CoverageCodegenInfo {
            fn decode(__decoder: &mut __D) -> Self {
                CoverageCodegenInfo {
                    num_counters: ::rustc_serialize::Decodable::decode(__decoder),
                    phys_counter_for_node: ::rustc_serialize::Decodable::decode(__decoder),
                    term_for_bcb: ::rustc_serialize::Decodable::decode(__decoder),
                    expressions: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, #[automatically_derived]
impl ::core::fmt::Debug for CoverageCodegenInfo {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f,
            "CoverageCodegenInfo", "num_counters", &self.num_counters,
            "phys_counter_for_node", &self.phys_counter_for_node,
            "term_for_bcb", &self.term_for_bcb, "expressions",
            &&self.expressions)
    }
}Debug, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            CoverageCodegenInfo {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    CoverageCodegenInfo {
                        num_counters: ref __binding_0,
                        phys_counter_for_node: ref __binding_1,
                        term_for_bcb: ref __binding_2,
                        expressions: ref __binding_3 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
218pub struct CoverageCodegenInfo {
219    pub num_counters: u32,
220    pub phys_counter_for_node: FxIndexMap<BasicCoverageBlock, CounterId>,
221    pub term_for_bcb: IndexVec<BasicCoverageBlock, Option<CovTerm>>,
222    pub expressions: IndexVec<ExpressionId, Expression>,
223}
224
225#[automatically_derived]
impl ::core::marker::Copy for BasicCoverageBlock { }
pub const START_BCB: BasicCoverageBlock = BasicCoverageBlock::from_u32(0);
impl BasicCoverageBlock {
    #[doc = r" Maximum value the index can take, as a `u32`."]
    pub const MAX_AS_U32: u32 = 0xFFFF_FF00;
    #[doc = r" Maximum value the index can take."]
    pub const MAX: Self = Self::from_u32(0xFFFF_FF00);
    #[doc = r" Zero value of the index."]
    pub const ZERO: Self = Self::from_u32(0);
    #[doc = r" Creates a new index from a given `usize`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_usize(value: usize) -> Self {
        if !(value <= (0xFFFF_FF00 as usize)) {
            ::core::panicking::panic("assertion failed: value <= (0xFFFF_FF00 as usize)")
        };
        unsafe { Self::from_u32_unchecked(value as u32) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u32(value: u32) -> Self {
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u16`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u16(value: u16) -> Self {
        let value = value as u32;
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Safety"]
    #[doc = r""]
    #[doc =
    r" The provided value must be less than or equal to the maximum value for the newtype."]
    #[doc =
    r" Providing a value outside this range is undefined due to layout restrictions."]
    #[doc = r""]
    #[doc = r" Prefer using `from_u32`."]
    #[inline]
    pub const unsafe fn from_u32_unchecked(value: u32) -> Self {
        Self {
            private_use_as_methods_instead: unsafe {
                std::mem::transmute(value)
            },
        }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn index(self) -> usize { self.as_usize() }
    #[doc = r" Extracts the value of this index as a `u32`."]
    #[inline]
    pub const fn as_u32(self) -> u32 {
        unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for BasicCoverageBlock {
    type Output = Self;
    #[inline]
    fn add(self, other: usize) -> Self {
        Self::from_usize(self.index() + other)
    }
}
impl std::ops::AddAssign<usize> for BasicCoverageBlock {
    #[inline]
    fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for BasicCoverageBlock {
    #[inline]
    fn new(value: usize) -> Self { Self::from_usize(value) }
    #[inline]
    fn index(self) -> usize { self.as_usize() }
}
impl ::std::iter::Step for BasicCoverageBlock {
    #[inline]
    fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
        <usize as
                ::std::iter::Step>::steps_between(&Self::index(*start),
            &Self::index(*end))
    }
    #[inline]
    fn forward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_add(u).map(Self::from_usize)
    }
    #[inline]
    fn backward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_sub(u).map(Self::from_usize)
    }
    #[inline]
    fn forward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_add(u);
        (Self::from_usize(s), o)
    }
    #[inline]
    fn backward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_sub(u);
        (Self::from_usize(s), o)
    }
}
impl ::std::cmp::Ord for BasicCoverageBlock {
    #[inline]
    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
        self.as_u32().cmp(&other.as_u32())
    }
}
impl ::std::cmp::PartialOrd for BasicCoverageBlock {
    #[inline]
    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
        Some(self.cmp(other))
    }
}
impl ::rustc_data_structures::stable_hash::StableHash for BasicCoverageBlock {
    fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
        hcx: &mut __Hcx,
        hasher: &mut ::rustc_data_structures::stable_hash::StableHasher) {
        self.as_u32().stable_hash(hcx, hasher)
    }
}
impl From<BasicCoverageBlock> for u32 {
    #[inline]
    fn from(v: BasicCoverageBlock) -> u32 { v.as_u32() }
}
impl From<BasicCoverageBlock> for usize {
    #[inline]
    fn from(v: BasicCoverageBlock) -> usize { v.as_usize() }
}
impl From<usize> for BasicCoverageBlock {
    #[inline]
    fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for BasicCoverageBlock {
    #[inline]
    fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for BasicCoverageBlock {}
impl ::std::cmp::PartialEq for BasicCoverageBlock {
    fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for BasicCoverageBlock {}
impl ::std::hash::Hash for BasicCoverageBlock {
    fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
        self.as_u32().hash(state)
    }
}
impl<D: ::rustc_serialize::Decoder> ::rustc_serialize::Decodable<D> for
    BasicCoverageBlock {
    fn decode(d: &mut D) -> Self { Self::from_u32(d.read_u32()) }
}
impl<E: ::rustc_serialize::Encoder> ::rustc_serialize::Encodable<E> for
    BasicCoverageBlock {
    fn encode(&self, e: &mut E) { e.emit_u32(self.as_u32()); }
}
impl ::std::fmt::Debug for BasicCoverageBlock {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        fmt.write_fmt(format_args!("bcb{0}", self.as_u32()))
    }
}rustc_index::newtype_index! {
226    /// During the `InstrumentCoverage` MIR pass, a BCB is a node in the
227    /// "coverage graph", which is a refinement of the MIR control-flow graph
228    /// that merges or omits some blocks that aren't relevant to coverage.
229    ///
230    /// After that pass is complete, the coverage graph no longer exists, so a
231    /// BCB is effectively an opaque ID.
232    #[stable_hash]
233    #[encodable]
234    #[orderable]
235    #[debug_format = "bcb{}"]
236    pub struct BasicCoverageBlock {
237        const START_BCB = 0;
238    }
239}
240
241/// Data representing a view of some underlying graph, in which each node's
242/// successors have been merged into a single "supernode".
243///
244/// The resulting supernodes have no obvious meaning on their own.
245/// However, merging successor nodes means that a node's out-edges can all
246/// be combined into a single out-edge, whose flow is the same as the flow
247/// (execution count) of its corresponding node in the original graph.
248///
249/// With all node flows now in the original graph now represented as edge flows
250/// in the merged graph, it becomes possible to analyze the original node flows
251/// using techniques for analyzing edge flows.
252#[derive(#[automatically_derived]
impl<Node: ::core::clone::Clone + Idx> ::core::clone::Clone for
    NodeFlowData<Node> {
    #[inline]
    fn clone(&self) -> NodeFlowData<Node> {
        NodeFlowData {
            supernodes: ::core::clone::Clone::clone(&self.supernodes),
            succ_supernodes: ::core::clone::Clone::clone(&self.succ_supernodes),
        }
    }
}Clone, #[automatically_derived]
impl<Node: ::core::fmt::Debug + Idx> ::core::fmt::Debug for NodeFlowData<Node>
    {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "NodeFlowData",
            "supernodes", &self.supernodes, "succ_supernodes",
            &&self.succ_supernodes)
    }
}Debug)]
253#[derive(const _: () =
    {
        impl<'tcx, Node: Idx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for NodeFlowData<Node> where
            IndexVec<Node, Node>: ::rustc_serialize::Encodable<__E> {
            fn encode(&self, __encoder: &mut __E) {
                let NodeFlowData {
                        supernodes: ref __binding_0,
                        succ_supernodes: ref __binding_1 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, Node: Idx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for NodeFlowData<Node> where
            IndexVec<Node, Node>: ::rustc_serialize::Decodable<__D> {
            fn decode(__decoder: &mut __D) -> Self {
                NodeFlowData {
                    supernodes: ::rustc_serialize::Decodable::decode(__decoder),
                    succ_supernodes: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, #[automatically_derived]
impl<Node: ::core::hash::Hash + Idx> ::core::hash::Hash for NodeFlowData<Node>
    {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.supernodes, state);
        ::core::hash::Hash::hash(&self.succ_supernodes, state)
    }
}Hash, const _: () =
    {
        impl<Node: Idx> ::rustc_data_structures::stable_hash::StableHash for
            NodeFlowData<Node> where
            Node: ::rustc_data_structures::stable_hash::StableHash {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    NodeFlowData {
                        supernodes: ref __binding_0,
                        succ_supernodes: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
254pub struct NodeFlowData<Node: Idx> {
255    /// Maps each node to the supernode that contains it, indicated by some
256    /// arbitrary "root" node that is part of that supernode.
257    pub supernodes: IndexVec<Node, Node>,
258    /// For each node, stores the single supernode that all of its successors
259    /// have been merged into.
260    ///
261    /// (Note that each node in a supernode can potentially have a _different_
262    /// successor supernode from its peers.)
263    pub succ_supernodes: IndexVec<Node, Node>,
264}