1use std::any::Any;
6use std::path::PathBuf;
7
8use rustc_abi::ExternAbi;
9use rustc_attr_ir::{CfgEntry, PeImportNameType};
10use rustc_data_structures::sync::{self, AppendOnlyIndexVec, FreezeLock};
11use rustc_hir_id::definitions::{DefKey, DefPath, Definitions};
12use rustc_macros::{BlobDecodable, Decodable, Encodable, StableHash};
13use rustc_span::def_id::{
14 CrateNum, DefId, DefPathHash, LOCAL_CRATE, LocalDefId, StableCrateId, StableCrateIdMap,
15};
16use rustc_span::{Span, Symbol};
17use rustc_structures::NativeLibKind;
18
19#[derive(#[automatically_derived]
impl ::core::marker::StructuralPartialEq for CrateSource { }
#[automatically_derived]
impl ::core::cmp::PartialEq for CrateSource {
#[inline]
fn eq(&self, other: &CrateSource) -> bool {
self.dylib == other.dylib && self.rlib == other.rlib &&
self.rmeta == other.rmeta &&
self.sdylib_interface == other.sdylib_interface
}
}PartialEq, #[automatically_derived]
impl ::core::clone::Clone for CrateSource {
#[inline]
fn clone(&self) -> CrateSource {
CrateSource {
dylib: ::core::clone::Clone::clone(&self.dylib),
rlib: ::core::clone::Clone::clone(&self.rlib),
rmeta: ::core::clone::Clone::clone(&self.rmeta),
sdylib_interface: ::core::clone::Clone::clone(&self.sdylib_interface),
}
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for CrateSource {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f, "CrateSource",
"dylib", &self.dylib, "rlib", &self.rlib, "rmeta", &self.rmeta,
"sdylib_interface", &&self.sdylib_interface)
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for CrateSource
{
#[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 {
CrateSource {
dylib: ref __binding_0,
rlib: ref __binding_1,
rmeta: ref __binding_2,
sdylib_interface: 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, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for CrateSource {
fn encode(&self, __encoder: &mut __E) {
let CrateSource {
dylib: ref __binding_0,
rlib: ref __binding_1,
rmeta: ref __binding_2,
sdylib_interface: 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);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for CrateSource {
fn decode(__decoder: &mut __D) -> Self {
CrateSource {
dylib: ::rustc_serialize::Decodable::decode(__decoder),
rlib: ::rustc_serialize::Decodable::decode(__decoder),
rmeta: ::rustc_serialize::Decodable::decode(__decoder),
sdylib_interface: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};Decodable)]
22pub struct CrateSource {
23 pub dylib: Option<PathBuf>,
24 pub rlib: Option<PathBuf>,
25 pub rmeta: Option<PathBuf>,
26 pub sdylib_interface: Option<PathBuf>,
27}
28
29impl CrateSource {
30 #[inline]
31 pub fn paths(&self) -> impl Iterator<Item = &PathBuf> {
32 self.dylib.iter().chain(self.rlib.iter()).chain(self.rmeta.iter())
33 }
34}
35
36#[derive(const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for CrateDepKind {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
CrateDepKind::MacrosOnly => { 0usize }
CrateDepKind::Conditional => { 1usize }
CrateDepKind::Unconditional => { 2usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::BlobDecoder> ::rustc_serialize::Decodable<__D>
for CrateDepKind {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { CrateDepKind::MacrosOnly }
1usize => { CrateDepKind::Conditional }
2usize => { CrateDepKind::Unconditional }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `CrateDepKind`, expected 0..3, actual {0}",
n));
}
}
}
}
};BlobDecodable, #[automatically_derived]
impl ::core::marker::Copy for CrateDepKind { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for CrateDepKind { }
#[automatically_derived]
impl ::core::clone::Clone for CrateDepKind {
#[inline]
fn clone(&self) -> CrateDepKind { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::Ord for CrateDepKind {
#[inline]
fn cmp(&self, other: &CrateDepKind) -> ::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::cmp::PartialOrd for CrateDepKind {
#[inline]
fn partial_cmp(&self, other: &CrateDepKind)
-> ::core::option::Option<::core::cmp::Ordering> {
::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
}
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Eq for CrateDepKind {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for CrateDepKind { }
#[automatically_derived]
impl ::core::cmp::PartialEq for CrateDepKind {
#[inline]
fn eq(&self, other: &CrateDepKind) -> 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::fmt::Debug for CrateDepKind {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
CrateDepKind::MacrosOnly => "MacrosOnly",
CrateDepKind::Conditional => "Conditional",
CrateDepKind::Unconditional => "Unconditional",
})
}
}Debug)]
37#[derive(const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for CrateDepKind
{
#[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 {
CrateDepKind::MacrosOnly => {}
CrateDepKind::Conditional => {}
CrateDepKind::Unconditional => {}
}
}
}
};StableHash)]
38pub enum CrateDepKind {
39 MacrosOnly,
41 Conditional,
44 Unconditional,
48}
49
50impl CrateDepKind {
51 #[inline]
52 pub fn macros_only(self) -> bool {
53 match self {
54 CrateDepKind::MacrosOnly => true,
55 CrateDepKind::Conditional | CrateDepKind::Unconditional => false,
56 }
57 }
58}
59
60#[derive(#[automatically_derived]
impl ::core::marker::Copy for LinkagePreference { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for LinkagePreference {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
LinkagePreference::RequireDynamic => "RequireDynamic",
LinkagePreference::RequireStatic => "RequireStatic",
})
}
}Debug, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for LinkagePreference { }
#[automatically_derived]
impl ::core::cmp::PartialEq for LinkagePreference {
#[inline]
fn eq(&self, other: &LinkagePreference) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for LinkagePreference { }
#[automatically_derived]
impl ::core::clone::Clone for LinkagePreference {
#[inline]
fn clone(&self) -> LinkagePreference { *self }
}Clone, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for LinkagePreference {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
LinkagePreference::RequireDynamic => { 0usize }
LinkagePreference::RequireStatic => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::BlobDecoder> ::rustc_serialize::Decodable<__D>
for LinkagePreference {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { LinkagePreference::RequireDynamic }
1usize => { LinkagePreference::RequireStatic }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `LinkagePreference`, expected 0..2, actual {0}",
n));
}
}
}
}
};BlobDecodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
LinkagePreference {
#[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 {
LinkagePreference::RequireDynamic => {}
LinkagePreference::RequireStatic => {}
}
}
}
};StableHash)]
61pub enum LinkagePreference {
62 RequireDynamic,
63 RequireStatic,
64}
65
66#[derive(#[automatically_derived]
impl ::core::fmt::Debug for NativeLib {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["kind", "name", "cfg", "foreign_module", "verbatim",
"dll_imports"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.kind, &self.name, &self.cfg, &self.foreign_module,
&self.verbatim, &&self.dll_imports];
::core::fmt::Formatter::debug_struct_fields_finish(f, "NativeLib",
names, values)
}
}Debug, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for NativeLib {
fn encode(&self, __encoder: &mut __E) {
let NativeLib {
kind: ref __binding_0,
name: ref __binding_1,
cfg: ref __binding_2,
foreign_module: ref __binding_3,
verbatim: ref __binding_4,
dll_imports: ref __binding_5 } = *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);
::rustc_serialize::Encodable::<__E>::encode(__binding_4,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_5,
__encoder);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for NativeLib {
fn decode(__decoder: &mut __D) -> Self {
NativeLib {
kind: ::rustc_serialize::Decodable::decode(__decoder),
name: ::rustc_serialize::Decodable::decode(__decoder),
cfg: ::rustc_serialize::Decodable::decode(__decoder),
foreign_module: ::rustc_serialize::Decodable::decode(__decoder),
verbatim: ::rustc_serialize::Decodable::decode(__decoder),
dll_imports: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};Decodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for NativeLib {
#[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 {
NativeLib {
kind: ref __binding_0,
name: ref __binding_1,
cfg: ref __binding_2,
foreign_module: ref __binding_3,
verbatim: ref __binding_4,
dll_imports: ref __binding_5 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
{ __binding_3.stable_hash(__hcx, __hasher); }
{ __binding_4.stable_hash(__hcx, __hasher); }
{ __binding_5.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
67pub struct NativeLib {
68 pub kind: NativeLibKind,
69 pub name: Symbol,
70 pub cfg: Option<CfgEntry>,
71 pub foreign_module: Option<DefId>,
72 pub verbatim: Option<bool>,
73 pub dll_imports: Vec<DllImport>,
74}
75
76impl NativeLib {
77 pub fn has_modifiers(&self) -> bool {
78 self.verbatim.is_some() || self.kind.has_modifiers()
79 }
80
81 pub fn wasm_import_module(&self) -> Option<Symbol> {
82 if self.kind == NativeLibKind::WasmImportModule { Some(self.name) } else { None }
83 }
84}
85
86#[derive(#[automatically_derived]
impl ::core::clone::Clone for DllImport {
#[inline]
fn clone(&self) -> DllImport {
DllImport {
name: ::core::clone::Clone::clone(&self.name),
import_name_type: ::core::clone::Clone::clone(&self.import_name_type),
calling_convention: ::core::clone::Clone::clone(&self.calling_convention),
span: ::core::clone::Clone::clone(&self.span),
symbol_type: ::core::clone::Clone::clone(&self.symbol_type),
size: ::core::clone::Clone::clone(&self.size),
}
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for DllImport {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["name", "import_name_type", "calling_convention", "span",
"symbol_type", "size"];
let values: &[&dyn ::core::fmt::Debug] =
&[&self.name, &self.import_name_type, &self.calling_convention,
&self.span, &self.symbol_type, &&self.size];
::core::fmt::Formatter::debug_struct_fields_finish(f, "DllImport",
names, values)
}
}Debug, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for DllImport {
fn encode(&self, __encoder: &mut __E) {
let DllImport {
name: ref __binding_0,
import_name_type: ref __binding_1,
calling_convention: ref __binding_2,
span: ref __binding_3,
symbol_type: ref __binding_4,
size: ref __binding_5 } = *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);
::rustc_serialize::Encodable::<__E>::encode(__binding_4,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_5,
__encoder);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for DllImport {
fn decode(__decoder: &mut __D) -> Self {
DllImport {
name: ::rustc_serialize::Decodable::decode(__decoder),
import_name_type: ::rustc_serialize::Decodable::decode(__decoder),
calling_convention: ::rustc_serialize::Decodable::decode(__decoder),
span: ::rustc_serialize::Decodable::decode(__decoder),
symbol_type: ::rustc_serialize::Decodable::decode(__decoder),
size: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};Decodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for DllImport {
#[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 {
DllImport {
name: ref __binding_0,
import_name_type: ref __binding_1,
calling_convention: ref __binding_2,
span: ref __binding_3,
symbol_type: ref __binding_4,
size: ref __binding_5 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
{ __binding_3.stable_hash(__hcx, __hasher); }
{ __binding_4.stable_hash(__hcx, __hasher); }
{ __binding_5.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
87pub struct DllImport {
88 pub name: Symbol,
89 pub import_name_type: Option<PeImportNameType>,
90 pub calling_convention: DllCallingConvention,
95 pub span: Span,
97 pub symbol_type: DllImportSymbolType,
98 pub size: rustc_abi::Size,
99}
100
101#[derive(#[automatically_derived]
impl ::core::marker::Copy for DllImportSymbolType { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for DllImportSymbolType { }
#[automatically_derived]
impl ::core::clone::Clone for DllImportSymbolType {
#[inline]
fn clone(&self) -> DllImportSymbolType { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for DllImportSymbolType {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
DllImportSymbolType::Function => "Function",
DllImportSymbolType::Static => "Static",
DllImportSymbolType::ThreadLocal => "ThreadLocal",
})
}
}Debug, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for DllImportSymbolType {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
DllImportSymbolType::Function => { 0usize }
DllImportSymbolType::Static => { 1usize }
DllImportSymbolType::ThreadLocal => { 2usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for DllImportSymbolType {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { DllImportSymbolType::Function }
1usize => { DllImportSymbolType::Static }
2usize => { DllImportSymbolType::ThreadLocal }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `DllImportSymbolType`, expected 0..3, actual {0}",
n));
}
}
}
}
};Decodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
DllImportSymbolType {
#[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 {
DllImportSymbolType::Function => {}
DllImportSymbolType::Static => {}
DllImportSymbolType::ThreadLocal => {}
}
}
}
};StableHash, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for DllImportSymbolType { }
#[automatically_derived]
impl ::core::cmp::PartialEq for DllImportSymbolType {
#[inline]
fn eq(&self, other: &DllImportSymbolType) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq)]
102pub enum DllImportSymbolType {
103 Function,
104 Static,
105 ThreadLocal,
106}
107
108impl DllImport {
109 pub fn ordinal(&self) -> Option<u16> {
110 if let Some(PeImportNameType::Ordinal(ordinal)) = self.import_name_type {
111 Some(ordinal)
112 } else {
113 None
114 }
115 }
116
117 pub fn is_missing_decorations(&self) -> bool {
118 self.import_name_type == Some(PeImportNameType::Undecorated)
119 || self.import_name_type == Some(PeImportNameType::NoPrefix)
120 }
121}
122
123#[derive(#[automatically_derived]
impl ::core::clone::Clone for DllCallingConvention {
#[inline]
fn clone(&self) -> DllCallingConvention {
match self {
DllCallingConvention::C => DllCallingConvention::C,
DllCallingConvention::Stdcall(__self_0) =>
DllCallingConvention::Stdcall(::core::clone::Clone::clone(__self_0)),
DllCallingConvention::Fastcall(__self_0) =>
DllCallingConvention::Fastcall(::core::clone::Clone::clone(__self_0)),
DllCallingConvention::Vectorcall(__self_0) =>
DllCallingConvention::Vectorcall(::core::clone::Clone::clone(__self_0)),
}
}
}Clone, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for DllCallingConvention { }
#[automatically_derived]
impl ::core::cmp::PartialEq for DllCallingConvention {
#[inline]
fn eq(&self, other: &DllCallingConvention) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(DllCallingConvention::Stdcall(__self_0),
DllCallingConvention::Stdcall(__arg1_0)) =>
__self_0 == __arg1_0,
(DllCallingConvention::Fastcall(__self_0),
DllCallingConvention::Fastcall(__arg1_0)) =>
__self_0 == __arg1_0,
(DllCallingConvention::Vectorcall(__self_0),
DllCallingConvention::Vectorcall(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for DllCallingConvention {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
DllCallingConvention::C =>
::core::fmt::Formatter::write_str(f, "C"),
DllCallingConvention::Stdcall(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Stdcall", &__self_0),
DllCallingConvention::Fastcall(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Fastcall", &__self_0),
DllCallingConvention::Vectorcall(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Vectorcall", &__self_0),
}
}
}Debug, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for DllCallingConvention {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
DllCallingConvention::C => { 0usize }
DllCallingConvention::Stdcall(ref __binding_0) => { 1usize }
DllCallingConvention::Fastcall(ref __binding_0) => {
2usize
}
DllCallingConvention::Vectorcall(ref __binding_0) => {
3usize
}
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
DllCallingConvention::C => {}
DllCallingConvention::Stdcall(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
DllCallingConvention::Fastcall(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
DllCallingConvention::Vectorcall(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for DllCallingConvention {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { DllCallingConvention::C }
1usize => {
DllCallingConvention::Stdcall(::rustc_serialize::Decodable::decode(__decoder))
}
2usize => {
DllCallingConvention::Fastcall(::rustc_serialize::Decodable::decode(__decoder))
}
3usize => {
DllCallingConvention::Vectorcall(::rustc_serialize::Decodable::decode(__decoder))
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `DllCallingConvention`, expected 0..4, actual {0}",
n));
}
}
}
}
};Decodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
DllCallingConvention {
#[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 {
DllCallingConvention::C => {}
DllCallingConvention::Stdcall(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
DllCallingConvention::Fastcall(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
DllCallingConvention::Vectorcall(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
128pub enum DllCallingConvention {
129 C,
130 Stdcall(usize),
131 Fastcall(usize),
132 Vectorcall(usize),
133}
134
135#[derive(#[automatically_derived]
impl ::core::clone::Clone for ForeignModule {
#[inline]
fn clone(&self) -> ForeignModule {
ForeignModule {
foreign_items: ::core::clone::Clone::clone(&self.foreign_items),
def_id: ::core::clone::Clone::clone(&self.def_id),
abi: ::core::clone::Clone::clone(&self.abi),
}
}
}Clone, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for ForeignModule {
fn encode(&self, __encoder: &mut __E) {
let ForeignModule {
foreign_items: ref __binding_0,
def_id: ref __binding_1,
abi: 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);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for ForeignModule {
fn decode(__decoder: &mut __D) -> Self {
ForeignModule {
foreign_items: ::rustc_serialize::Decodable::decode(__decoder),
def_id: ::rustc_serialize::Decodable::decode(__decoder),
abi: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};Decodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
ForeignModule {
#[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 {
ForeignModule {
foreign_items: ref __binding_0,
def_id: ref __binding_1,
abi: ref __binding_2 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, #[automatically_derived]
impl ::core::fmt::Debug for ForeignModule {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "ForeignModule",
"foreign_items", &self.foreign_items, "def_id", &self.def_id,
"abi", &&self.abi)
}
}Debug)]
136pub struct ForeignModule {
137 pub foreign_items: Vec<DefId>,
138 pub def_id: DefId,
139 pub abi: ExternAbi,
140}
141
142#[derive(#[automatically_derived]
impl ::core::marker::Copy for ExternCrate { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for ExternCrate { }
#[automatically_derived]
impl ::core::clone::Clone for ExternCrate {
#[inline]
fn clone(&self) -> ExternCrate {
let _: ::core::clone::AssertParamIsClone<ExternCrateSource>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<usize>;
let _: ::core::clone::AssertParamIsClone<CrateNum>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ExternCrate {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f, "ExternCrate",
"src", &self.src, "span", &self.span, "path_len", &self.path_len,
"dependency_of", &&self.dependency_of)
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for ExternCrate
{
#[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 {
ExternCrate {
src: ref __binding_0,
span: ref __binding_1,
path_len: ref __binding_2,
dependency_of: 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)]
143pub struct ExternCrate {
144 pub src: ExternCrateSource,
145
146 pub span: Span,
148
149 pub path_len: usize,
152
153 pub dependency_of: CrateNum,
155}
156
157impl ExternCrate {
158 #[inline]
162 pub fn is_direct(&self) -> bool {
163 self.dependency_of == LOCAL_CRATE
164 }
165
166 #[inline]
167 pub fn rank(&self) -> impl PartialOrd {
168 (self.is_direct(), !self.path_len)
172 }
173}
174
175#[derive(#[automatically_derived]
impl ::core::marker::Copy for ExternCrateSource { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for ExternCrateSource { }
#[automatically_derived]
impl ::core::clone::Clone for ExternCrateSource {
#[inline]
fn clone(&self) -> ExternCrateSource {
let _: ::core::clone::AssertParamIsClone<DefId>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ExternCrateSource {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
ExternCrateSource::Extern(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Extern",
&__self_0),
ExternCrateSource::Path =>
::core::fmt::Formatter::write_str(f, "Path"),
}
}
}Debug, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
ExternCrateSource {
#[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 {
ExternCrateSource::Extern(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ExternCrateSource::Path => {}
}
}
}
};StableHash)]
176pub enum ExternCrateSource {
177 Extern(
179 DefId,
183 ),
184 Path,
186}
187
188pub trait CrateStore: std::fmt::Debug {
198 fn as_any(&self) -> &dyn Any;
199 fn untracked_as_any(&mut self) -> &mut dyn Any;
200
201 fn def_key(&self, def: DefId) -> DefKey;
205 fn def_path(&self, def: DefId) -> DefPath;
206 fn def_path_hash(&self, def: DefId) -> DefPathHash;
207
208 fn crate_name(&self, cnum: CrateNum) -> Symbol;
211 fn stable_crate_id(&self, cnum: CrateNum) -> StableCrateId;
212}
213
214pub type CrateStoreDyn = dyn CrateStore + sync::DynSync + sync::DynSend;
215
216pub struct Untracked {
217 pub cstore: FreezeLock<Box<CrateStoreDyn>>,
218 pub source_span: AppendOnlyIndexVec<LocalDefId, Span>,
220 pub definitions: FreezeLock<Definitions>,
221 pub stable_crate_ids: FreezeLock<StableCrateIdMap>,
223}
224
225impl Untracked {
226 pub fn freeze_cstore(&self) {
230 self.cstore.freeze();
231 self.stable_crate_ids.freeze();
232 }
233}