pub struct Compilation<'gctx> {Show 18 fields
pub tests: Vec<UnitOutput>,
pub binaries: Vec<UnitOutput>,
pub cdylibs: Vec<UnitOutput>,
pub root_crate_names: Vec<String>,
pub native_dirs: BTreeSet<PathBuf>,
pub root_output: HashMap<CompileKind, PathBuf>,
pub deps_output: HashMap<CompileKind, PathBuf>,
sysroot_target_libdir: HashMap<CompileKind, PathBuf>,
pub extra_env: HashMap<Metadata, Vec<(String, String)>>,
pub to_doc_test: Vec<Doctest>,
pub host: String,
gctx: &'gctx GlobalContext,
rustc_process: ProcessBuilder,
rustc_workspace_wrapper_process: ProcessBuilder,
primary_rustc_process: Option<ProcessBuilder>,
target_runners: HashMap<CompileKind, Option<(PathBuf, Vec<String>)>>,
target_linkers: HashMap<CompileKind, Option<PathBuf>>,
pub warning_count: usize,
}
Expand description
A structure returning the result of a compilation.
Fields§
§tests: Vec<UnitOutput>
An array of all tests created during this compilation.
binaries: Vec<UnitOutput>
An array of all binaries created.
cdylibs: Vec<UnitOutput>
An array of all cdylibs created.
root_crate_names: Vec<String>
The crate names of the root units specified on the command-line.
native_dirs: BTreeSet<PathBuf>
All directories for the output of native build commands.
This is currently used to drive some entries which are added to the LD_LIBRARY_PATH as appropriate.
The order should be deterministic.
root_output: HashMap<CompileKind, PathBuf>
Root output directory (for the local package’s artifacts)
deps_output: HashMap<CompileKind, PathBuf>
Output directory for rust dependencies. May be for the host or for a specific target.
sysroot_target_libdir: HashMap<CompileKind, PathBuf>
The path to libstd for each target
extra_env: HashMap<Metadata, Vec<(String, String)>>
Extra environment variables that were passed to compilations and should be passed to future invocations of programs.
The key is the build script metadata for uniquely identifying the
RunCustomBuild
unit that generated these env vars.
to_doc_test: Vec<Doctest>
Libraries to test with rustdoc.
host: String
The target host triple.
gctx: &'gctx GlobalContext
§rustc_process: ProcessBuilder
Rustc process to be used by default
rustc_workspace_wrapper_process: ProcessBuilder
Rustc process to be used for workspace crates instead of rustc_process
primary_rustc_process: Option<ProcessBuilder>
Optional rustc process to be used for primary crates instead of either rustc_process or rustc_workspace_wrapper_process
target_runners: HashMap<CompileKind, Option<(PathBuf, Vec<String>)>>
§target_linkers: HashMap<CompileKind, Option<PathBuf>>
The linker to use for each host or target.
warning_count: usize
The total number of warnings emitted by the compilation.
Implementations§
Source§impl<'gctx> Compilation<'gctx>
impl<'gctx> Compilation<'gctx>
pub fn new<'a>(bcx: &BuildContext<'a, 'gctx>) -> CargoResult<Compilation<'gctx>>
Sourcepub fn rustc_process(
&self,
unit: &Unit,
is_primary: bool,
is_workspace: bool,
) -> CargoResult<ProcessBuilder>
pub fn rustc_process( &self, unit: &Unit, is_primary: bool, is_workspace: bool, ) -> CargoResult<ProcessBuilder>
Returns a ProcessBuilder
for running rustc
.
is_primary
is true if this is a “primary package”, which means it
was selected by the user on the command-line (such as with a -p
flag), see crate::core::compiler::BuildRunner::primary_packages
.
is_workspace
is true if this is a workspace member.
Sourcepub fn rustdoc_process(
&self,
unit: &Unit,
script_meta: Option<Metadata>,
) -> CargoResult<ProcessBuilder>
pub fn rustdoc_process( &self, unit: &Unit, script_meta: Option<Metadata>, ) -> CargoResult<ProcessBuilder>
Returns a ProcessBuilder
for running rustdoc
.
Sourcepub fn host_process<T: AsRef<OsStr>>(
&self,
cmd: T,
pkg: &Package,
) -> CargoResult<ProcessBuilder>
pub fn host_process<T: AsRef<OsStr>>( &self, cmd: T, pkg: &Package, ) -> CargoResult<ProcessBuilder>
Returns a ProcessBuilder
appropriate for running a process for the
host platform.
This is currently only used for running build scripts. If you use this for anything else, please be extra careful on how environment variables are set!
pub fn target_runner( &self, kind: CompileKind, ) -> Option<&(PathBuf, Vec<String>)>
Sourcepub fn target_linker(&self, kind: CompileKind) -> Option<PathBuf>
pub fn target_linker(&self, kind: CompileKind) -> Option<PathBuf>
Gets the user-specified linker for a particular host or target.
Sourcepub fn target_process<T: AsRef<OsStr>>(
&self,
cmd: T,
kind: CompileKind,
pkg: &Package,
script_meta: Option<Metadata>,
) -> CargoResult<ProcessBuilder>
pub fn target_process<T: AsRef<OsStr>>( &self, cmd: T, kind: CompileKind, pkg: &Package, script_meta: Option<Metadata>, ) -> CargoResult<ProcessBuilder>
Returns a ProcessBuilder
appropriate for running a process for the
target platform. This is typically used for cargo run
and cargo test
.
script_meta
is the metadata for the RunCustomBuild
unit that this
unit used for its build script. Use None
if the package did not have
a build script.
Sourcefn fill_env(
&self,
cmd: ProcessBuilder,
pkg: &Package,
script_meta: Option<Metadata>,
kind: CompileKind,
tool_kind: ToolKind,
) -> CargoResult<ProcessBuilder>
fn fill_env( &self, cmd: ProcessBuilder, pkg: &Package, script_meta: Option<Metadata>, kind: CompileKind, tool_kind: ToolKind, ) -> CargoResult<ProcessBuilder>
Prepares a new process with an appropriate environment to run against the artifacts produced by the build process.
The package argument is also used to configure environment variables as well as the working directory of the child process.
Auto Trait Implementations§
impl<'gctx> Freeze for Compilation<'gctx>
impl<'gctx> !RefUnwindSafe for Compilation<'gctx>
impl<'gctx> !Send for Compilation<'gctx>
impl<'gctx> !Sync for Compilation<'gctx>
impl<'gctx> Unpin for Compilation<'gctx>
impl<'gctx> !UnwindSafe for Compilation<'gctx>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
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: 952 bytes