Crate rustc_privacy[−][src]

Modules

Checking that constant values used in types can be successfully evaluated.

HIR walker for walking the contents of nodes.

This module contains all the defined keyword Symbols.

This module contains all the defined non-keyword Symbols.

Defines how the compiler represents types internally.

Functionality for ordering and comparison.

Utilities for formatting and printing Strings.

Basic functions for dealing with memory.

Macros

Structs

A tree representing an anonymous constant.

Holds a map of accessibility levels for reachable HIR nodes.

Typed constant value.

A DefId identifies a particular definition, by combining a crate index and a def index.

The embargo visitor, used to determine the exports of the AST.

Visitor used to determine impl visibility and reachability.

A LocalDefId is equivalent to a DefId with krate == LOCAL_CRATE. Since we encode this information in the type, we can ensure at compile time that no DefIds from upstream crates get thrown into the mix. There are quite a few cases where we know that only DefIds from the local crate are expected and a DefId from a different crate would signify a bug somewhere. This is when LocalDefId comes in handy.

Represents a macro definition.

Name privacy visitor, checks privacy and reports violations. Most of name privacy checks are performed during the main resolution phase, or later in type checking when field accesses and associated items are resolved. This pass performs remaining checks for fields in struct expressions and patterns.

Obsolete visitors for checking for private items in public interfaces. These visitors are supposed to be kept in frozen state and produce an “old error node set”. For backward compatibility the new visitor reports warnings instead of hard errors when the erroneous node is not in this old set.

Visitor used to determine if pub(restricted) is used anywhere in the crate.

SearchInterfaceForPrivateItemsVisitor traverses an item’s interface and finds any private components in it. PrivateItemsInPublicInterfacesVisitor ensures there are no private types and traits in public interfaces.

A compressed span.

A complete reference to a trait. These take numerous guises in syntax, but perhaps the most recognizable form is in a where-clause:

The central data structure of the compiler. It stores references to the various arenas and also houses the results of the various compiler queries that have been performed. See the rustc dev guide for more details.

Type privacy visitor, checks types for privacy and reports violations. Both explicitly written types and inferred types of expressions and patterns are checked. Checks are performed on “semantic” types regardless of names and their hygiene.

Zero-sized type used to mark things that “act like” they own a T.

Enums

A node of an AbstractConst.

Represents the levels of accessibility an item can have.

What kind of definition something is; e.g., mod vs struct.

Specifies what nested things a visitor wants to visit. The most common choice is OnlyBodies, which will cause the visitor to visit fn bodies for fns that it encounters, but skip over nested item-like things.

The resolution of a path or export.

A property of a macro expansion that determines how identifiers produced by that expansion are resolved.

Used to tell an operation whether it should exit early or go on as usual.

Constants

The crate root is always assigned index 0 by the AST Map code, thanks to NodeCollector::new.

Item definitions in the currently-compiled crate would have the CrateNum LOCAL_CRATE in their DefId.

Traits

Generic infrastructure used to implement specific visitors below. Implemented to visit all DefIds in a type. Visiting DefIds is useful because visibilities and reachabilities are attached to them. The idea is to visit “all components of a type”, as documented in https://github.com/rust-lang/rfcs/blob/master/text/2145-type-privacy.md#how-to-determine-visibility-of-a-type. The default type visitor (TypeVisitor) does most of the job, but it has some shortcomings. First, it doesn’t have overridable fn visit_trait_ref, so we have to catch trait DefIds manually. Second, it doesn’t visit some type components like signatures of fn types, or traits in impl Trait, see individual comments in DefIdVisitorSkeleton::visit_ty.

This trait is implemented for every type that can be folded. Basically, every type that has a corresponding method in TypeFolder.

Each method of the Visitor trait is a hook to be potentially overridden. Each method’s default implementation recursively visits the substructure of the input via the corresponding walk method; e.g., the visit_mod method by default calls intravisit::walk_mod.

Functions

Type Definitions

Type alias for a hashmap using the fx hash algorithm.

A substitution mapping generic parameters to new values.