Struct rustc_target::spec::Target
source · pub struct Target {
pub llvm_target: Cow<'static, str>,
pub pointer_width: u32,
pub arch: Cow<'static, str>,
pub data_layout: Cow<'static, str>,
pub options: TargetOptions,
}
Expand description
Everything rustc
knows about how to compile for a specific target.
Every field here must be specified, and has no default value.
Fields§
§llvm_target: Cow<'static, str>
Target triple to pass to LLVM.
pointer_width: u32
Number of bits in a pointer. Influences the target_pointer_width
cfg
variable.
arch: Cow<'static, str>
Architecture to use for ABI considerations. Valid options include: “x86”, “x86_64”, “arm”, “aarch64”, “mips”, “powerpc”, “powerpc64”, and others.
data_layout: Cow<'static, str>
Data layout to pass to LLVM.
options: TargetOptions
Optional settings with defaults.
Implementations§
source§impl Target
impl Target
pub fn parse_data_layout<'a>(
&'a self
) -> Result<TargetDataLayout, TargetDataLayoutErrors<'a>>
source§impl Target
impl Target
sourcepub fn adjust_abi(&self, abi: Abi) -> Abi
pub fn adjust_abi(&self, abi: Abi) -> Abi
Given a function ABI, turn it into the correct ABI for this target.
sourcepub fn is_abi_supported(&self, abi: Abi) -> Option<bool>
pub fn is_abi_supported(&self, abi: Abi) -> Option<bool>
Returns a None if the UNSUPPORTED_CALLING_CONVENTIONS lint should be emitted
sourcepub fn min_atomic_width(&self) -> u64
pub fn min_atomic_width(&self) -> u64
Minimum integer size in bits that this target can perform atomic operations on.
sourcepub fn max_atomic_width(&self) -> u64
pub fn max_atomic_width(&self) -> u64
Maximum integer size in bits that this target can perform atomic operations on.
sourcepub fn from_json(obj: Json) -> Result<(Target, TargetWarnings), String>
pub fn from_json(obj: Json) -> Result<(Target, TargetWarnings), String>
Loads a target descriptor from a JSON object.
sourcepub fn expect_builtin(target_triple: &TargetTriple) -> Target
pub fn expect_builtin(target_triple: &TargetTriple) -> Target
Load a built-in target
sourcepub fn search(
target_triple: &TargetTriple,
sysroot: &Path
) -> Result<(Target, TargetWarnings), String>
pub fn search(
target_triple: &TargetTriple,
sysroot: &Path
) -> Result<(Target, TargetWarnings), String>
Search for a JSON file specifying the given target triple.
If none is found in $RUST_TARGET_PATH
, look for a file called target.json
inside the
sysroot under the target-triple’s rustlib
directory. Note that it could also just be a
bare filename already, so also check for that. If one of the hardcoded targets we know
about, just return it directly.
The error string could come from any of the APIs called, including filesystem access and JSON decoding.
Methods from Deref<Target = TargetOptions>§
fn add_pre_link_args(&mut self, flavor: LinkerFlavor, args: &[&'static str])
fn add_post_link_args(&mut self, flavor: LinkerFlavor, args: &[&'static str])
fn update_from_cli(&mut self)
fn update_to_cli(&mut self)
Trait Implementations§
source§impl Deref for Target
impl Deref for Target
TargetOptions
being a separate type is basically an implementation detail of Target
that is
used for providing defaults. Perhaps there’s a way to merge TargetOptions
into Target
so
this Deref
implementation is no longer necessary.
source§impl HasTargetSpec for Target
impl HasTargetSpec for Target
fn target_spec(&self) -> &Target
impl StructuralPartialEq for Target
Auto Trait Implementations§
impl RefUnwindSafe for Target
impl Send for Target
impl Sync for Target
impl Unpin for Target
impl UnwindSafe for Target
Blanket Implementations§
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: 1432 bytes