Skip to content

Commit 2b95ffe

Browse files
authored
Make it clear in docs that we parse LLVM triples (#114)
1 parent 61922cd commit 2b95ffe

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "target-lexicon"
33
version = "0.12.16"
44
authors = ["Dan Gohman <[email protected]>"]
5-
description = "Targeting utilities for compilers and related tools"
5+
description = "LLVM target triple types"
66
documentation = "https://docs.rs/target-lexicon/"
77
readme = "README.md"
88
keywords = ["target", "host", "triple", "compiler", "jit"]

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
This is a library for managing targets for compilers and related tools.
22

3-
Currently, the main feature is support for decoding "triples", which
3+
Currently, the main feature is support for decoding [LLVM "triples"], which
44
are strings that identify a particular target configuration. They're named
55
"triples" because historically they contained three fields, though over time
66
they've added additional fields. This library provides a `Triple` struct
@@ -14,7 +14,11 @@ pointer bit width, and binary format.
1414
And, `Triple` and the enum types have `host()` constructors, for targeting
1515
the host.
1616

17-
It supports all triples currently used by rustc and rustup.
17+
It somewhat supports reading triples currently used by `rustc` and rustup,
18+
though beware that the mapping between `rustc` and LLVM triples is not
19+
one-to-one.
1820

1921
It does not support reading JSON target files itself. To use it with a JSON
2022
target file, construct a `Triple` using the value of the "llvm-target" field.
23+
24+
[LLVM "triples"]: https://clang.llvm.org/docs/CrossCompilation.html#target-triple

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Target triple support.
1+
//! LLVM target triple types.
22
33
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
44
#![warn(unused_import_braces)]

src/triple.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ pub enum CallingConvention {
7878
AppleAarch64,
7979
}
8080

81-
/// A target "triple". Historically such things had three fields, though they've
82-
/// added additional fields over time.
81+
/// An LLVM target "triple". Historically such things had three fields, though
82+
/// they've added additional fields over time.
8383
///
8484
/// Note that `Triple` doesn't implement `Default` itself. If you want a type
8585
/// which defaults to the host triple, or defaults to unknown-unknown-unknown,
@@ -291,6 +291,10 @@ fn show_binary_format_with_no_os(triple: &Triple) -> bool {
291291
impl FromStr for Triple {
292292
type Err = ParseError;
293293

294+
/// Parse a triple from an LLVM target triple.
295+
///
296+
/// This may also be able to parse `rustc` target triples, though support
297+
/// for that is secondary.
294298
fn from_str(s: &str) -> Result<Self, Self::Err> {
295299
if let Some(triple) = Triple::special_case_from_str(s) {
296300
return Ok(triple);

0 commit comments

Comments
 (0)