1#![cfg_attr(feature = "nightly", allow(internal_features))]
10#![cfg_attr(feature = "nightly", feature(never_type))]
11#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
12use std::fmt;
15
16#[cfg(feature = "nightly")]
17use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext};
18#[cfg(feature = "nightly")]
19use rustc_span::{Symbol, sym};
20
21pub mod visit;
22
23#[derive(#[automatically_derived]
impl ::core::clone::Clone for IntTy {
#[inline]
fn clone(&self) -> IntTy { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for IntTy { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for IntTy {
#[inline]
fn eq(&self, other: &IntTy) -> 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 IntTy {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for IntTy {
#[inline]
fn partial_cmp(&self, other: &IntTy)
-> ::core::option::Option<::core::cmp::Ordering> {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr)
}
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for IntTy {
#[inline]
fn cmp(&self, other: &IntTy) -> ::core::cmp::Ordering {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr)
}
}Ord, #[automatically_derived]
impl ::core::hash::Hash for IntTy {
#[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)]
24#[cfg_attr(
25 feature = "nightly",
26 derive(const _: () =
{
impl<__E: ::rustc_serialize::Encoder>
::rustc_serialize::Encodable<__E> for IntTy {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
IntTy::Isize => { 0usize }
IntTy::I8 => { 1usize }
IntTy::I16 => { 2usize }
IntTy::I32 => { 3usize }
IntTy::I64 => { 4usize }
IntTy::I128 => { 5usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
IntTy::Isize => {}
IntTy::I8 => {}
IntTy::I16 => {}
IntTy::I32 => {}
IntTy::I64 => {}
IntTy::I128 => {}
}
}
}
};Encodable_NoContext, const _: () =
{
impl<__D: ::rustc_serialize::Decoder>
::rustc_serialize::Decodable<__D> for IntTy {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { IntTy::Isize }
1usize => { IntTy::I8 }
2usize => { IntTy::I16 }
3usize => { IntTy::I32 }
4usize => { IntTy::I64 }
5usize => { IntTy::I128 }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `IntTy`, expected 0..6, actual {0}",
n));
}
}
}
}
};Decodable_NoContext, const _: () =
{
impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
for IntTy {
#[inline]
fn hash_stable(&self, __hcx: &mut __CTX,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
match *self {
IntTy::Isize => {}
IntTy::I8 => {}
IntTy::I16 => {}
IntTy::I32 => {}
IntTy::I64 => {}
IntTy::I128 => {}
}
}
}
};HashStable_NoContext)
27)]
28pub enum IntTy {
29 Isize,
30 I8,
31 I16,
32 I32,
33 I64,
34 I128,
35}
36
37impl IntTy {
38 pub fn name_str(&self) -> &'static str {
39 match *self {
40 IntTy::Isize => "isize",
41 IntTy::I8 => "i8",
42 IntTy::I16 => "i16",
43 IntTy::I32 => "i32",
44 IntTy::I64 => "i64",
45 IntTy::I128 => "i128",
46 }
47 }
48
49 #[cfg(feature = "nightly")]
50 pub fn name(self) -> Symbol {
51 match self {
52 IntTy::Isize => sym::isize,
53 IntTy::I8 => sym::i8,
54 IntTy::I16 => sym::i16,
55 IntTy::I32 => sym::i32,
56 IntTy::I64 => sym::i64,
57 IntTy::I128 => sym::i128,
58 }
59 }
60
61 pub fn bit_width(&self) -> Option<u64> {
62 Some(match *self {
63 IntTy::Isize => return None,
64 IntTy::I8 => 8,
65 IntTy::I16 => 16,
66 IntTy::I32 => 32,
67 IntTy::I64 => 64,
68 IntTy::I128 => 128,
69 })
70 }
71
72 pub fn normalize(&self, target_width: u16) -> Self {
73 match self {
74 IntTy::Isize => match target_width {
75 16 => IntTy::I16,
76 32 => IntTy::I32,
77 64 => IntTy::I64,
78 _ => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
79 },
80 _ => *self,
81 }
82 }
83
84 pub fn to_unsigned(self) -> UintTy {
85 match self {
86 IntTy::Isize => UintTy::Usize,
87 IntTy::I8 => UintTy::U8,
88 IntTy::I16 => UintTy::U16,
89 IntTy::I32 => UintTy::U32,
90 IntTy::I64 => UintTy::U64,
91 IntTy::I128 => UintTy::U128,
92 }
93 }
94}
95
96impl fmt::Debug for IntTy {
97 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
98 f.write_fmt(format_args!("{0}", self.name_str()))write!(f, "{}", self.name_str())
99 }
100}
101
102#[derive(#[automatically_derived]
impl ::core::clone::Clone for UintTy {
#[inline]
fn clone(&self) -> UintTy { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for UintTy {
#[inline]
fn eq(&self, other: &UintTy) -> 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 UintTy {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for UintTy {
#[inline]
fn partial_cmp(&self, other: &UintTy)
-> ::core::option::Option<::core::cmp::Ordering> {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr)
}
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for UintTy {
#[inline]
fn cmp(&self, other: &UintTy) -> ::core::cmp::Ordering {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr)
}
}Ord, #[automatically_derived]
impl ::core::hash::Hash for UintTy {
#[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, #[automatically_derived]
impl ::core::marker::Copy for UintTy { }Copy)]
103#[cfg_attr(
104 feature = "nightly",
105 derive(const _: () =
{
impl<__E: ::rustc_serialize::Encoder>
::rustc_serialize::Encodable<__E> for UintTy {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
UintTy::Usize => { 0usize }
UintTy::U8 => { 1usize }
UintTy::U16 => { 2usize }
UintTy::U32 => { 3usize }
UintTy::U64 => { 4usize }
UintTy::U128 => { 5usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
UintTy::Usize => {}
UintTy::U8 => {}
UintTy::U16 => {}
UintTy::U32 => {}
UintTy::U64 => {}
UintTy::U128 => {}
}
}
}
};Encodable_NoContext, const _: () =
{
impl<__D: ::rustc_serialize::Decoder>
::rustc_serialize::Decodable<__D> for UintTy {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { UintTy::Usize }
1usize => { UintTy::U8 }
2usize => { UintTy::U16 }
3usize => { UintTy::U32 }
4usize => { UintTy::U64 }
5usize => { UintTy::U128 }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `UintTy`, expected 0..6, actual {0}",
n));
}
}
}
}
};Decodable_NoContext, const _: () =
{
impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
for UintTy {
#[inline]
fn hash_stable(&self, __hcx: &mut __CTX,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
match *self {
UintTy::Usize => {}
UintTy::U8 => {}
UintTy::U16 => {}
UintTy::U32 => {}
UintTy::U64 => {}
UintTy::U128 => {}
}
}
}
};HashStable_NoContext)
106)]
107pub enum UintTy {
108 Usize,
109 U8,
110 U16,
111 U32,
112 U64,
113 U128,
114}
115
116impl UintTy {
117 pub fn name_str(&self) -> &'static str {
118 match *self {
119 UintTy::Usize => "usize",
120 UintTy::U8 => "u8",
121 UintTy::U16 => "u16",
122 UintTy::U32 => "u32",
123 UintTy::U64 => "u64",
124 UintTy::U128 => "u128",
125 }
126 }
127
128 #[cfg(feature = "nightly")]
129 pub fn name(self) -> Symbol {
130 match self {
131 UintTy::Usize => sym::usize,
132 UintTy::U8 => sym::u8,
133 UintTy::U16 => sym::u16,
134 UintTy::U32 => sym::u32,
135 UintTy::U64 => sym::u64,
136 UintTy::U128 => sym::u128,
137 }
138 }
139
140 pub fn bit_width(&self) -> Option<u64> {
141 Some(match *self {
142 UintTy::Usize => return None,
143 UintTy::U8 => 8,
144 UintTy::U16 => 16,
145 UintTy::U32 => 32,
146 UintTy::U64 => 64,
147 UintTy::U128 => 128,
148 })
149 }
150
151 pub fn normalize(&self, target_width: u16) -> Self {
152 match self {
153 UintTy::Usize => match target_width {
154 16 => UintTy::U16,
155 32 => UintTy::U32,
156 64 => UintTy::U64,
157 _ => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
158 },
159 _ => *self,
160 }
161 }
162
163 pub fn to_signed(self) -> IntTy {
164 match self {
165 UintTy::Usize => IntTy::Isize,
166 UintTy::U8 => IntTy::I8,
167 UintTy::U16 => IntTy::I16,
168 UintTy::U32 => IntTy::I32,
169 UintTy::U64 => IntTy::I64,
170 UintTy::U128 => IntTy::I128,
171 }
172 }
173}
174
175impl fmt::Debug for UintTy {
176 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
177 f.write_fmt(format_args!("{0}", self.name_str()))write!(f, "{}", self.name_str())
178 }
179}
180
181#[derive(#[automatically_derived]
impl ::core::clone::Clone for FloatTy {
#[inline]
fn clone(&self) -> FloatTy { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for FloatTy { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for FloatTy {
#[inline]
fn eq(&self, other: &FloatTy) -> 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 FloatTy {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for FloatTy {
#[inline]
fn partial_cmp(&self, other: &FloatTy)
-> ::core::option::Option<::core::cmp::Ordering> {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr)
}
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for FloatTy {
#[inline]
fn cmp(&self, other: &FloatTy) -> ::core::cmp::Ordering {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr)
}
}Ord, #[automatically_derived]
impl ::core::hash::Hash for FloatTy {
#[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)]
182#[cfg_attr(
183 feature = "nightly",
184 derive(const _: () =
{
impl<__E: ::rustc_serialize::Encoder>
::rustc_serialize::Encodable<__E> for FloatTy {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
FloatTy::F16 => { 0usize }
FloatTy::F32 => { 1usize }
FloatTy::F64 => { 2usize }
FloatTy::F128 => { 3usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
FloatTy::F16 => {}
FloatTy::F32 => {}
FloatTy::F64 => {}
FloatTy::F128 => {}
}
}
}
};Encodable_NoContext, const _: () =
{
impl<__D: ::rustc_serialize::Decoder>
::rustc_serialize::Decodable<__D> for FloatTy {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { FloatTy::F16 }
1usize => { FloatTy::F32 }
2usize => { FloatTy::F64 }
3usize => { FloatTy::F128 }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `FloatTy`, expected 0..4, actual {0}",
n));
}
}
}
}
};Decodable_NoContext, const _: () =
{
impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
for FloatTy {
#[inline]
fn hash_stable(&self, __hcx: &mut __CTX,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
match *self {
FloatTy::F16 => {}
FloatTy::F32 => {}
FloatTy::F64 => {}
FloatTy::F128 => {}
}
}
}
};HashStable_NoContext)
185)]
186pub enum FloatTy {
187 F16,
188 F32,
189 F64,
190 F128,
191}
192
193impl FloatTy {
194 pub fn name_str(self) -> &'static str {
195 match self {
196 FloatTy::F16 => "f16",
197 FloatTy::F32 => "f32",
198 FloatTy::F64 => "f64",
199 FloatTy::F128 => "f128",
200 }
201 }
202
203 #[cfg(feature = "nightly")]
204 pub fn name(self) -> Symbol {
205 match self {
206 FloatTy::F16 => sym::f16,
207 FloatTy::F32 => sym::f32,
208 FloatTy::F64 => sym::f64,
209 FloatTy::F128 => sym::f128,
210 }
211 }
212
213 pub fn bit_width(self) -> u64 {
214 match self {
215 FloatTy::F16 => 16,
216 FloatTy::F32 => 32,
217 FloatTy::F64 => 64,
218 FloatTy::F128 => 128,
219 }
220 }
221}
222
223impl fmt::Debug for FloatTy {
224 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
225 f.write_fmt(format_args!("{0}", self.name_str()))write!(f, "{}", self.name_str())
226 }
227}
228
229#[derive(#[automatically_derived]
impl ::core::clone::Clone for Movability {
#[inline]
fn clone(&self) -> Movability { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for Movability {
#[inline]
fn eq(&self, other: &Movability) -> 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 Movability {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for Movability {
#[inline]
fn partial_cmp(&self, other: &Movability)
-> ::core::option::Option<::core::cmp::Ordering> {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr)
}
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for Movability {
#[inline]
fn cmp(&self, other: &Movability) -> ::core::cmp::Ordering {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr)
}
}Ord, #[automatically_derived]
impl ::core::hash::Hash for Movability {
#[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, #[automatically_derived]
impl ::core::fmt::Debug for Movability {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
Movability::Static => "Static",
Movability::Movable => "Movable",
})
}
}Debug, #[automatically_derived]
impl ::core::marker::Copy for Movability { }Copy)]
232#[cfg_attr(
233 feature = "nightly",
234 derive(const _: () =
{
impl<__E: ::rustc_serialize::Encoder>
::rustc_serialize::Encodable<__E> for Movability {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
Movability::Static => { 0usize }
Movability::Movable => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
Movability::Static => {}
Movability::Movable => {}
}
}
}
};Encodable_NoContext, const _: () =
{
impl<__D: ::rustc_serialize::Decoder>
::rustc_serialize::Decodable<__D> for Movability {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { Movability::Static }
1usize => { Movability::Movable }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `Movability`, expected 0..2, actual {0}",
n));
}
}
}
}
};Decodable_NoContext, const _: () =
{
impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
for Movability {
#[inline]
fn hash_stable(&self, __hcx: &mut __CTX,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
match *self {
Movability::Static => {}
Movability::Movable => {}
}
}
}
};HashStable_NoContext)
235)]
236pub enum Movability {
237 Static,
239 Movable,
241}
242
243#[derive(#[automatically_derived]
impl ::core::clone::Clone for Mutability {
#[inline]
fn clone(&self) -> Mutability { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for Mutability {
#[inline]
fn eq(&self, other: &Mutability) -> 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 Mutability {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for Mutability {
#[inline]
fn partial_cmp(&self, other: &Mutability)
-> ::core::option::Option<::core::cmp::Ordering> {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr)
}
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for Mutability {
#[inline]
fn cmp(&self, other: &Mutability) -> ::core::cmp::Ordering {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr)
}
}Ord, #[automatically_derived]
impl ::core::hash::Hash for Mutability {
#[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, #[automatically_derived]
impl ::core::fmt::Debug for Mutability {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
Mutability::Not => "Not",
Mutability::Mut => "Mut",
})
}
}Debug, #[automatically_derived]
impl ::core::marker::Copy for Mutability { }Copy)]
244#[cfg_attr(
245 feature = "nightly",
246 derive(const _: () =
{
impl<__E: ::rustc_serialize::Encoder>
::rustc_serialize::Encodable<__E> for Mutability {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
Mutability::Not => { 0usize }
Mutability::Mut => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self { Mutability::Not => {} Mutability::Mut => {} }
}
}
};Encodable_NoContext, const _: () =
{
impl<__D: ::rustc_serialize::Decoder>
::rustc_serialize::Decodable<__D> for Mutability {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { Mutability::Not }
1usize => { Mutability::Mut }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `Mutability`, expected 0..2, actual {0}",
n));
}
}
}
}
};Decodable_NoContext, const _: () =
{
impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
for Mutability {
#[inline]
fn hash_stable(&self, __hcx: &mut __CTX,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
match *self { Mutability::Not => {} Mutability::Mut => {} }
}
}
};HashStable_NoContext)
247)]
248pub enum Mutability {
249 Not,
251 Mut,
252}
253
254impl Mutability {
255 pub fn invert(self) -> Self {
256 match self {
257 Mutability::Mut => Mutability::Not,
258 Mutability::Not => Mutability::Mut,
259 }
260 }
261
262 pub fn prefix_str(self) -> &'static str {
264 match self {
265 Mutability::Mut => "mut ",
266 Mutability::Not => "",
267 }
268 }
269
270 pub fn ref_prefix_str(self) -> &'static str {
272 match self {
273 Mutability::Not => "&",
274 Mutability::Mut => "&mut ",
275 }
276 }
277
278 pub fn ptr_str(self) -> &'static str {
280 match self {
281 Mutability::Not => "const",
282 Mutability::Mut => "mut",
283 }
284 }
285
286 pub fn mutably_str(self) -> &'static str {
288 match self {
289 Mutability::Not => "",
290 Mutability::Mut => "mutably ",
291 }
292 }
293
294 pub fn is_mut(self) -> bool {
296 #[allow(non_exhaustive_omitted_patterns)] match self {
Self::Mut => true,
_ => false,
}matches!(self, Self::Mut)
297 }
298
299 pub fn is_not(self) -> bool {
301 #[allow(non_exhaustive_omitted_patterns)] match self {
Self::Not => true,
_ => false,
}matches!(self, Self::Not)
302 }
303}
304
305#[derive(#[automatically_derived]
impl ::core::clone::Clone for Pinnedness {
#[inline]
fn clone(&self) -> Pinnedness { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for Pinnedness {
#[inline]
fn eq(&self, other: &Pinnedness) -> 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 Pinnedness {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for Pinnedness {
#[inline]
fn partial_cmp(&self, other: &Pinnedness)
-> ::core::option::Option<::core::cmp::Ordering> {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr)
}
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for Pinnedness {
#[inline]
fn cmp(&self, other: &Pinnedness) -> ::core::cmp::Ordering {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr)
}
}Ord, #[automatically_derived]
impl ::core::hash::Hash for Pinnedness {
#[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, #[automatically_derived]
impl ::core::fmt::Debug for Pinnedness {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
Pinnedness::Not => "Not",
Pinnedness::Pinned => "Pinned",
})
}
}Debug, #[automatically_derived]
impl ::core::marker::Copy for Pinnedness { }Copy)]
306#[cfg_attr(
307 feature = "nightly",
308 derive(const _: () =
{
impl<__E: ::rustc_serialize::Encoder>
::rustc_serialize::Encodable<__E> for Pinnedness {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
Pinnedness::Not => { 0usize }
Pinnedness::Pinned => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self { Pinnedness::Not => {} Pinnedness::Pinned => {} }
}
}
};Encodable_NoContext, const _: () =
{
impl<__D: ::rustc_serialize::Decoder>
::rustc_serialize::Decodable<__D> for Pinnedness {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { Pinnedness::Not }
1usize => { Pinnedness::Pinned }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `Pinnedness`, expected 0..2, actual {0}",
n));
}
}
}
}
};Decodable_NoContext, const _: () =
{
impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
for Pinnedness {
#[inline]
fn hash_stable(&self, __hcx: &mut __CTX,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
match *self { Pinnedness::Not => {} Pinnedness::Pinned => {} }
}
}
};HashStable_NoContext)
309)]
310pub enum Pinnedness {
311 Not,
312 Pinned,
313}
314
315impl Pinnedness {
316 pub fn is_pinned(self) -> bool {
318 #[allow(non_exhaustive_omitted_patterns)] match self {
Self::Pinned => true,
_ => false,
}matches!(self, Self::Pinned)
319 }
320
321 pub fn prefix_str(self, mutbl: Mutability) -> &'static str {
324 match (self, mutbl) {
325 (Pinnedness::Pinned, Mutability::Mut) => "pin mut ",
326 (Pinnedness::Pinned, Mutability::Not) => "pin const ",
327 (Pinnedness::Not, Mutability::Mut) => "mut ",
328 (Pinnedness::Not, Mutability::Not) => "",
329 }
330 }
331}