[−][src]Module rustc_mir::transform::promote_consts
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
A pass that promotes borrows of constant rvalues.
The rvalues considered constant are trees of temps,
each with exactly one initialization, and holding
a constant value with no interior mutability.
They are placed into a new MIR constant body in
promoted
and the borrow rvalue is replaced with
a Literal::Promoted
using the index into promoted
of that constant MIR.
This pass assumes that every use is dominated by an initialization and can otherwise silence errors, if move analysis runs after promotion on broken MIR.
Structs
Promoter |
[ Experimental ]
|
TempCollector |
[ Experimental ]
|
Enums
Candidate |
[ Experimental ] A "root candidate" for promotion, which will become the returned value in a promoted MIR, unless it's a subset of a larger candidate. |
TempState |
[ Experimental ] State of a temporary during collection and promotion. |
Functions
collect_temps |
[ Experimental ]
|
promote_candidates |
[ Experimental ]
|