Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

target-lexicon OS sometimes doesn't match rustc target jsons

Open
#78 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
compilers

Research direction

Start by comparing target-lexicon's parsed OS values with rustc target-spec JSON for i686-linux-android and aarch64-apple-darwin, using the rustc command shown in the issue. Read the target parsing and OS-mapping code, then check existing tests for these triples. Done means the intended naming behavior is agreed and the discrepancies are covered by passing regression tests.

Written by the indexing model from the issue text.

Description

I've been playing around with target-lexicon a bit and it seems like while most of the time it is pretty faithful to the rustc target json, some of the time the result diverges.

For example, i686-linux-android has this rustc target JSON:

$ RUSTC_BOOTSTRAP=1 rustc -Z unstable-options --target=i686-linux-android --print target-spec-json
{
  "arch": "x86",
  "cpu": "pentiumpro",
  "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128",
  "default-uwtable": true,
  "dwarf-version": 2,
  "dynamic-linking": true,
  "env": "gnu",
  "executables": true,
  "features": "+mmx,+sse,+sse2,+sse3,+ssse3",
  "has-rpath": true,
  "is-builtin": true,
  "llvm-target": "i686-linux-android",
  "max-atomic-width": 64,
  "os": "android",
  "position-independent-executables": true,
  "pre-link-args": {
    "gcc": [
      "-Wl,--allow-multiple-definition"
    ]
  },
  "relro-level": "full",
  "stack-probes": {
    "kind": "call"
  },
  "target-family": [
    "unix"
  ],
  "target-pointer-width": "32"
}

However, target-lexicon parses the same triple as having the OS Linux rather than Android.

Somewhat related, for "aarch64-apple-darwin":

  • rustc has "os": "macos"
  • target-lexicon parses this as Darwin

I'm not sure exactly what behavior is desired here but I thought it might be useful to flag this. Thanks!

Dominant language
Rust
Stars
60
Forks
71
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bytecodealliance/target-lexicon

All issues in bytecodealliance/target-lexicon

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.