Struct ra_ap_hir_def::body::BodySourceMap[][src]

pub struct BodySourceMap { /* fields omitted */ }
Expand description

An item body together with the mapping from syntax nodes to HIR expression IDs. This is needed to go from e.g. a position in a file to the HIR expression containing it; but for type inference etc., we want to operate on a structure that is agnostic to the actual positions of expressions in the file, so that we don’t recompute types whenever some whitespace is typed.

One complication here is that, due to macro expansion, a single Body might be spread across several files. So, for each ExprId and PatId, we record both the HirFileId and the position inside the file. However, we only store AST -> ExprId mapping for non-macro files, as it is not clear how to handle this properly for macros.

Implementations

Get a reference to the body source map’s diagnostics.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.