Module rustc_lint::foreign_modules

source ·



  • 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.


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


  • get_lints 🔒
  • 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.
  • 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 🔒
  • 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).