pub struct WorkProduct {
    pub cgu_name: String,
    pub saved_files: UnordMap<String, String>,
}
Expand description

A “work product” is an intermediate result that we save into the incremental directory for later re-use. The primary example are the object files that we save for each partition at code generation time.

Each work product is associated with a dep-node, representing the process that produced the work-product. If that dep-node is found to be dirty when we load up, then we will delete the work-product at load time. If the work-product is found to be clean, then we will keep a record in the previous_work_products list.

In addition, work products have an associated hash. This hash is an extra hash that can be used to decide if the work-product from a previous compilation can be re-used (in addition to the dirty edges check).

As the primary example, consider the object files we generate for each partition. In the first run, we create partitions based on the symbols that need to be compiled. For each partition P, we hash the symbols in P and create a WorkProduct record associated with DepNode::CodegenUnit(P); the hash is the set of symbols in P.

The next time we compile, if the DepNode::CodegenUnit(P) is judged to be clean (which means none of the things we read to generate the partition were found to be dirty), it will be loaded into previous work products. We will then regenerate the set of symbols in the partition P and hash them (note that new symbols may be added – for example, new monomorphizations – even if nothing in P changed!). We will compare that hash against the previous hash. If it matches up, we can reuse the object file.

Fields§

§cgu_name: String§saved_files: UnordMap<String, String>

Saved files associated with this CGU. In each key/value pair, the value is the path to the saved file and the key is some identifier for the type of file being saved.

By convention, file extensions are currently used as identifiers, i.e. the key “o” maps to the object file’s path, and “dwo” to the dwarf object file’s path.

Trait Implementations§

source§

impl Clone for WorkProduct

source§

fn clone(&self) -> WorkProduct

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for WorkProduct

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<__D: Decoder> Decodable<__D> for WorkProduct

source§

fn decode(__decoder: &mut __D) -> Self

source§

impl<__E: Encoder> Encodable<__E> for WorkProduct

source§

fn encode(&self, __encoder: &mut __E)

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<Tcx, T> Value<Tcx> for Twhere Tcx: DepContext,

source§

default fn from_cycle_error( tcx: Tcx, cycle: &[QueryInfo], _guar: ErrorGuaranteed ) -> T

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 56 bytes