Struct rustc_build_sysroot::SysrootBuilder
source · pub struct SysrootBuilder<'a> { /* private fields */ }Expand description
Information about a to-be-created sysroot.
Implementations§
source§impl<'a> SysrootBuilder<'a>
impl<'a> SysrootBuilder<'a>
sourcepub fn new(sysroot_dir: &Path, target: impl Into<OsString>) -> Self
pub fn new(sysroot_dir: &Path, target: impl Into<OsString>) -> Self
Prepare to create a new sysroot in the given folder (that folder should later be passed to
rustc via --sysroot), for the given target.
sourcepub fn build_mode(self, build_mode: BuildMode) -> Self
pub fn build_mode(self, build_mode: BuildMode) -> Self
Sets the build mode (regular build vs check-only build).
sourcepub fn sysroot_config(self, sysroot_config: SysrootConfig) -> Self
pub fn sysroot_config(self, sysroot_config: SysrootConfig) -> Self
Sets the sysroot configuration (which parts of the sysroot to build and with which features).
sourcepub fn rustflag(self, rustflag: impl Into<OsString>) -> Self
pub fn rustflag(self, rustflag: impl Into<OsString>) -> Self
Appends the given flag.
If no --cap-lints argument is configured, we will add --cap-lints=warn.
This emulates the usual behavior of Cargo: Lints are normally capped when building
dependencies, except that they are not capped when building path dependencies, except that
path dependencies are still capped if they are part of -Zbuild-std.
sourcepub fn rustflags(
self,
rustflags: impl IntoIterator<Item = impl Into<OsString>>
) -> Self
pub fn rustflags( self, rustflags: impl IntoIterator<Item = impl Into<OsString>> ) -> Self
Appends the given flags.
If no --cap-lints argument is configured, we will add --cap-lints=warn. See
SysrootBuilder::rustflag for more explanation.
sourcepub fn rustc_version(self, rustc_version: VersionMeta) -> Self
pub fn rustc_version(self, rustc_version: VersionMeta) -> Self
Sets the rustc version information (in case the user has that available).
sourcepub fn when_build_required(
self,
when_build_required: impl FnOnce() + 'a
) -> Self
pub fn when_build_required( self, when_build_required: impl FnOnce() + 'a ) -> Self
Sets the hook that will be called if we don’t have a cached sysroot available and a new one will be compiled.
sourcepub fn build_from_source(self, src_dir: &Path) -> Result<SysrootStatus>
pub fn build_from_source(self, src_dir: &Path) -> Result<SysrootStatus>
Build the self sysroot from the given sources.
src_dir must be the library source folder, i.e., the one that contains std/Cargo.toml.