Skip to main content

Module foreign_modules

Module foreign_modules 

Source

Re-exportsΒ§

use rustc_abi::FIRST_VARIANT; πŸ”’
use rustc_attr_ir::find_attr; πŸ”’
use rustc_data_structures::unord::UnordMap; πŸ”’
use rustc_data_structures::unord::UnordSet; πŸ”’
use rustc_hir as hir; πŸ”’
use rustc_hir::def::DefKind; πŸ”’
use rustc_lint_defs::declare_lint; πŸ”’
use rustc_middle::query::Providers; πŸ”’
use rustc_middle::ty; πŸ”’
use rustc_middle::ty::AdtDef; πŸ”’
use rustc_middle::ty::Instance; πŸ”’
use rustc_middle::ty::Ty; πŸ”’
use rustc_middle::ty::TyCtxt; πŸ”’
use rustc_span::Span; πŸ”’
use rustc_span::Symbol; πŸ”’
use tracing::debug; πŸ”’
use tracing::instrument; πŸ”’
use tracing::instrument; πŸ”’
use crate::diagnostics::BuiltinClashingExtern; πŸ”’
use crate::diagnostics::BuiltinClashingExternSub; πŸ”’
use crate::LintVec; πŸ”’
use crate::types; πŸ”’

StructsΒ§

ClashingExternDeclarations πŸ”’

EnumsΒ§

SymbolName πŸ”’
Differentiate between whether the name for an extern decl came from the link_name attribute or just from declaration itself. This is important because we don’t want to report clashes on symbol name if they don’t actually clash because one or the other links against a symbol with a different name.

StaticsΒ§

CLASHING_EXTERN_DECLARATIONS
The clashing_extern_declarations lint detects when an extern fn has been declared with the same name but different types.

FunctionsΒ§

clashing_extern_declarations πŸ”’
get_relevant_span πŸ”’
We want to ensure that we use spans for both decls that include where the name was defined, whether that was from the link_name attribute or not.
lint_vec πŸ”’
name_of_extern_decl πŸ”’
Get the name of the symbol that’s linked against for a given extern declaration. That is, the name specified in a #[link_name = …] attribute if one was specified, else, just the symbol’s name.
provide πŸ”’
structurally_same_type πŸ”’
Checks whether two types are structurally the same enough that the declarations shouldn’t clash. We need this so we don’t emit a lint when two modules both declare an extern struct, with the same members (as the declarations shouldn’t clash).
structurally_same_type_impl πŸ”’