Enum rustc_trans::middle::region::CodeExtentData [] [src]

pub enum CodeExtentData {
    Misc(NodeId),
    CallSiteScope {
        fn_id: NodeId,
        body_id: NodeId,
    },
    ParameterScope {
        fn_id: NodeId,
        body_id: NodeId,
    },
    DestructionScope(NodeId),
    Remainder(BlockRemainder),
}
🔬 This is a nightly-only experimental API. (rustc_private)

CodeExtent represents a statically-describable extent that can be used to bound the lifetime/region for values.

Misc(node_id): Any AST node that has any extent at all has the Misc(node_id) extent. Other variants represent special cases not immediately derivable from the abstract syntax tree structure.

DestructionScope(node_id) represents the extent of destructors implicitly-attached to node_id that run immediately after the expression for node_id itself. Not every AST node carries a DestructionScope, but those that are terminating_scopes do; see discussion with RegionMaps.

Remainder(BlockRemainder { block, statement_index }) represents the extent of user code running immediately after the initializer expression for the indexed statement, until the end of the block.

So: the following code can be broken down into the extents beneath: let a = f().g( 'b: { let x = d(); let y = d(); x.h(y) } ) ;

+-+ (D12.)
                                                   +-+       (D11.)
                                         +---------+         (R10.)
                                         +-+                  (D9.)
                              +----------+                    (M8.)
                            +----------------------+          (R7.)
                            +-+                               (D6.)
                 +----------+                                 (M5.)
               +-----------------------------------+          (M4.)
    +--------------------------------------------------+      (M3.)
    +--+                                                      (M2.)

+-----------------------------------------------------------+ (M1.)

(M1.): Misc extent of the whole let a = ...; statement. (M2.): Misc extent of the f() expression. (M3.): Misc extent of the f().g(..) expression. (M4.): Misc extent of the block labelled 'b:. (M5.): Misc extent of the let x = d(); statement (D6.): DestructionScope for temporaries created during M5. (R7.): Remainder extent for block 'b:, stmt 0 (let x = ...). (M8.): Misc Extent of the let y = d(); statement. (D9.): DestructionScope for temporaries created during M8. (R10.): Remainder extent for block 'b:, stmt 1 (let y = ...). (D11.): DestructionScope for temporaries and bindings from block 'b:. (D12.): DestructionScope for temporaries created during M1 (e.g. f()).

Note that while the above picture shows the destruction scopes as following their corresponding misc extents, in the internal data structures of the compiler the destruction scopes are represented as enclosing parents. This is sound because we use the enclosing parent relationship just to ensure that referenced values live long enough; phrased another way, the starting point of each range is not really the important thing in the above picture, but rather the ending point.

FIXME (pnkfelix): This currently derives PartialOrd and Ord to placate the same deriving in ty::FreeRegion, but we may want to actually attach a more meaningful ordering to scopes than the one generated via deriving here.

Variants

🔬 This is a nightly-only experimental API. (rustc_private)
🔬 This is a nightly-only experimental API. (rustc_private)

Fields of CallSiteScope

🔬 This is a nightly-only experimental API. (rustc_private)
🔬 This is a nightly-only experimental API. (rustc_private)
🔬 This is a nightly-only experimental API. (rustc_private)

Fields of ParameterScope

🔬 This is a nightly-only experimental API. (rustc_private)
🔬 This is a nightly-only experimental API. (rustc_private)
🔬 This is a nightly-only experimental API. (rustc_private)
🔬 This is a nightly-only experimental API. (rustc_private)

Methods

impl CodeExtentData
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

Returns a node id associated with this scope.

NB: likely to be replaced as API is refined; e.g. pnkfelix anticipates fn entry_node_id and fn each_exit_node_id.

Trait Implementations

impl PartialOrd<CodeExtentData> for CodeExtentData
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl PartialEq<CodeExtentData> for CodeExtentData
[src]

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

This method tests for !=.

impl Hash for CodeExtentData
[src]

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.

impl Clone for CodeExtentData
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Eq for CodeExtentData
[src]

impl Debug for CodeExtentData
[src]

Formats the value using the given formatter.

impl Copy for CodeExtentData
[src]

impl Ord for CodeExtentData
[src]

This method returns an Ordering between self and other. Read more