Module translate_crate

Source
Expand description

This file governs the overall translation of items.

Translation works as follows: we translate each TransItemSource of interest into an appropriate item. In the process of translating an item we may find more hax::DefIds of interest; we register those as an appropriate TransItemSource, which will 1/ enqueue the item so that it eventually gets translated too, and 2/ return an AnyTransId we can use to refer to it.

We start with the DefId of the current crate (or of anything passed to --start-from) and recursively translate everything we find.

There’s another important component at play: opacity. Each item is assigned an opacity based on its name. By default, items from the local crate are transparent and items from foreign crates are opaque (this can be controlled with --include, --opaque and --exclude). If an item is opaque, its signature/“outer shell” will be translated (e.g. for functions that’s the signature) but not its contents.

Structs§

TransItemSource
The id of an untranslated item. Note that a given DefId may show up as multiple different item sources, e.g. a constant will have both a Global version (for the constant itself) and a FunDecl one (for its initializer function).

Enums§

TransItemSourceKind

Functions§

translate