cfg-expr-0.15.8/.cargo/config.toml000064400000000000000000000053561046102023000147560ustar 00000000000000[target.'cfg(all())'] rustflags = [ # BEGIN - Embark standard lints v6 for Rust 1.55+ # do not change or add/remove here, but one can add exceptions after this section # for more info see: "-Dunsafe_code", "-Wclippy::all", "-Wclippy::await_holding_lock", "-Wclippy::char_lit_as_u8", "-Wclippy::checked_conversions", "-Wclippy::dbg_macro", "-Wclippy::debug_assert_with_mut_call", "-Wclippy::doc_markdown", "-Wclippy::empty_enum", "-Wclippy::enum_glob_use", "-Wclippy::exit", "-Wclippy::expl_impl_clone_on_copy", "-Wclippy::explicit_deref_methods", "-Wclippy::explicit_into_iter_loop", "-Wclippy::fallible_impl_from", "-Wclippy::filter_map_next", "-Wclippy::flat_map_option", "-Wclippy::float_cmp_const", "-Wclippy::fn_params_excessive_bools", "-Wclippy::from_iter_instead_of_collect", "-Wclippy::if_let_mutex", "-Wclippy::implicit_clone", "-Wclippy::imprecise_flops", "-Wclippy::inefficient_to_string", "-Wclippy::invalid_upcast_comparisons", "-Wclippy::large_digit_groups", "-Wclippy::large_stack_arrays", "-Wclippy::large_types_passed_by_value", "-Wclippy::let_unit_value", "-Wclippy::linkedlist", "-Wclippy::lossy_float_literal", "-Wclippy::macro_use_imports", "-Wclippy::manual_ok_or", "-Wclippy::map_err_ignore", "-Wclippy::map_flatten", "-Wclippy::map_unwrap_or", "-Wclippy::match_on_vec_items", "-Wclippy::match_same_arms", "-Wclippy::match_wild_err_arm", "-Wclippy::match_wildcard_for_single_variants", "-Wclippy::mem_forget", "-Wclippy::mismatched_target_os", "-Wclippy::missing_enforced_import_renames", "-Wclippy::mut_mut", "-Wclippy::mutex_integer", "-Wclippy::needless_borrow", "-Wclippy::needless_continue", "-Wclippy::needless_for_each", "-Wclippy::option_option", "-Wclippy::path_buf_push_overwrite", "-Wclippy::ptr_as_ptr", "-Wclippy::rc_mutex", "-Wclippy::ref_option_ref", "-Wclippy::rest_pat_in_fully_bound_structs", "-Wclippy::same_functions_in_if_condition", "-Wclippy::semicolon_if_nothing_returned", "-Wclippy::single_match_else", "-Wclippy::string_add_assign", "-Wclippy::string_add", "-Wclippy::string_lit_as_bytes", "-Wclippy::string_to_string", "-Wclippy::todo", "-Wclippy::trait_duplication_in_bounds", "-Wclippy::unimplemented", "-Wclippy::unnested_or_patterns", "-Wclippy::unused_self", "-Wclippy::useless_transmute", "-Wclippy::verbose_file_reads", "-Wclippy::zero_sized_map_values", "-Wfuture_incompatible", "-Wnonstandard_style", "-Wrust_2018_idioms", # END - Embark standard lints v6 for Rust 1.55+ ] cfg-expr-0.15.8/.cargo_vcs_info.json0000644000000001360000000000100126420ustar { "git": { "sha1": "336ded00991abfdf5884da6e0488bcd542a9a695" }, "path_in_vcs": "" }cfg-expr-0.15.8/.github/CODEOWNERS000064400000000000000000000000171046102023000143630ustar 00000000000000* @Jake-Shadle cfg-expr-0.15.8/.github/ISSUE_TEMPLATE/bug_report.md000064400000000000000000000011551046102023000176510ustar 00000000000000--- name: Bug report about: Create a report to help us improve title: '' labels: bug assignees: '' --- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Device:** - OS: [e.g. iOS] - Browser [e.g. chrome, safari] - Version [e.g. 22] **Additional context** Add any other context about the problem here. cfg-expr-0.15.8/.github/ISSUE_TEMPLATE/feature_request.md000064400000000000000000000011341046102023000207010ustar 00000000000000--- name: Feature request about: Suggest an idea for this project title: '' labels: enhancement assignees: '' --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. cfg-expr-0.15.8/.github/pull_request_template.md000064400000000000000000000005501046102023000177330ustar 00000000000000### Checklist * [ ] I have read the [Contributor Guide](../../CONTRIBUTING.md) * [ ] I have read and agree to the [Code of Conduct](../../CODE_OF_CONDUCT.md) * [ ] I have added a description of my changes and why I'd like them included in the section below ### Description of Changes Describe your changes here ### Related Issues List related issues here cfg-expr-0.15.8/.github/workflows/ci.yml000064400000000000000000000032471046102023000161530ustar 00000000000000on: push: branches: - main pull_request: concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true name: CI jobs: lint: name: Lint runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@stable with: components: "clippy, rustfmt" # make sure all code has been formatted with rustfmt - name: check rustfmt run: cargo fmt -- --check --color always # run clippy to verify we have no warnings - run: cargo fetch - name: cargo clippy run: cargo clippy --all-targets --all-features -- -D warnings test: name: Test strategy: matrix: toolchain: [1.70.0, stable] runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.toolchain }} - run: cargo fetch - name: cargo test build run: cargo build --tests --release - name: cargo test run: cargo test --release - name: cargo test build all-features run: cargo build --tests --release --all-features - name: cargo test all-features run: cargo test --release --all-features deny-check: name: cargo-deny runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - uses: EmbarkStudios/cargo-deny-action@v1 publish-check: name: Publish Check runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@stable - run: cargo fetch - name: cargo publish check run: cargo publish --dry-run cfg-expr-0.15.8/.gitignore000064400000000000000000000001661046102023000134250ustar 00000000000000**/target **/*.rs.bk Cargo.lock #Added by cargo # #already existing elements are commented out #/target #**/*.rs.bk cfg-expr-0.15.8/.mergify.yml000064400000000000000000000006621046102023000137010ustar 00000000000000pull_request_rules: - name: automatic merge when CI passes and 1 reviews conditions: - "#approved-reviews-by>=1" - "#review-requested=0" - "#changes-requested-reviews-by=0" - "#commented-reviews-by=0" - base=master - label!=work-in-progress actions: merge: method: squash - name: delete head branch after merge conditions: [] actions: delete_head_branch: {} cfg-expr-0.15.8/CHANGELOG.md000064400000000000000000000255421046102023000132530ustar 00000000000000 # Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] - ReleaseDate ## [0.15.8] - 2024-04-10 ### Changed - [PR#69](https://github.com/EmbarkStudios/cfg-expr/pull/67) updated the builtin target list to 1.77.2. ## [0.15.7] - 2024-02-09 ### Changed - [PR#67](https://github.com/EmbarkStudios/cfg-expr/pull/67) updated the builtin target list to 1.76.0. ## [0.15.6] - 2024-01-02 ### Changed - [PR#66](https://github.com/EmbarkStudios/cfg-expr/pull/66) updated the builtin target list to 1.75.0. ## [0.15.5] - 2023-09-08 ### Changed - [PR#64](https://github.com/EmbarkStudios/cfg-expr/pull/64) updated the builtin target list to 1.72.0. It also changed the MSRV to 1.70.0. ## [0.15.4] - 2023-07-28 ### Changed - [PR#62](https://github.com/EmbarkStudios/cfg-expr/pull/62) updated the builtin target list to 1.71.0. ## [0.15.3] - 2023-06-19 ### Fixed - [PR#61](https://github.com/EmbarkStudios/cfg-expr/pull/61) fixed an issue where `target_os = "none"` was not matching target triplets where `os = None`. Thanks [@sunshowers](https://github.com/sunshowers)! ## [0.15.2] - 2023-06-02 ### Changed - [PR#59](https://github.com/EmbarkStudios/cfg-expr/pull/60) updated the builtin target list to 1.70.0. ## [0.15.1] - 2023-04-20 ### Changed - [PR#59](https://github.com/EmbarkStudios/cfg-expr/pull/59) updated the builtin target list to 1.69.0. ## [0.15.0] - 2023-04-04 ### Changed - [PR#58](https://github.com/EmbarkStudios/cfg-expr/pull/58) updated the builtin target list to 1.68.2. ## [0.14.0] - 2023-01-27 ### Changed - [PR#57](https://github.com/EmbarkStudios/cfg-expr/pull/57) updated the builtin target list to 1.67.0. ## [0.13.0] - 2022-12-19 ### Changed - [PR#56](https://github.com/EmbarkStudios/cfg-expr/pull/56) updated the builtin target list to 1.66.0. Thanks [@sunshowers](https://github.com/sunshowers)! ## [0.12.0] - 2022-11-07 ### Changed - [PR#53](https://github.com/EmbarkStudios/cfg-expr/pull/53) updated the builtin target list to 1.65.0. Thanks [@sunshowers](https://github.com/sunshowers)! ### Added - [PR#54](https://github.com/EmbarkStudios/cfg-expr/pull/54) added support for `abi`, which is currently nightly only, but should have no affect on stable. Thanks [@carols10cents](https://github.com/carols10cents)! ## [0.11.0] - 2022-09-27 ### Changed - [PR#51](https://github.com/EmbarkStudios/cfg-expr/pull/51) updated the builtin target list to 1.64.0. Thanks [@sunshowers](https://github.com/sunshowers)! - [PR#51](https://github.com/EmbarkStudios/cfg-expr/pull/51) bumped the MSRV to 1.58.0. ## [0.10.3] - 2022-05-19 ### Added - [PR#49](https://github.com/EmbarkStudios/cfg-expr/pull/49) added support for the `has_target_atomic = ""` and `panic = ""` predicates. Thanks [@sunshowers](https://github.com/sunshowers)! ## [0.10.2] - 2022-02-25 ### Changed - [PR#48](https://github.com/EmbarkStudios/cfg-expr/pull/48) updated the builtin target list to 1.59.0. ## [0.10.1] - 2022-02-07 ### Fixed - [PR#46](https://github.com/EmbarkStudios/cfg-expr/pull/46) fixed comparison of dynamic target families. ## [0.10.0] - 2022-02-04 ### Changed - [PR#44](https://github.com/EmbarkStudios/cfg-expr/pull/44) added support for multiple target families that are available from Rust 1.58.0+. Thanks [@sunshowers](https://github.com/sunshowers)! ## [0.9.1] - 2022-02-01 ### Changed - [PR#42](https://github.com/EmbarkStudios/cfg-expr/pull/42) updated the builtin target list to 1.58.0. Thanks [@sunshowers](https://github.com/sunshowers)! ## [0.9.0] - 2021-08-31 ### Changed - [PR#35](https://github.com/EmbarkStudios/cfg-expr/pull/35) changed `TargetInfo`, `Os`, `Arch`, `Env`, and `Vendor` to use a `Cow<'static, str>` to avoid the need for lifetime parameters for the common case of statically known target information, but still support arbitrary/future variants. Thanks [@sunshowers](https://github.com/sunshowers)! - [PR#38](https://github.com/EmbarkStudios/cfg-expr/pull/38) updated the built-in target list to `1.54.0`, which notably includes the addition of the new `wasm` variant to `target_family`. Thanks [@sunshowers](https://github.com/sunshowers)! ### Fixed - [PR#33](https://github.com/EmbarkStudios/cfg-expr/pull/33) added clippy.toml with an `msrv` so clippy lints are consistent across environments. Thanks [@remilauzier](https://github.com/remilauzier)! ## [0.8.1] - 2021-08-05 ### Changed - [PR#31](https://github.com/EmbarkStudios/cfg-expr/pull/31) reverted the usage of "or patterns" that were only added in 1.53.0. We now state the MSRV as 1.52.0. Thanks [@cgwalters](https://github.com/cgwalters)! ## [0.8.0] - 2021-07-16 ### Changed - [PR#28](https://github.com/EmbarkStudios/cfg-expr/pull/28) updated target-lexicon to 0.12. Thanks [@remilauzier](https://github.com/remilauzier)! - [PR#29](https://github.com/EmbarkStudios/cfg-expr/pull/29) updated the built-in target list to 1.53.0. ## [0.7.4] - 2021-03-16 ### Added - [PR#26](https://github.com/EmbarkStudios/cfg-expr/pull/26) added `Expression::original` to get the original string the expression was parsed from. Thanks [@gdesmott](https://github.com/gdesmott)! ## [0.7.3] - 2021-03-16 ### Added - [PR#25](https://github.com/EmbarkStudios/cfg-expr/pull/25) added `Clone` for `Expression`. Thanks [@gdesmott](https://github.com/gdesmott)! ## [0.7.2] - 2021-03-16 ### Added - [PR#23](https://github.com/EmbarkStudios/cfg-expr/pull/23) added a `PartialEq` implementation for `Expression`, primarily for cases where an `Expression` is stored in a type that itself requires `PartialEq`. This is only a simple syntactical equality check. Thanks [@gdesmott](https://github.com/gdesmott)! ## [0.7.1] - 2021-02-17 ### Fixed - Fixed support for the `uclibceabi` environment added for one target in rust 1.50.0. ## [0.7.0] - 2021-02-12 ### Changed - Updated the builtin target list to Rust 1.50.0. Again, somewhat of a breaking change as many targets were removed or changed. ### Fixed - Update smallvec to fix an [advisory](https://rustsec.org/advisories/RUSTSEC-2021-0003) ## [0.6.0] - 2021-01-04 ### Changed - Updated the builtin target list to Rust 1.49.0, this is somewhat of a breaking change, as rustc now considers all `android` targets to have the `gnu` environment, where previously, it was unspecified. ## [0.5.1] - 2020-12-15 ### Changed - Updated the builtin target list to Rust 1.48.0 ## [0.5.0] - 2020-10-20 ### Changed - Updated the builtin target list to Rust 1.47.0 ## [0.4.1] - 2020-06-04 ### Fixed - Removed `dbg!` prints accidentally left in. ## [0.4.0] - 2020-06-04 ### Added - [PR#9](https://github.com/EmbarkStudios/cfg-expr/pull/9) added the optional `targets` feature, which allows matching the various `target_` predicates against a [`target_lexicon::Triple`](https://docs.rs/target-lexicon/0.11.0/target_lexicon/struct.Triple.html). ### Changed - [PR#9](https://github.com/EmbarkStudios/cfg-expr/pull/9) changed the `Arch`, `Vendor`, `Os`, and `Env` types to not be longer enums, and are instead thin wrappers around strings. This allows for custom targets where one or more components of the target triple are not built-in to rustc. Resolved [#8](https://github.com/EmbarkStudios/cfg-expr/issues/8). - Changed `ParseError` to remove the lifetime and just keep an owned string of the expression that failed to parse. - Updated the list of built-in rustc targets to 1.43.1. ## [0.3.0] - 2020-04-05 ### Changed - [PR#7](https://github.com/EmbarkStudios/cfg-expr/pull/7) changed `Expression::eval` to take a `Logic` trait, to enable evaluation of 'unknown' predicates. Thanks [@sunshowers](https://github.com/sunshowers)! ## [0.2.1] - 2020-03-30 ### Fixed - [PR#6](https://github.com/EmbarkStudios/cfg-expr/pull/6) fixed nested predicate evaluation. Thanks [@sunshowers](https://github.com/sunshowers)! ## [0.2.0] - 2020-02-05 ### Added - Added `targets::rustc_version` which can be used to retrieve the version string of the rustc used to generate the list of targets. ### Changed - `targets::ALL` now uses the built-in targets for rustc 1.41.0 ## [0.1.0] - 2020-01-09 ### Added - Initial add of all the things [Unreleased]: https://github.com/EmbarkStudios/cfg-expr/compare/0.15.8...HEAD [0.15.8]: https://github.com/EmbarkStudios/cfg-expr/compare/0.15.7...0.15.8 [0.15.7]: https://github.com/EmbarkStudios/cfg-expr/compare/0.15.6...0.15.7 [0.15.6]: https://github.com/EmbarkStudios/cfg-expr/compare/0.15.5...0.15.6 [0.15.5]: https://github.com/EmbarkStudios/cfg-expr/compare/0.15.4...0.15.5 [0.15.4]: https://github.com/EmbarkStudios/cfg-expr/compare/0.15.3...0.15.4 [0.15.3]: https://github.com/EmbarkStudios/cfg-expr/compare/0.15.2...0.15.3 [0.15.2]: https://github.com/EmbarkStudios/cfg-expr/compare/0.15.1...0.15.2 [0.15.1]: https://github.com/EmbarkStudios/cfg-expr/compare/0.15.0...0.15.1 [0.15.0]: https://github.com/EmbarkStudios/cfg-expr/compare/0.14.0...0.15.0 [0.14.0]: https://github.com/EmbarkStudios/cfg-expr/compare/0.13.0...0.14.0 [0.13.0]: https://github.com/EmbarkStudios/cfg-expr/compare/0.12.0...0.13.0 [0.12.0]: https://github.com/EmbarkStudios/cfg-expr/compare/0.11.0...0.12.0 [0.11.0]: https://github.com/EmbarkStudios/cfg-expr/compare/0.10.3...0.11.0 [0.10.3]: https://github.com/EmbarkStudios/cfg-expr/compare/0.10.2...0.10.3 [0.10.2]: https://github.com/EmbarkStudios/cfg-expr/compare/0.10.1...0.10.2 [0.10.1]: https://github.com/EmbarkStudios/cfg-expr/compare/0.10.0...0.10.1 [0.10.0]: https://github.com/EmbarkStudios/cfg-expr/compare/0.9.1...0.10.0 [0.9.1]: https://github.com/EmbarkStudios/cfg-expr/compare/0.9.0...0.9.1 [0.9.0]: https://github.com/EmbarkStudios/cfg-expr/compare/0.8.1...0.9.0 [0.8.1]: https://github.com/EmbarkStudios/cfg-expr/compare/0.8.0...0.8.1 [0.8.0]: https://github.com/EmbarkStudios/cfg-expr/compare/0.7.4...0.8.0 [0.7.4]: https://github.com/EmbarkStudios/cfg-expr/compare/0.7.3...0.7.4 [0.7.3]: https://github.com/EmbarkStudios/cfg-expr/compare/0.7.2...0.7.3 [0.7.2]: https://github.com/EmbarkStudios/cfg-expr/compare/0.7.1...0.7.2 [0.7.1]: https://github.com/EmbarkStudios/cfg-expr/compare/0.7.0...0.7.1 [0.7.0]: https://github.com/EmbarkStudios/cfg-expr/compare/0.6.0...0.7.0 [0.6.0]: https://github.com/EmbarkStudios/cfg-expr/compare/0.5.1...0.6.0 [0.5.1]: https://github.com/EmbarkStudios/cfg-expr/compare/0.5.0...0.5.1 [0.5.0]: https://github.com/EmbarkStudios/cfg-expr/compare/0.4.1...0.5.0 [0.4.1]: https://github.com/EmbarkStudios/cfg-expr/compare/0.4.0...0.4.1 [0.4.0]: https://github.com/EmbarkStudios/cfg-expr/compare/0.3.0...0.4.0 [0.3.0]: https://github.com/EmbarkStudios/cfg-expr/compare/0.2.1...0.3.0 [0.2.1]: https://github.com/EmbarkStudios/cfg-expr/compare/0.2.0...0.2.1 [0.2.0]: https://github.com/EmbarkStudios/cfg-expr/compare/0.1.0...0.2.0 [0.1.0]: https://github.com/EmbarkStudios/cfg-expr/releases/tag/0.1.0 cfg-expr-0.15.8/CODE_OF_CONDUCT.md000064400000000000000000000125531046102023000142370ustar 00000000000000# Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at opensource@embark-studios.com. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0]. Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations]. [homepage]: https://www.contributor-covenant.org [v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html [Mozilla CoC]: https://github.com/mozilla/diversity [FAQ]: https://www.contributor-covenant.org/faq [translations]: https://www.contributor-covenant.org/translations cfg-expr-0.15.8/CONTRIBUTING.md000064400000000000000000000066531046102023000136750ustar 00000000000000# Embark Contributor Guidelines Welcome! This project is created by the team at [Embark Studios](https://embark.games). We're glad you're interested in contributing! We welcome contributions from people of all backgrounds who are interested in making great software with us. At Embark, we aspire to empower everyone to create interactive experiences. To do this, we're exploring and pushing the boundaries of new technologies, and sharing our learnings with the open source community. If you have ideas for collaboration, email us at opensource@embark-studios.com. We're also hiring full-time engineers to work with us in Stockholm! Check out our current job postings [here](https://embark.games/careers). ## Issues ### Feature Requests If you have ideas or how to improve our projects, you can suggest features by opening a GitHub issue. Make sure to include details about the feature or change, and describe any uses cases it would enable. Feature requests will be tagged as `enhancement` and their status will be updated in the comments of the issue. ### Bugs When reporting a bug or unexpected behaviour in a project, make sure your issue describes steps to reproduce the behaviour, including the platform you were using, what steps you took, and any error messages. Reproducible bugs will be tagged as `bug` and their status will be updated in the comments of the issue. ### Wontfix Issues will be closed and tagged as `wontfix` if we decide that we do not wish to implement it, usually due to being misaligned with the project vision or out of scope. We will comment on the issue with more detailed reasoning. ## Contribution Workflow ### Open Issues If you're ready to contribute, start by looking at our open issues tagged as [`help wanted`](../../issues?q=is%3Aopen+is%3Aissue+label%3A"help+wanted") or [`good first issue`](../../issues?q=is%3Aopen+is%3Aissue+label%3A"good+first+issue"). You can comment on the issue to let others know you're interested in working on it or to ask questions. ### Making Changes 1. Fork the repository. 2. Create a new feature branch. 3. Make your changes. Ensure that there are no build errors by running the project with your changes locally. 4. Open a pull request with a name and description of what you did. You can read more about working with pull requests on GitHub [here](https://help.github.com/en/articles/creating-a-pull-request-from-a-fork). 5. A maintainer will review your pull request and may ask you to make changes. ## Code Guidelines ### Rust You can read about our standards and recommendations for working with Rust [here](https://github.com/EmbarkStudios/rust-ecosystem/blob/master/guidelines.md). ### Python We recommend following [PEP8 conventions](https://www.python.org/dev/peps/pep-0008/) when working with Python modules. ### JavaScript We follow the [AirBnB JavaScript style guide](https://github.com/airbnb/javascript). You can find the ESLint configuration in relevant repositories. ## Licensing Unless otherwise specified, all Embark open source projects are licensed under a dual MIT OR Apache-2.0 license, allowing licensees to choose either at their option. You can read more in each project's respective README. ## Code of Conduct Please note that our projects are released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md) to ensure that they are welcoming places for everyone to contribute. By participating in any Embark open source project, you agree to abide by these terms. cfg-expr-0.15.8/Cargo.lock0000644000000113730000000000100106220ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "bstr" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" dependencies = [ "lazy_static", "memchr", "regex-automata", ] [[package]] name = "cfg-expr" version = "0.15.8" dependencies = [ "similar-asserts", "smallvec", "target-lexicon", ] [[package]] name = "console" version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" dependencies = [ "encode_unicode", "lazy_static", "libc", "windows-sys", ] [[package]] name = "encode_unicode" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" [[package]] name = "memchr" version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "regex-automata" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" [[package]] name = "similar" version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32fea41aca09ee824cc9724996433064c89f7777e60762749a4170a14abbfa21" dependencies = [ "bstr", "unicode-segmentation", ] [[package]] name = "similar-asserts" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e041bb827d1bfca18f213411d51b665309f1afb37a04a5d1464530e13779fc0f" dependencies = [ "console", "similar", ] [[package]] name = "smallvec" version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "target-lexicon" version = "0.12.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" [[package]] name = "unicode-segmentation" version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "windows-sys" version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_i686_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_x86_64_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" cfg-expr-0.15.8/Cargo.toml0000644000000023400000000000100106370ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2021" rust-version = "1.70.0" name = "cfg-expr" version = "0.15.8" authors = [ "Embark ", "Jake Shadle ", ] description = "A parser and evaluator for Rust `cfg()` expressions." homepage = "https://github.com/EmbarkStudios/cfg-expr" documentation = "https://docs.rs/cfg-expr" readme = "README.md" keywords = [ "cargo", "rustc", "cfg", ] categories = ["parser-implementations"] license = "MIT OR Apache-2.0" repository = "https://github.com/EmbarkStudios/cfg-expr" [dependencies.smallvec] version = "1.8" [dependencies.target-lexicon] version = "0.12.11" optional = true [dev-dependencies.similar-asserts] version = "1.1" [features] default = [] targets = ["target-lexicon"] cfg-expr-0.15.8/Cargo.toml.orig000064400000000000000000000015171046102023000143250ustar 00000000000000[package] name = "cfg-expr" description = "A parser and evaluator for Rust `cfg()` expressions." repository = "https://github.com/EmbarkStudios/cfg-expr" version = "0.15.8" authors = [ "Embark ", "Jake Shadle ", ] edition = "2021" license = "MIT OR Apache-2.0" readme = "README.md" rust-version = "1.70.0" documentation = "https://docs.rs/cfg-expr" homepage = "https://github.com/EmbarkStudios/cfg-expr" keywords = ["cargo", "rustc", "cfg"] categories = ["parser-implementations"] [features] default = [] # Allows parsing and handling of arbitrary target triples, including ones that # are not builtin to rustc targets = ["target-lexicon"] [dependencies] smallvec = "1.8" target-lexicon = { version = "0.12.11", optional = true } [dev-dependencies] similar-asserts = "1.1" cfg-expr-0.15.8/LICENSE-APACHE000064400000000000000000000251421046102023000133620ustar 00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. cfg-expr-0.15.8/LICENSE-MIT000064400000000000000000000020421046102023000130640ustar 00000000000000Copyright (c) 2019 Embark Studios Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. cfg-expr-0.15.8/README.md000064400000000000000000000103461046102023000127150ustar 00000000000000
# `⚙️ cfg-expr` **A parser and evaluator for Rust `cfg()` expressions. Builtin targets as of [1.77.2] are supported.** [![Build Status](https://github.com/EmbarkStudios/cfg-expr/workflows/CI/badge.svg)](https://github.com/EmbarkStudios/cfg-expr/actions?workflow=CI) [![Crates.io](https://img.shields.io/crates/v/cfg-expr.svg)](https://crates.io/crates/cfg-expr) [![Docs](https://docs.rs/cfg-expr/badge.svg)](https://docs.rs/cfg-expr) [![Minimum Stable Rust Version](https://img.shields.io/badge/Rust%20MSRV-1.70.0-blue?color=fc8d62&logo=rust)](https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html) [![Rust Targets](https://img.shields.io/badge/Rust%20Targets-1.77.2-blue.svg)](https://forge.rust-lang.org/release/platform-support.html) [![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md) [![Embark](https://img.shields.io/badge/embark-open%20source-blueviolet.svg)](https://embark.dev)
## Alternatives - [cargo-platform](https://crates.io/crates/cargo-platform) - [parse_cfg](https://crates.io/crates/parse_cfg) ## Usage `cfg-expr` is a crate that can be used to parse and evaluate Rust `cfg()` expressions, both as declarable in Rust code itself, as well in cargo manifests' `[target.'cfg()'.dependencies]` sections. It contains a list of all builtin targets known to rustc as of [1.77.2] that can be used to determine if a particular cfg expression is satisfiable. ```rust use cfg_expr::{targets::get_builtin_target_by_triple, Expression, Predicate}; let specific = Expression::parse( r#"all( target_os = "windows", target_arch = "x86", windows, target_env = "msvc", target_feature = "fxsr", target_feature = "sse", target_feature = "sse2", target_pointer_width = "32", target_endian = "little", not(target_vendor = "uwp"), feature = "cool_thing", )"#, ).unwrap(); // cfg_expr includes a list of every builtin target in rustc let x86_win = get_builtin_target_by_triple("i686-pc-windows-msvc").unwrap(); let x86_pentium_win = get_builtin_target_by_triple("i586-pc-windows-msvc").unwrap(); let uwp_win = get_builtin_target_by_triple("i686-uwp-windows-msvc").unwrap(); let mac = get_builtin_target_by_triple("x86_64-apple-darwin").unwrap(); let avail_target_feats = ["fxsr", "sse", "sse2"]; // This will satisfy all requirements assert!(specific.eval(|pred| { match pred { Predicate::Target(tp) => tp.matches(x86_win), Predicate::TargetFeature(feat) => avail_target_feats.contains(feat), Predicate::Feature(feat) => *feat == "cool_thing", _ => false, } })); // This won't, it doesn't have the cool_thing feature! assert!(!specific.eval(|pred| { match pred { Predicate::Target(tp) => tp.matches(x86_pentium_win), Predicate::TargetFeature(feat) => avail_target_feats.contains(feat), _ => false, } })); // This will *not* satisfy the vendor predicate assert!(!specific.eval(|pred| { match pred { Predicate::Target(tp) => tp.matches(uwp_win), Predicate::TargetFeature(feat) => avail_target_feats.contains(feat), _ => false, } })); // This will *not* satisfy the vendor, os, or env predicates assert!(!specific.eval(|pred| { match pred { Predicate::Target(tp) => tp.matches(mac), Predicate::TargetFeature(feat) => avail_target_feats.contains(feat), _ => false, } })); ``` ## Contributing We welcome community contributions to this project. Please read our [Contributor Guide](CONTRIBUTING.md) for more information on how to get started. ## License Licensed under either of - Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or ) - MIT license ([LICENSE-MIT](LICENSE-MIT) or ) at your option. ### Contribution Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. [1.77.2]: (https://forge.rust-lang.org/release/platform-support.html) cfg-expr-0.15.8/clippy.toml000064400000000000000000000000441046102023000136250ustar 00000000000000avoid-breaking-exported-api = false cfg-expr-0.15.8/deny.toml000064400000000000000000000006631046102023000132730ustar 00000000000000[advisories] vulnerability = "deny" unmaintained = "deny" notice = "deny" ignore = [ ] [bans] multiple-versions = "deny" [sources] unknown-registry = "deny" unknown-git = "deny" [licenses] unlicensed = "deny" allow-osi-fsf-free = "neither" copyleft = "deny" # We want really high confidence when inferring licenses from text confidence-threshold = 0.93 allow = [ "Apache-2.0", "Apache-2.0 WITH LLVM-exception", "MIT", ] cfg-expr-0.15.8/examples/eval.rs000064400000000000000000000043131046102023000145460ustar 00000000000000use cfg_expr::{targets::get_builtin_target_by_triple, Expression, Predicate}; fn main() { let specific = Expression::parse( r#"all( target_os = "windows", target_arch = "x86", windows, target_env = "msvc", target_feature = "fxsr", target_feature = "sse", target_feature = "sse2", target_pointer_width = "32", target_endian = "little", not(target_vendor = "uwp"), feature = "cool_thing", )"#, ) .unwrap(); // cfg_expr includes a list of every builtin target in rustc let x86_win = get_builtin_target_by_triple("i686-pc-windows-msvc").unwrap(); let x86_pentium_win = get_builtin_target_by_triple("i586-pc-windows-msvc").unwrap(); let uwp_win = get_builtin_target_by_triple("i686-uwp-windows-msvc").unwrap(); let mac = get_builtin_target_by_triple("x86_64-apple-darwin").unwrap(); let avail_targ_feats = ["fxsr", "sse", "sse2"]; // This will satisfy all requirements assert!(specific.eval(|pred| { match pred { Predicate::Target(tp) => tp.matches(x86_win), Predicate::TargetFeature(feat) => avail_targ_feats.contains(feat), Predicate::Feature(feat) => *feat == "cool_thing", _ => false, } })); // This won't, it doesnt' have the cool_thing feature! assert!(!specific.eval(|pred| { match pred { Predicate::Target(tp) => tp.matches(x86_pentium_win), Predicate::TargetFeature(feat) => avail_targ_feats.contains(feat), _ => false, } })); // This will *not* satisfy the vendor predicate assert!(!specific.eval(|pred| { match pred { Predicate::Target(tp) => tp.matches(uwp_win), Predicate::TargetFeature(feat) => avail_targ_feats.contains(feat), _ => false, } })); // This will *not* satisfy the vendor, os, or env predicates assert!(!specific.eval(|pred| { match pred { Predicate::Target(tp) => tp.matches(mac), Predicate::TargetFeature(feat) => avail_targ_feats.contains(feat), _ => false, } })); } cfg-expr-0.15.8/release.toml000064400000000000000000000012511046102023000137460ustar 00000000000000pre-release-commit-message = "Release {{version}}" tag-message = "Release {{version}}" tag-name = "{{version}}" pre-release-replacements = [ { file = "CHANGELOG.md", search = "Unreleased", replace = "{{version}}" }, { file = "CHANGELOG.md", search = "\\.\\.\\.HEAD", replace = "...{{tag_name}}" }, { file = "CHANGELOG.md", search = "ReleaseDate", replace = "{{date}}" }, { file = "CHANGELOG.md", search = "", replace = "\n## [Unreleased] - ReleaseDate" }, { file = "CHANGELOG.md", search = "", replace = "\n[Unreleased]: https://github.com/EmbarkStudios/cfg-expr/compare/{{tag_name}}...HEAD" }, ] cfg-expr-0.15.8/src/error.rs000064400000000000000000000126171046102023000137270ustar 00000000000000use std::{error::Error, fmt}; /// An error related to parsing of a cfg expression #[derive(Debug, PartialEq, Eq)] pub struct ParseError { /// The string that was parsed pub original: String, /// The range of characters in the original string that result /// in this error pub span: std::ops::Range, /// The specific reason for the error pub reason: Reason, } /// The particular reason for a `ParseError` #[derive(Debug, PartialEq, Eq)] pub enum Reason { /// not() takes exactly 1 predicate, unlike all() and any() InvalidNot(usize), /// The characters are not valid in an cfg expression InvalidCharacters, /// An opening parens was unmatched with a closing parens UnclosedParens, /// A closing parens was unmatched with an opening parens UnopenedParens, /// An opening quotes was unmatched with a closing quotes UnclosedQuotes, /// A closing quotes was unmatched with an opening quotes UnopenedQuotes, /// The expression does not contain any valid terms Empty, /// Found an unexpected term, which wasn't one of the expected terms that /// is listed Unexpected(&'static [&'static str]), /// Failed to parse an integer value InvalidInteger, /// The root cfg() may only contain a single predicate MultipleRootPredicates, /// A `target_has_atomic` predicate didn't correctly parse. InvalidHasAtomic, /// An element was not part of the builtin information in rustc UnknownBuiltin, } impl fmt::Display for ParseError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(&self.original)?; f.write_str("\n")?; for _ in 0..self.span.start { f.write_str(" ")?; } // Mismatched parens/quotes have a slightly different output // than the other errors match &self.reason { r @ (Reason::UnclosedParens | Reason::UnclosedQuotes) => { f.write_fmt(format_args!("- {r}")) } r @ (Reason::UnopenedParens | Reason::UnopenedQuotes) => { f.write_fmt(format_args!("^ {r}")) } other => { for _ in self.span.start..self.span.end { f.write_str("^")?; } f.write_fmt(format_args!(" {other}")) } } } } impl fmt::Display for Reason { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use Reason::{ Empty, InvalidCharacters, InvalidHasAtomic, InvalidInteger, InvalidNot, MultipleRootPredicates, UnclosedParens, UnclosedQuotes, Unexpected, UnknownBuiltin, UnopenedParens, UnopenedQuotes, }; match self { InvalidCharacters => f.write_str("invalid character(s)"), UnclosedParens => f.write_str("unclosed parens"), UnopenedParens => f.write_str("unopened parens"), UnclosedQuotes => f.write_str("unclosed quotes"), UnopenedQuotes => f.write_str("unopened quotes"), Empty => f.write_str("empty expression"), Unexpected(expected) => { if expected.len() > 1 { f.write_str("expected one of ")?; for (i, exp) in expected.iter().enumerate() { f.write_fmt(format_args!("{}`{exp}`", if i > 0 { ", " } else { "" }))?; } f.write_str(" here") } else if !expected.is_empty() { f.write_fmt(format_args!("expected a `{}` here", expected[0])) } else { f.write_str("the term was not expected here") } } InvalidNot(np) => f.write_fmt(format_args!("not() takes 1 predicate, found {np}")), InvalidInteger => f.write_str("invalid integer"), MultipleRootPredicates => f.write_str("multiple root predicates"), InvalidHasAtomic => f.write_str("expected integer or \"ptr\""), UnknownBuiltin => f.write_str("unknown built-in"), } } } impl Error for ParseError { fn description(&self) -> &str { use Reason::{ Empty, InvalidCharacters, InvalidHasAtomic, InvalidInteger, InvalidNot, MultipleRootPredicates, UnclosedParens, UnclosedQuotes, Unexpected, UnknownBuiltin, UnopenedParens, UnopenedQuotes, }; match self.reason { InvalidCharacters => "invalid character(s)", UnclosedParens => "unclosed parens", UnopenedParens => "unopened parens", UnclosedQuotes => "unclosed quotes", UnopenedQuotes => "unopened quotes", Empty => "empty expression", Unexpected(_) => "unexpected term", InvalidNot(_) => "not() takes 1 predicate", InvalidInteger => "invalid integer", MultipleRootPredicates => "multiple root predicates", InvalidHasAtomic => "expected integer or \"ptr\"", UnknownBuiltin => "unknown built-in", } } } /// Error parsing a `target_has_atomic` predicate. #[derive(Clone, Debug, Eq, PartialEq)] pub struct HasAtomicParseError { pub(crate) input: String, } impl fmt::Display for HasAtomicParseError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "expected integer or \"ptr\", found {}", self.input) } } impl Error for HasAtomicParseError {} cfg-expr-0.15.8/src/expr/lexer.rs000064400000000000000000000122411046102023000146640ustar 00000000000000use crate::error::{ParseError, Reason}; /// A single token in a cfg expression /// #[derive(Clone, Debug, PartialEq, Eq)] pub enum Token<'a> { /// A single contiguous term Key(&'a str), /// A single contiguous value, without its surrounding quotes Value(&'a str), /// A '=', joining a key and a value Equals, /// Beginning of an all() predicate list All, /// Beginning of an any() predicate list Any, /// Beginning of a not() predicate Not, /// A `(` for starting a predicate list OpenParen, /// A `)` for ending a predicate list CloseParen, /// A `,` for separating predicates in a predicate list Comma, } impl<'a> std::fmt::Display for Token<'a> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Debug::fmt(self, f) } } impl<'a> Token<'a> { fn len(&self) -> usize { match self { Token::Key(s) => s.len(), Token::Value(s) => s.len() + 2, Token::Equals | Token::OpenParen | Token::CloseParen | Token::Comma => 1, Token::All | Token::Any | Token::Not => 3, } } } /// Allows iteration through a cfg expression, yielding /// a token or a `ParseError`. /// /// Prefer to use `Expression::parse` rather than directly /// using the lexer pub struct Lexer<'a> { pub(super) inner: &'a str, original: &'a str, offset: usize, } impl<'a> Lexer<'a> { /// Creates a Lexer over a cfg expression, it can either be /// a raw expression eg `key` or in attribute form, eg `cfg(key)` pub fn new(text: &'a str) -> Self { let text = if text.starts_with("cfg(") && text.ends_with(')') { &text[4..text.len() - 1] } else { text }; Self { inner: text, original: text, offset: 0, } } } /// A wrapper around a particular token that includes the span of the characters /// in the original string, for diagnostic purposes #[derive(Debug)] pub struct LexerToken<'a> { /// The token that was lexed pub token: Token<'a>, /// The range of the token characters in the original license expression pub span: std::ops::Range, } impl<'a> Iterator for Lexer<'a> { type Item = Result, ParseError>; fn next(&mut self) -> Option { // Jump over any whitespace, updating `self.inner` and `self.offset` appropriately let non_whitespace_index = match self.inner.find(|c: char| !c.is_whitespace()) { Some(idx) => idx, None => self.inner.len(), }; self.inner = &self.inner[non_whitespace_index..]; self.offset += non_whitespace_index; #[inline] fn is_ident_start(ch: char) -> bool { ch == '_' || ch.is_ascii_lowercase() || ch.is_ascii_uppercase() } #[inline] fn is_ident_rest(ch: char) -> bool { is_ident_start(ch) || ch.is_ascii_digit() } match self.inner.chars().next() { None => None, Some('=') => Some(Ok(Token::Equals)), Some('(') => Some(Ok(Token::OpenParen)), Some(')') => Some(Ok(Token::CloseParen)), Some(',') => Some(Ok(Token::Comma)), Some(c) => { if c == '"' { match self.inner[1..].find('"') { Some(ind) => Some(Ok(Token::Value(&self.inner[1..=ind]))), None => Some(Err(ParseError { original: self.original.to_owned(), span: self.offset..self.original.len(), reason: Reason::UnclosedQuotes, })), } } else if is_ident_start(c) { let substr = match self.inner[1..].find(|c: char| !is_ident_rest(c)) { Some(ind) => &self.inner[..=ind], None => self.inner, }; match substr { "all" => Some(Ok(Token::All)), "any" => Some(Ok(Token::Any)), "not" => Some(Ok(Token::Not)), other => Some(Ok(Token::Key(other))), } } else { // clippy tries to help here, but we need // a Range here, not a RangeInclusive<> #[allow(clippy::range_plus_one)] Some(Err(ParseError { original: self.original.to_owned(), span: self.offset..self.offset + 1, reason: Reason::Unexpected(&["", "all", "any", "not"]), })) } } } .map(|tok| { tok.map(|tok| { let len = tok.len(); let start = self.offset; self.inner = &self.inner[len..]; self.offset += len; LexerToken { token: tok, span: start..self.offset, } }) }) } } cfg-expr-0.15.8/src/expr/parser.rs000064400000000000000000000450051046102023000150450ustar 00000000000000use crate::{ error::{ParseError, Reason}, expr::{ lexer::{Lexer, Token}, ExprNode, Expression, Func, InnerPredicate, }, }; use smallvec::SmallVec; impl Expression { /// Given a `cfg()` expression (the cfg( and ) are optional), attempts to /// parse it into a form where it can be evaluated /// /// ``` /// assert!(cfg_expr::Expression::parse(r#"cfg(all(unix, target_arch = "x86_64"))"#).is_ok()); /// ``` pub fn parse(original: &str) -> Result { let lexer = Lexer::new(original); // The lexer automatically trims any cfg( ), so reacquire // the string before we start walking tokens let original = lexer.inner; #[derive(Debug)] struct FuncAndSpan { func: Func, parens_index: usize, span: std::ops::Range, predicates: SmallVec<[InnerPredicate; 5]>, nest_level: u8, } let mut func_stack = SmallVec::<[FuncAndSpan; 5]>::new(); let mut expr_queue = SmallVec::<[ExprNode; 5]>::new(); // Keep track of the last token to simplify validation of the token stream let mut last_token: Option> = None; let parse_predicate = |key: (&str, std::ops::Range), val: Option<(&str, std::ops::Range)>| -> Result { // Warning: It is possible for arbitrarily-set configuration // options to have the same value as compiler-set configuration // options. For example, it is possible to do rustc --cfg "unix" program.rs // while compiling to a Windows target, and have both unix and windows // configuration options set at the same time. It is unwise to actually // do this. // // rustc is very permissive in this regard, but I'd rather be really // strict, as it's much easier to loosen restrictions over time than add // new ones macro_rules! err_if_val { () => { if let Some((_, vspan)) = val { return Err(ParseError { original: original.to_owned(), span: vspan, reason: Reason::Unexpected(&[]), }); } }; } let span = key.1; let key = key.0; use super::{InnerTarget, Which}; Ok(match key { // These are special cases in the cfg language that are // semantically the same as `target_family = ""`, // so we just make them not special // NOTE: other target families like "wasm" are NOT allowed // as naked predicates; they must be specified through // `target_family` "unix" | "windows" => { err_if_val!(); InnerPredicate::Target(InnerTarget { which: Which::Family, span: Some(span), }) } "test" => { err_if_val!(); InnerPredicate::Test } "debug_assertions" => { err_if_val!(); InnerPredicate::DebugAssertions } "proc_macro" => { err_if_val!(); InnerPredicate::ProcMacro } "feature" => { // rustc allows bare feature without a value, but the only way // such a predicate would ever evaluate to true would be if they // explicitly set --cfg feature, which would be terrible, so we // just error instead match val { Some((_, span)) => InnerPredicate::Feature(span), None => { return Err(ParseError { original: original.to_owned(), span, reason: Reason::Unexpected(&["= \"\""]), }); } } } "panic" => match val { Some((_, vspan)) => InnerPredicate::Target(InnerTarget { which: Which::Panic, span: Some(vspan), }), None => { return Err(ParseError { original: original.to_owned(), span, reason: Reason::Unexpected(&["= \"\""]), }); } }, target_key if key.starts_with("target_") => { let (val, vspan) = match val { None => { return Err(ParseError { original: original.to_owned(), span, reason: Reason::Unexpected(&["= \"\""]), }); } Some((val, vspan)) => (val, vspan), }; macro_rules! tp { ($which:ident) => { InnerTarget { which: Which::$which, span: Some(vspan), } }; } let tp = match &target_key[7..] { "abi" => tp!(Abi), "arch" => tp!(Arch), "feature" => { if val.is_empty() { return Err(ParseError { original: original.to_owned(), span: vspan, reason: Reason::Unexpected(&[""]), }); } return Ok(InnerPredicate::TargetFeature(vspan)); } "os" => tp!(Os), "family" => tp!(Family), "env" => tp!(Env), "endian" => InnerTarget { which: Which::Endian(val.parse().map_err(|_err| ParseError { original: original.to_owned(), span: vspan, reason: Reason::InvalidInteger, })?), span: None, }, "has_atomic" => InnerTarget { which: Which::HasAtomic(val.parse().map_err(|_err| ParseError { original: original.to_owned(), span: vspan, reason: Reason::InvalidHasAtomic, })?), span: None, }, "pointer_width" => InnerTarget { which: Which::PointerWidth(val.parse().map_err(|_err| ParseError { original: original.to_owned(), span: vspan, reason: Reason::InvalidInteger, })?), span: None, }, "vendor" => tp!(Vendor), _ => { return Err(ParseError { original: original.to_owned(), span, reason: Reason::Unexpected(&[ "target_arch", "target_feature", "target_os", "target_family", "target_env", "target_endian", "target_has_atomic", "target_pointer_width", "target_vendor", ]), }) } }; InnerPredicate::Target(tp) } _other => InnerPredicate::Other { identifier: span, value: val.map(|(_, span)| span), }, }) }; macro_rules! token_err { ($span:expr) => {{ let expected: &[&str] = match last_token { None => &["", "all", "any", "not"], Some(Token::All | Token::Any | Token::Not) => &["("], Some(Token::CloseParen) => &[")", ","], Some(Token::Comma) => &[")", ""], Some(Token::Equals) => &["\""], Some(Token::Key(_)) => &["=", ",", ")"], Some(Token::Value(_)) => &[",", ")"], Some(Token::OpenParen) => &["", ")", "all", "any", "not"], }; return Err(ParseError { original: original.to_owned(), span: $span, reason: Reason::Unexpected(&expected), }); }}; } let mut pred_key: Option<(&str, _)> = None; let mut pred_val: Option<(&str, _)> = None; let mut root_predicate_count = 0; // Basic implementation of the https://en.wikipedia.org/wiki/Shunting-yard_algorithm 'outer: for lt in lexer { let lt = lt?; match <.token { Token::Key(k) => { if matches!(last_token, None | Some(Token::OpenParen | Token::Comma)) { pred_key = Some((k, lt.span.clone())); } else { token_err!(lt.span) } } Token::Value(v) => { if matches!(last_token, Some(Token::Equals)) { // We only record the span for keys and values // so that the expression doesn't need a lifetime // but in the value case we need to strip off // the quotes so that the proper raw string is // provided to callers when evaluating the expression pred_val = Some((v, lt.span.start + 1..lt.span.end - 1)); } else { token_err!(lt.span) } } Token::Equals => { if !matches!(last_token, Some(Token::Key(_))) { token_err!(lt.span) } } Token::All | Token::Any | Token::Not => { if matches!(last_token, None | Some(Token::OpenParen | Token::Comma)) { let new_fn = match lt.token { // the 0 is a dummy value -- it will be substituted for the real // number of predicates in the `CloseParen` branch below. Token::All => Func::All(0), Token::Any => Func::Any(0), Token::Not => Func::Not, _ => unreachable!(), }; if let Some(fs) = func_stack.last_mut() { fs.nest_level += 1; } func_stack.push(FuncAndSpan { func: new_fn, span: lt.span, parens_index: 0, predicates: SmallVec::new(), nest_level: 0, }); } else { token_err!(lt.span) } } Token::OpenParen => { if matches!(last_token, Some(Token::All | Token::Any | Token::Not)) { if let Some(ref mut fs) = func_stack.last_mut() { fs.parens_index = lt.span.start; } } else { token_err!(lt.span) } } Token::CloseParen => { if matches!( last_token, None | Some(Token::All | Token::Any | Token::Not | Token::Equals) ) { token_err!(lt.span) } else { if let Some(top) = func_stack.pop() { let key = pred_key.take(); let val = pred_val.take(); // In this context, the boolean to int conversion is confusing. #[allow(clippy::bool_to_int_with_if)] let num_predicates = top.predicates.len() + if key.is_some() { 1 } else { 0 } + top.nest_level as usize; let func = match top.func { Func::All(_) => Func::All(num_predicates), Func::Any(_) => Func::Any(num_predicates), Func::Not => { // not() doesn't take a predicate list, but only a single predicate, // so ensure we have exactly 1 if num_predicates != 1 { return Err(ParseError { original: original.to_owned(), span: top.span.start..lt.span.end, reason: Reason::InvalidNot(num_predicates), }); } Func::Not } }; for pred in top.predicates { expr_queue.push(ExprNode::Predicate(pred)); } if let Some(key) = key { let inner_pred = parse_predicate(key, val)?; expr_queue.push(ExprNode::Predicate(inner_pred)); } expr_queue.push(ExprNode::Fn(func)); // This is the only place we go back to the top of the outer loop, // so make sure we correctly record this token last_token = Some(Token::CloseParen); continue 'outer; } // We didn't have an opening parentheses if we get here return Err(ParseError { original: original.to_owned(), span: lt.span, reason: Reason::UnopenedParens, }); } } Token::Comma => { if matches!( last_token, None | Some( Token::OpenParen | Token::All | Token::Any | Token::Not | Token::Equals ) ) { token_err!(lt.span) } else { let key = pred_key.take(); let val = pred_val.take(); let inner_pred = key.map(|key| parse_predicate(key, val)).transpose()?; match (inner_pred, func_stack.last_mut()) { (Some(pred), Some(func)) => { func.predicates.push(pred); } (Some(pred), None) => { root_predicate_count += 1; expr_queue.push(ExprNode::Predicate(pred)); } _ => {} } } } } last_token = Some(lt.token); } if let Some(Token::Equals) = last_token { return Err(ParseError { original: original.to_owned(), span: original.len()..original.len(), reason: Reason::Unexpected(&["\"\""]), }); } // If we still have functions on the stack, it means we have an unclosed parens if let Some(top) = func_stack.pop() { if top.parens_index != 0 { Err(ParseError { original: original.to_owned(), span: top.parens_index..original.len(), reason: Reason::UnclosedParens, }) } else { Err(ParseError { original: original.to_owned(), span: top.span, reason: Reason::Unexpected(&["("]), }) } } else { let key = pred_key.take(); let val = pred_val.take(); if let Some(key) = key { root_predicate_count += 1; expr_queue.push(ExprNode::Predicate(parse_predicate(key, val)?)); } if expr_queue.is_empty() { Err(ParseError { original: original.to_owned(), span: 0..original.len(), reason: Reason::Empty, }) } else if root_predicate_count > 1 { Err(ParseError { original: original.to_owned(), span: 0..original.len(), reason: Reason::MultipleRootPredicates, }) } else { Ok(Expression { original: original.to_owned(), expr: expr_queue, }) } } } } cfg-expr-0.15.8/src/expr.rs000064400000000000000000000744151046102023000135600ustar 00000000000000pub mod lexer; mod parser; use smallvec::SmallVec; use std::ops::Range; /// A predicate function, used to combine 1 or more predicates /// into a single value #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Copy, Clone)] pub enum Func { /// `not()` with a configuration predicate. It is true if its predicate /// is false and false if its predicate is true. Not, /// `all()` with a comma separated list of configuration predicates. It /// is false if at least one predicate is false. If there are no predicates, /// it is true. /// /// The associated `usize` is the number of predicates inside the `all()`. All(usize), /// `any()` with a comma separated list of configuration predicates. It /// is true if at least one predicate is true. If there are no predicates, /// it is false. /// /// The associated `usize` is the number of predicates inside the `any()`. Any(usize), } use crate::targets as targ; /// All predicates that pertains to a target, except for `target_feature` #[derive(Clone, PartialEq, Eq, Debug)] pub enum TargetPredicate { /// [target_abi](https://github.com/rust-lang/rust/issues/80970) Abi(targ::Abi), /// [target_arch](https://doc.rust-lang.org/reference/conditional-compilation.html#target_arch) Arch(targ::Arch), /// [target_endian](https://doc.rust-lang.org/reference/conditional-compilation.html#target_endian) Endian(targ::Endian), /// [target_env](https://doc.rust-lang.org/reference/conditional-compilation.html#target_env) Env(targ::Env), /// [target_family](https://doc.rust-lang.org/reference/conditional-compilation.html#target_family) /// This also applies to the bare [`unix` and `windows`](https://doc.rust-lang.org/reference/conditional-compilation.html#unix-and-windows) /// predicates. Family(targ::Family), /// [target_has_atomic](https://doc.rust-lang.org/reference/conditional-compilation.html#target_has_atomic). HasAtomic(targ::HasAtomic), /// [target_os](https://doc.rust-lang.org/reference/conditional-compilation.html#target_os) Os(targ::Os), /// [panic](https://doc.rust-lang.org/reference/conditional-compilation.html#panic) Panic(targ::Panic), /// [target_pointer_width](https://doc.rust-lang.org/reference/conditional-compilation.html#target_pointer_width) PointerWidth(u8), /// [target_vendor](https://doc.rust-lang.org/reference/conditional-compilation.html#target_vendor) Vendor(targ::Vendor), } pub trait TargetMatcher { fn matches(&self, tp: &TargetPredicate) -> bool; } impl TargetMatcher for targ::TargetInfo { fn matches(&self, tp: &TargetPredicate) -> bool { use TargetPredicate::{ Abi, Arch, Endian, Env, Family, HasAtomic, Os, Panic, PointerWidth, Vendor, }; match tp { // The ABI is allowed to be an empty string Abi(abi) => match &self.abi { Some(a) => abi == a, None => abi.0.is_empty(), }, Arch(a) => a == &self.arch, Endian(end) => *end == self.endian, // The environment is allowed to be an empty string Env(env) => match &self.env { Some(e) => env == e, None => env.0.is_empty(), }, Family(fam) => self.families.contains(fam), HasAtomic(has_atomic) => self.has_atomics.contains(*has_atomic), Os(os) => match &self.os { Some(self_os) => os == self_os, // os = "none" means it should be matched against None. Note that this is different // from "env" above. None => os.as_str() == "none", }, PointerWidth(w) => *w == self.pointer_width, Vendor(ven) => match &self.vendor { Some(v) => ven == v, None => ven == &targ::Vendor::unknown, }, Panic(panic) => &self.panic == panic, } } } #[cfg(feature = "targets")] impl TargetMatcher for target_lexicon::Triple { #[allow(clippy::cognitive_complexity)] #[allow(clippy::match_same_arms)] fn matches(&self, tp: &TargetPredicate) -> bool { use target_lexicon::*; use TargetPredicate::{ Abi, Arch, Endian, Env, Family, HasAtomic, Os, Panic, PointerWidth, Vendor, }; match tp { Abi(_) => { // `target_abi` is unstable. Assume false for this. false } Arch(arch) => { if arch == &targ::Arch::x86 { matches!(self.architecture, Architecture::X86_32(_)) } else if arch == &targ::Arch::wasm32 { self.architecture == Architecture::Wasm32 || self.architecture == Architecture::Asmjs } else if arch == &targ::Arch::arm { matches!(self.architecture, Architecture::Arm(_)) } else if arch == &targ::Arch::bpf { self.architecture == Architecture::Bpfeb || self.architecture == Architecture::Bpfel } else if arch == &targ::Arch::x86_64 { self.architecture == Architecture::X86_64 || self.architecture == Architecture::X86_64h } else if arch == &targ::Arch::mips32r6 { matches!( self.architecture, Architecture::Mips32( Mips32Architecture::Mipsisa32r6 | Mips32Architecture::Mipsisa32r6el ) ) } else if arch == &targ::Arch::mips64r6 { matches!( self.architecture, Architecture::Mips64( Mips64Architecture::Mipsisa64r6 | Mips64Architecture::Mipsisa64r6el ) ) } else { match arch.0.parse::() { Ok(a) => match (self.architecture, a) { (Architecture::Aarch64(_), Architecture::Aarch64(_)) | (Architecture::Mips32(_), Architecture::Mips32(_)) | (Architecture::Mips64(_), Architecture::Mips64(_)) | (Architecture::Powerpc64le, Architecture::Powerpc64) | (Architecture::Riscv32(_), Architecture::Riscv32(_)) | (Architecture::Riscv64(_), Architecture::Riscv64(_)) | (Architecture::Sparcv9, Architecture::Sparc64) => true, (a, b) => a == b, }, Err(_) => false, } } } Endian(end) => match self.architecture.endianness() { Ok(endian) => matches!( (end, endian), (crate::targets::Endian::little, Endianness::Little) | (crate::targets::Endian::big, Endianness::Big) ), Err(_) => false, }, Env(env) => { // The environment is implied by some operating systems match self.operating_system { OperatingSystem::Redox => env == &targ::Env::relibc, OperatingSystem::VxWorks => env == &targ::Env::gnu, OperatingSystem::Freebsd => match self.architecture { Architecture::Arm(ArmArchitecture::Armv6 | ArmArchitecture::Armv7) => { env == &targ::Env::gnueabihf } _ => env.0.is_empty(), }, OperatingSystem::Netbsd => match self.architecture { Architecture::Arm(ArmArchitecture::Armv6 | ArmArchitecture::Armv7) => { env == &targ::Env::eabihf } _ => env.0.is_empty(), }, OperatingSystem::None_ | OperatingSystem::Cloudabi | OperatingSystem::Hermit | OperatingSystem::Ios => match self.environment { Environment::LinuxKernel => env == &targ::Env::gnu, _ => env.0.is_empty(), }, _ => { if env.0.is_empty() { matches!( self.environment, Environment::Unknown | Environment::Android | Environment::Softfloat | Environment::Androideabi | Environment::Eabi | Environment::Eabihf | Environment::Sim ) } else { match env.0.parse::() { Ok(e) => { // Rustc shortens multiple "gnu*" environments to just "gnu" if env == &targ::Env::gnu { match self.environment { Environment::Gnu | Environment::Gnuabi64 | Environment::Gnueabi | Environment::Gnuspe | Environment::Gnux32 | Environment::GnuIlp32 | Environment::Gnueabihf | Environment::GnuLlvm => true, // Rust 1.49.0 changed all android targets to have the // gnu environment Environment::Android | Environment::Androideabi if self.operating_system == OperatingSystem::Linux => { true } Environment::Kernel => { self.operating_system == OperatingSystem::Linux } _ => false, } } else if env == &targ::Env::musl { matches!( self.environment, Environment::Musl | Environment::Musleabi | Environment::Musleabihf | Environment::Muslabi64 ) } else if env == &targ::Env::uclibc { matches!( self.environment, Environment::Uclibc | Environment::Uclibceabi | Environment::Uclibceabihf ) } else if env == &targ::Env::newlib { matches!( self.operating_system, OperatingSystem::Horizon | OperatingSystem::Espidf ) } else { self.environment == e } } Err(_) => false, } } } } } Family(fam) => { use OperatingSystem::{ Aix, AmdHsa, Bitrig, Cloudabi, Cuda, Darwin, Dragonfly, Emscripten, Espidf, Freebsd, Fuchsia, Haiku, Hermit, Horizon, Illumos, Ios, L4re, Linux, MacOSX, Nebulet, Netbsd, None_, Openbsd, Redox, Solaris, Tvos, Uefi, Unknown, VxWorks, Wasi, Watchos, Windows, }; match self.operating_system { AmdHsa | Bitrig | Cloudabi | Cuda | Hermit | Nebulet | None_ | Uefi => false, Aix | Darwin | Dragonfly | Espidf | Freebsd | Fuchsia | Haiku | Illumos | Ios | L4re | MacOSX { .. } | Horizon | Netbsd | Openbsd | Redox | Solaris | Tvos | VxWorks | Watchos => fam == &crate::targets::Family::unix, Emscripten => { match self.architecture { // asmjs, wasm32 and wasm64 are part of both the wasm and unix families Architecture::Asmjs | Architecture::Wasm32 => { fam == &crate::targets::Family::wasm || fam == &crate::targets::Family::unix } _ => false, } } Unknown => { // asmjs, wasm32 and wasm64 are part of the wasm family. match self.architecture { Architecture::Asmjs | Architecture::Wasm32 | Architecture::Wasm64 => { fam == &crate::targets::Family::wasm } _ => false, } } Linux => { // The 'kernel' environment is treated specially as not-unix if self.environment != Environment::Kernel { fam == &crate::targets::Family::unix } else { false } } Wasi => fam == &crate::targets::Family::wasm, Windows => fam == &crate::targets::Family::windows, // I really dislike non-exhaustive :( _ => false, } } HasAtomic(_) => { // atomic support depends on both the architecture and the OS. Assume false for // this. false } Os(os) => match os.0.parse::() { Ok(o) => match self.environment { Environment::HermitKernel => os == &targ::Os::hermit, _ => self.operating_system == o, }, Err(_) => { // Handle special case for darwin/macos, where the triple is // "darwin", but rustc identifies the OS as "macos" if os == &targ::Os::macos && self.operating_system == OperatingSystem::Darwin { true } else { // For android, the os is still linux, but the environment is android os == &targ::Os::android && self.operating_system == OperatingSystem::Linux && (self.environment == Environment::Android || self.environment == Environment::Androideabi) } } }, Panic(_) => { // panic support depends on the OS. Assume false for this. false } Vendor(ven) => match ven.0.parse::() { Ok(v) => { if self.vendor == v { true } else if let target_lexicon::Vendor::Custom(custom) = &self.vendor { custom.as_str() == "esp" && v == target_lexicon::Vendor::Espressif } else { false } } Err(_) => false, }, PointerWidth(pw) => { // The gnux32 environment is a special case, where it has an // x86_64 architecture, but a 32-bit pointer width if !matches!( self.environment, Environment::Gnux32 | Environment::GnuIlp32 ) { *pw == match self.pointer_width() { Ok(pw) => pw.bits(), Err(_) => return false, } } else { *pw == 32 } } } } } impl TargetPredicate { /// Returns true of the predicate matches the specified target /// /// Note that when matching against a [`target_lexicon::Triple`], the /// `has_target_atomic` and `panic` predicates will _always_ return `false`. /// /// ``` /// use cfg_expr::{targets::*, expr::TargetPredicate as tp}; /// let win = get_builtin_target_by_triple("x86_64-pc-windows-msvc").unwrap(); /// /// assert!( /// tp::Arch(Arch::x86_64).matches(win) && /// tp::Endian(Endian::little).matches(win) && /// tp::Env(Env::msvc).matches(win) && /// tp::Family(Family::windows).matches(win) && /// tp::Os(Os::windows).matches(win) && /// tp::PointerWidth(64).matches(win) && /// tp::Vendor(Vendor::pc).matches(win) /// ); /// ``` pub fn matches(&self, target: &T) -> bool where T: TargetMatcher, { target.matches(self) } } #[derive(Clone, Debug)] pub(crate) enum Which { Abi, Arch, Endian(targ::Endian), Env, Family, Os, HasAtomic(targ::HasAtomic), Panic, PointerWidth(u8), Vendor, } #[derive(Clone, Debug)] pub(crate) struct InnerTarget { which: Which, span: Option>, } /// A single predicate in a `cfg()` expression #[derive(Debug, PartialEq, Eq)] pub enum Predicate<'a> { /// A target predicate, with the `target_` prefix Target(TargetPredicate), /// Whether rustc's test harness is [enabled](https://doc.rust-lang.org/reference/conditional-compilation.html#test) Test, /// [Enabled](https://doc.rust-lang.org/reference/conditional-compilation.html#debug_assertions) /// when compiling without optimizations. DebugAssertions, /// [Enabled](https://doc.rust-lang.org/reference/conditional-compilation.html#proc_macro) for /// crates of the proc_macro type. ProcMacro, /// A [`feature = ""`](https://doc.rust-lang.org/nightly/cargo/reference/features.html) Feature(&'a str), /// [target_feature](https://doc.rust-lang.org/reference/conditional-compilation.html#target_feature) TargetFeature(&'a str), /// A generic bare predicate key that doesn't match one of the known options, eg `cfg(bare)` Flag(&'a str), /// A generic key = "value" predicate that doesn't match one of the known options, eg `cfg(foo = "bar")` KeyValue { key: &'a str, val: &'a str }, } #[derive(Clone, Debug)] pub(crate) enum InnerPredicate { Target(InnerTarget), Test, DebugAssertions, ProcMacro, Feature(Range), TargetFeature(Range), Other { identifier: Range, value: Option>, }, } impl InnerPredicate { fn to_pred<'a>(&self, s: &'a str) -> Predicate<'a> { use InnerPredicate as IP; use Predicate::{ DebugAssertions, Feature, Flag, KeyValue, ProcMacro, Target, TargetFeature, Test, }; match self { IP::Target(it) => match &it.which { Which::Abi => Target(TargetPredicate::Abi(targ::Abi::new( s[it.span.clone().unwrap()].to_owned(), ))), Which::Arch => Target(TargetPredicate::Arch(targ::Arch::new( s[it.span.clone().unwrap()].to_owned(), ))), Which::Os => Target(TargetPredicate::Os(targ::Os::new( s[it.span.clone().unwrap()].to_owned(), ))), Which::Vendor => Target(TargetPredicate::Vendor(targ::Vendor::new( s[it.span.clone().unwrap()].to_owned(), ))), Which::Env => Target(TargetPredicate::Env(targ::Env::new( s[it.span.clone().unwrap()].to_owned(), ))), Which::Family => Target(TargetPredicate::Family(targ::Family::new( s[it.span.clone().unwrap()].to_owned(), ))), Which::Endian(end) => Target(TargetPredicate::Endian(*end)), Which::HasAtomic(has_atomic) => Target(TargetPredicate::HasAtomic(*has_atomic)), Which::Panic => Target(TargetPredicate::Panic(targ::Panic::new( s[it.span.clone().unwrap()].to_owned(), ))), Which::PointerWidth(pw) => Target(TargetPredicate::PointerWidth(*pw)), }, IP::Test => Test, IP::DebugAssertions => DebugAssertions, IP::ProcMacro => ProcMacro, IP::Feature(rng) => Feature(&s[rng.clone()]), IP::TargetFeature(rng) => TargetFeature(&s[rng.clone()]), IP::Other { identifier, value } => match value { Some(vs) => KeyValue { key: &s[identifier.clone()], val: &s[vs.clone()], }, None => Flag(&s[identifier.clone()]), }, } } } #[derive(Clone, Debug)] pub(crate) enum ExprNode { Fn(Func), Predicate(InnerPredicate), } /// A parsed `cfg()` expression that can evaluated #[derive(Clone, Debug)] pub struct Expression { pub(crate) expr: SmallVec<[ExprNode; 5]>, // We keep the original string around for providing the arbitrary // strings that can make up an expression pub(crate) original: String, } impl Expression { /// An iterator over each predicate in the expression pub fn predicates(&self) -> impl Iterator> { self.expr.iter().filter_map(move |item| match item { ExprNode::Predicate(pred) => { let pred = pred.clone().to_pred(&self.original); Some(pred) } ExprNode::Fn(_) => None, }) } /// Evaluates the expression, using the provided closure to determine the value of /// each predicate, which are then combined into a final result depending on the /// functions `not()`, `all()`, or `any()` in the expression. /// /// `eval_predicate` typically returns `bool`, but may return any type that implements /// the `Logic` trait. /// /// ## Examples /// /// ``` /// use cfg_expr::{targets::*, Expression, Predicate}; /// /// let linux_musl = get_builtin_target_by_triple("x86_64-unknown-linux-musl").unwrap(); /// /// let expr = Expression::parse(r#"all(not(windows), target_env = "musl", any(target_arch = "x86", target_arch = "x86_64"))"#).unwrap(); /// /// assert!(expr.eval(|pred| { /// match pred { /// Predicate::Target(tp) => tp.matches(linux_musl), /// _ => false, /// } /// })); /// ``` /// /// Returning `Option`, where `None` indicates the result is unknown: /// /// ``` /// use cfg_expr::{targets::*, Expression, Predicate}; /// /// let expr = Expression::parse(r#"any(target_feature = "sse2", target_env = "musl")"#).unwrap(); /// /// let linux_gnu = get_builtin_target_by_triple("x86_64-unknown-linux-gnu").unwrap(); /// let linux_musl = get_builtin_target_by_triple("x86_64-unknown-linux-musl").unwrap(); /// /// fn eval(expr: &Expression, target: &TargetInfo) -> Option { /// expr.eval(|pred| { /// match pred { /// Predicate::Target(tp) => Some(tp.matches(target)), /// Predicate::TargetFeature(_) => None, /// _ => panic!("unexpected predicate"), /// } /// }) /// } /// /// // Whether the target feature is present is unknown, so the whole expression evaluates to /// // None (unknown). /// assert_eq!(eval(&expr, linux_gnu), None); /// /// // Whether the target feature is present is irrelevant for musl, since the any() always /// // evaluates to true. /// assert_eq!(eval(&expr, linux_musl), Some(true)); /// ``` pub fn eval(&self, mut eval_predicate: EP) -> T where EP: FnMut(&Predicate<'_>) -> T, T: Logic + std::fmt::Debug, { let mut result_stack = SmallVec::<[T; 8]>::new(); // We store the expression as postfix, so just evaluate each license // requirement in the order it comes, and then combining the previous // results according to each operator as it comes for node in self.expr.iter() { match node { ExprNode::Predicate(pred) => { let pred = pred.to_pred(&self.original); result_stack.push(eval_predicate(&pred)); } ExprNode::Fn(Func::All(count)) => { // all() with a comma separated list of configuration predicates. let mut result = T::top(); for _ in 0..*count { let r = result_stack.pop().unwrap(); result = result.and(r); } result_stack.push(result); } ExprNode::Fn(Func::Any(count)) => { // any() with a comma separated list of configuration predicates. let mut result = T::bottom(); for _ in 0..*count { let r = result_stack.pop().unwrap(); result = result.or(r); } result_stack.push(result); } ExprNode::Fn(Func::Not) => { // not() with a configuration predicate. // It is true if its predicate is false // and false if its predicate is true. let r = result_stack.pop().unwrap(); result_stack.push(r.not()); } } } result_stack.pop().unwrap() } /// The original string which has been parsed to produce this [`Expression`]. /// /// ``` /// use cfg_expr::Expression; /// /// assert_eq!( /// Expression::parse("any()").unwrap().original(), /// "any()" /// ); /// ``` #[inline] pub fn original(&self) -> &str { &self.original } } /// [`PartialEq`] will do a **syntactical** comparison, so will just check if both /// expressions have been parsed from the same string, **not** if they are semantically /// equivalent. /// /// ``` /// use cfg_expr::Expression; /// /// assert_eq!( /// Expression::parse("any()").unwrap(), /// Expression::parse("any()").unwrap() /// ); /// assert_ne!( /// Expression::parse("any()").unwrap(), /// Expression::parse("unix").unwrap() /// ); /// ``` impl PartialEq for Expression { fn eq(&self, other: &Self) -> bool { self.original.eq(&other.original) } } /// A propositional logic used to evaluate `Expression` instances. /// /// An `Expression` consists of some predicates and the `any`, `all` and `not` operators. An /// implementation of `Logic` defines how the `any`, `all` and `not` operators should be evaluated. pub trait Logic { /// The result of an `all` operation with no operands, akin to Boolean `true`. fn top() -> Self; /// The result of an `any` operation with no operands, akin to Boolean `false`. fn bottom() -> Self; /// `AND`, which corresponds to the `all` operator. fn and(self, other: Self) -> Self; /// `OR`, which corresponds to the `any` operator. fn or(self, other: Self) -> Self; /// `NOT`, which corresponds to the `not` operator. fn not(self) -> Self; } /// A boolean logic. impl Logic for bool { #[inline] fn top() -> Self { true } #[inline] fn bottom() -> Self { false } #[inline] fn and(self, other: Self) -> Self { self && other } #[inline] fn or(self, other: Self) -> Self { self || other } #[inline] fn not(self) -> Self { !self } } /// A three-valued logic -- `None` stands for the value being unknown. /// /// The truth tables for this logic are described on /// [Wikipedia](https://en.wikipedia.org/wiki/Three-valued_logic#Kleene_and_Priest_logics). impl Logic for Option { #[inline] fn top() -> Self { Some(true) } #[inline] fn bottom() -> Self { Some(false) } #[inline] fn and(self, other: Self) -> Self { match (self, other) { // If either is false, the expression is false. (Some(false), _) | (_, Some(false)) => Some(false), // If both are true, the expression is true. (Some(true), Some(true)) => Some(true), // One or both are unknown -- the result is unknown. _ => None, } } #[inline] fn or(self, other: Self) -> Self { match (self, other) { // If either is true, the expression is true. (Some(true), _) | (_, Some(true)) => Some(true), // If both are false, the expression is false. (Some(false), Some(false)) => Some(false), // One or both are unknown -- the result is unknown. _ => None, } } #[inline] fn not(self) -> Self { self.map(|v| !v) } } cfg-expr-0.15.8/src/lib.rs000064400000000000000000000005111046102023000133320ustar 00000000000000#![doc = include_str!("../README.md")] /// Types related to parse errors pub mod error; /// Types related to cfg expressions pub mod expr; /// Types related to rustc targets pub mod targets; pub use error::ParseError; pub use expr::{Expression, Predicate, TargetPredicate}; #[cfg(feature = "targets")] pub use target_lexicon; cfg-expr-0.15.8/src/targets/builtins.rs000064400000000000000000003036661046102023000161070ustar 00000000000000/* * * AUTO-GENERATED BY ./update * DO NOT MODIFY * * cargo run --manifest-path update/Cargo.toml */ #![allow(non_upper_case_globals, non_camel_case_types)] use super::*; pub(crate) const RUSTC_VERSION: &str = "1.77.2"; pub const ALL_BUILTINS: &[TargetInfo] = &[ TargetInfo { triple: Triple::new_const("aarch64-apple-darwin"), os: Some(Os::macos), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-apple-ios"), os: Some(Os::ios), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-apple-ios-macabi"), os: Some(Os::ios), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-apple-ios-sim"), os: Some(Os::ios), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-apple-tvos"), os: Some(Os::tvos), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-apple-tvos-sim"), os: Some(Os::tvos), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-apple-watchos"), os: Some(Os::watchos), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-apple-watchos-sim"), os: Some(Os::watchos), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-fuchsia"), os: Some(Os::fuchsia), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-kmc-solid_asp3"), os: Some(Os::solid_asp3), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::kmc), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-linux-android"), os: Some(Os::android), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-nintendo-switch-freestanding"), os: Some(Os::horizon), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("aarch64-pc-windows-gnullvm"), os: Some(Os::windows), abi: None, arch: Arch::aarch64, env: Some(Env::gnu), vendor: Some(Vendor::pc), families: Families::windows, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-pc-windows-msvc"), os: Some(Os::windows), abi: None, arch: Arch::aarch64, env: Some(Env::msvc), vendor: Some(Vendor::pc), families: Families::windows, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-unknown-freebsd"), os: Some(Os::freebsd), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-unknown-fuchsia"), os: Some(Os::fuchsia), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-unknown-hermit"), os: Some(Os::hermit), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("aarch64-unknown-illumos"), os: Some(Os::illumos), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::aarch64, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-unknown-linux-gnu_ilp32"), os: Some(Os::linux), abi: None, arch: Arch::aarch64, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-unknown-linux-musl"), os: Some(Os::linux), abi: None, arch: Arch::aarch64, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-unknown-linux-ohos"), os: Some(Os::linux), abi: None, arch: Arch::aarch64, env: Some(Env::ohos), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-unknown-netbsd"), os: Some(Os::netbsd), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-unknown-none"), os: None, abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("aarch64-unknown-none-softfloat"), os: None, abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("aarch64-unknown-nto-qnx710"), os: Some(Os::nto), abi: None, arch: Arch::aarch64, env: Some(Env::nto71), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-unknown-openbsd"), os: Some(Os::openbsd), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-unknown-redox"), os: Some(Os::redox), abi: None, arch: Arch::aarch64, env: Some(Env::relibc), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-unknown-teeos"), os: Some(Os::teeos), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("aarch64-unknown-uefi"), os: Some(Os::uefi), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("aarch64-uwp-windows-msvc"), os: Some(Os::windows), abi: None, arch: Arch::aarch64, env: Some(Env::msvc), vendor: Some(Vendor::uwp), families: Families::windows, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64-wrs-vxworks"), os: Some(Os::vxworks), abi: None, arch: Arch::aarch64, env: Some(Env::gnu), vendor: Some(Vendor::wrs), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64_be-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::aarch64, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64_be-unknown-linux-gnu_ilp32"), os: Some(Os::linux), abi: None, arch: Arch::aarch64, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("aarch64_be-unknown-netbsd"), os: Some(Os::netbsd), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("arm-linux-androideabi"), os: Some(Os::android), abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("arm-unknown-linux-gnueabi"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("arm-unknown-linux-gnueabihf"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("arm-unknown-linux-musleabi"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("arm-unknown-linux-musleabihf"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("arm64_32-apple-watchos"), os: Some(Os::watchos), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("arm64e-apple-darwin"), os: Some(Os::macos), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("arm64e-apple-ios"), os: Some(Os::ios), abi: None, arch: Arch::aarch64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armeb-unknown-linux-gnueabi"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armebv7r-none-eabi"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("armebv7r-none-eabihf"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("armv4t-none-eabi"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::new_const(&[]), panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("armv4t-unknown-linux-gnueabi"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv5te-none-eabi"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::new_const(&[]), panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("armv5te-unknown-linux-gnueabi"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv5te-unknown-linux-musleabi"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv5te-unknown-linux-uclibceabi"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::uclibc), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv6-unknown-freebsd"), os: Some(Os::freebsd), abi: None, arch: Arch::arm, env: Some(Env::gnueabihf), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv6-unknown-netbsd-eabihf"), os: Some(Os::netbsd), abi: None, arch: Arch::arm, env: Some(Env::eabihf), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv6k-nintendo-3ds"), os: Some(Os::horizon), abi: None, arch: Arch::arm, env: Some(Env::newlib), vendor: Some(Vendor::nintendo), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv7-linux-androideabi"), os: Some(Os::android), abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv7-sony-vita-newlibeabihf"), os: Some(Os::vita), abi: None, arch: Arch::arm, env: Some(Env::newlib), vendor: Some(Vendor::sony), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv7-unknown-freebsd"), os: Some(Os::freebsd), abi: None, arch: Arch::arm, env: Some(Env::gnueabihf), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv7-unknown-linux-gnueabi"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv7-unknown-linux-gnueabihf"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv7-unknown-linux-musleabi"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv7-unknown-linux-musleabihf"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv7-unknown-linux-ohos"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::ohos), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv7-unknown-linux-uclibceabi"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::uclibc), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv7-unknown-linux-uclibceabihf"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::uclibc), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv7-unknown-netbsd-eabihf"), os: Some(Os::netbsd), abi: None, arch: Arch::arm, env: Some(Env::eabihf), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv7-wrs-vxworks-eabihf"), os: Some(Os::vxworks), abi: None, arch: Arch::arm, env: Some(Env::gnu), vendor: Some(Vendor::wrs), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv7a-kmc-solid_asp3-eabi"), os: Some(Os::solid_asp3), abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::kmc), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv7a-kmc-solid_asp3-eabihf"), os: Some(Os::solid_asp3), abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::kmc), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv7a-none-eabi"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("armv7a-none-eabihf"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("armv7k-apple-watchos"), os: Some(Os::watchos), abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("armv7r-none-eabi"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("armv7r-none-eabihf"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("armv7s-apple-ios"), os: Some(Os::ios), abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("avr-unknown-gnu-atmega328"), os: None, abi: None, arch: Arch::avr, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 16, endian: Endian::little, has_atomics: HasAtomics::new_const(&[]), panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("bpfeb-unknown-none"), os: None, abi: None, arch: Arch::bpf, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::new_const(&[]), panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("bpfel-unknown-none"), os: None, abi: None, arch: Arch::bpf, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::new_const(&[]), panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("csky-unknown-linux-gnuabiv2"), os: Some(Os::linux), abi: None, arch: Arch::csky, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("csky-unknown-linux-gnuabiv2hf"), os: Some(Os::linux), abi: None, arch: Arch::csky, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("hexagon-unknown-linux-musl"), os: Some(Os::linux), abi: None, arch: Arch::hexagon, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("hexagon-unknown-none-elf"), os: None, abi: None, arch: Arch::hexagon, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("i386-apple-ios"), os: Some(Os::ios), abi: None, arch: Arch::x86, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i586-pc-nto-qnx700"), os: Some(Os::nto), abi: None, arch: Arch::x86, env: Some(Env::nto70), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i586-pc-windows-msvc"), os: Some(Os::windows), abi: None, arch: Arch::x86, env: Some(Env::msvc), vendor: Some(Vendor::pc), families: Families::windows, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i586-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::x86, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i586-unknown-linux-musl"), os: Some(Os::linux), abi: None, arch: Arch::x86, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i586-unknown-netbsd"), os: Some(Os::netbsd), abi: None, arch: Arch::x86, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i686-apple-darwin"), os: Some(Os::macos), abi: None, arch: Arch::x86, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i686-linux-android"), os: Some(Os::android), abi: None, arch: Arch::x86, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i686-pc-windows-gnu"), os: Some(Os::windows), abi: None, arch: Arch::x86, env: Some(Env::gnu), vendor: Some(Vendor::pc), families: Families::windows, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i686-pc-windows-gnullvm"), os: Some(Os::windows), abi: None, arch: Arch::x86, env: Some(Env::gnu), vendor: Some(Vendor::pc), families: Families::windows, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i686-pc-windows-msvc"), os: Some(Os::windows), abi: None, arch: Arch::x86, env: Some(Env::msvc), vendor: Some(Vendor::pc), families: Families::windows, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i686-unknown-freebsd"), os: Some(Os::freebsd), abi: None, arch: Arch::x86, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i686-unknown-haiku"), os: Some(Os::haiku), abi: None, arch: Arch::x86, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i686-unknown-hurd-gnu"), os: Some(Os::hurd), abi: None, arch: Arch::x86, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i686-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::x86, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i686-unknown-linux-musl"), os: Some(Os::linux), abi: None, arch: Arch::x86, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i686-unknown-netbsd"), os: Some(Os::netbsd), abi: None, arch: Arch::x86, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i686-unknown-openbsd"), os: Some(Os::openbsd), abi: None, arch: Arch::x86, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i686-unknown-uefi"), os: Some(Os::uefi), abi: None, arch: Arch::x86, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("i686-uwp-windows-gnu"), os: Some(Os::windows), abi: None, arch: Arch::x86, env: Some(Env::gnu), vendor: Some(Vendor::uwp), families: Families::windows, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i686-uwp-windows-msvc"), os: Some(Os::windows), abi: None, arch: Arch::x86, env: Some(Env::msvc), vendor: Some(Vendor::uwp), families: Families::windows, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i686-win7-windows-msvc"), os: Some(Os::windows), abi: None, arch: Arch::x86, env: Some(Env::msvc), vendor: Some(Vendor::win7), families: Families::windows, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("i686-wrs-vxworks"), os: Some(Os::vxworks), abi: None, arch: Arch::x86, env: Some(Env::gnu), vendor: Some(Vendor::wrs), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("loongarch64-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::loongarch64, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("loongarch64-unknown-none"), os: None, abi: None, arch: Arch::loongarch64, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("loongarch64-unknown-none-softfloat"), os: None, abi: None, arch: Arch::loongarch64, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("m68k-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::m68k, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mips-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::mips, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mips-unknown-linux-musl"), os: Some(Os::linux), abi: None, arch: Arch::mips, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mips-unknown-linux-uclibc"), os: Some(Os::linux), abi: None, arch: Arch::mips, env: Some(Env::uclibc), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mips64-openwrt-linux-musl"), os: Some(Os::linux), abi: None, arch: Arch::mips64, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mips64-unknown-linux-gnuabi64"), os: Some(Os::linux), abi: None, arch: Arch::mips64, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mips64-unknown-linux-muslabi64"), os: Some(Os::linux), abi: None, arch: Arch::mips64, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mips64el-unknown-linux-gnuabi64"), os: Some(Os::linux), abi: None, arch: Arch::mips64, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mips64el-unknown-linux-muslabi64"), os: Some(Os::linux), abi: None, arch: Arch::mips64, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mipsel-sony-psp"), os: Some(Os::psp), abi: None, arch: Arch::mips, env: None, vendor: Some(Vendor::sony), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mipsel-sony-psx"), os: None, abi: None, arch: Arch::mips, env: Some(Env::psx), vendor: Some(Vendor::sony), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::new_const(&[]), panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("mipsel-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::mips, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mipsel-unknown-linux-musl"), os: Some(Os::linux), abi: None, arch: Arch::mips, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mipsel-unknown-linux-uclibc"), os: Some(Os::linux), abi: None, arch: Arch::mips, env: Some(Env::uclibc), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mipsel-unknown-netbsd"), os: Some(Os::netbsd), abi: None, arch: Arch::mips, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mipsel-unknown-none"), os: None, abi: None, arch: Arch::mips, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("mipsisa32r6-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::mips32r6, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mipsisa32r6el-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::mips32r6, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mipsisa64r6-unknown-linux-gnuabi64"), os: Some(Os::linux), abi: None, arch: Arch::mips64r6, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("mipsisa64r6el-unknown-linux-gnuabi64"), os: Some(Os::linux), abi: None, arch: Arch::mips64r6, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("msp430-none-elf"), os: None, abi: None, arch: Arch::msp430, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 16, endian: Endian::little, has_atomics: HasAtomics::new_const(&[]), panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("nvptx64-nvidia-cuda"), os: Some(Os::cuda), abi: None, arch: Arch::nvptx64, env: None, vendor: Some(Vendor::nvidia), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("powerpc-unknown-freebsd"), os: Some(Os::freebsd), abi: None, arch: Arch::powerpc, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("powerpc-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::powerpc, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("powerpc-unknown-linux-gnuspe"), os: Some(Os::linux), abi: None, arch: Arch::powerpc, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("powerpc-unknown-linux-musl"), os: Some(Os::linux), abi: None, arch: Arch::powerpc, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("powerpc-unknown-netbsd"), os: Some(Os::netbsd), abi: None, arch: Arch::powerpc, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("powerpc-unknown-openbsd"), os: Some(Os::openbsd), abi: None, arch: Arch::powerpc, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("powerpc-wrs-vxworks"), os: Some(Os::vxworks), abi: None, arch: Arch::powerpc, env: Some(Env::gnu), vendor: Some(Vendor::wrs), families: Families::unix, pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("powerpc-wrs-vxworks-spe"), os: Some(Os::vxworks), abi: None, arch: Arch::powerpc, env: Some(Env::gnu), vendor: Some(Vendor::wrs), families: Families::unix, pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("powerpc64-ibm-aix"), os: Some(Os::aix), abi: None, arch: Arch::powerpc64, env: None, vendor: Some(Vendor::ibm), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("powerpc64-unknown-freebsd"), os: Some(Os::freebsd), abi: None, arch: Arch::powerpc64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("powerpc64-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::powerpc64, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("powerpc64-unknown-linux-musl"), os: Some(Os::linux), abi: None, arch: Arch::powerpc64, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("powerpc64-unknown-openbsd"), os: Some(Os::openbsd), abi: None, arch: Arch::powerpc64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("powerpc64-wrs-vxworks"), os: Some(Os::vxworks), abi: None, arch: Arch::powerpc64, env: Some(Env::gnu), vendor: Some(Vendor::wrs), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("powerpc64le-unknown-freebsd"), os: Some(Os::freebsd), abi: None, arch: Arch::powerpc64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("powerpc64le-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::powerpc64, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("powerpc64le-unknown-linux-musl"), os: Some(Os::linux), abi: None, arch: Arch::powerpc64, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("riscv32gc-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::riscv32, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("riscv32gc-unknown-linux-musl"), os: Some(Os::linux), abi: None, arch: Arch::riscv32, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("riscv32i-unknown-none-elf"), os: None, abi: None, arch: Arch::riscv32, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::new_const(&[]), panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("riscv32im-risc0-zkvm-elf"), os: Some(Os::zkvm), abi: None, arch: Arch::riscv32, env: None, vendor: Some(Vendor::risc0), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("riscv32im-unknown-none-elf"), os: None, abi: None, arch: Arch::riscv32, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::new_const(&[]), panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("riscv32imac-esp-espidf"), os: Some(Os::espidf), abi: None, arch: Arch::riscv32, env: Some(Env::newlib), vendor: Some(Vendor::espressif), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("riscv32imac-unknown-none-elf"), os: None, abi: None, arch: Arch::riscv32, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("riscv32imac-unknown-xous-elf"), os: Some(Os::xous), abi: None, arch: Arch::riscv32, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("riscv32imafc-esp-espidf"), os: Some(Os::espidf), abi: None, arch: Arch::riscv32, env: Some(Env::newlib), vendor: Some(Vendor::espressif), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("riscv32imafc-unknown-none-elf"), os: None, abi: None, arch: Arch::riscv32, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("riscv32imc-esp-espidf"), os: Some(Os::espidf), abi: None, arch: Arch::riscv32, env: Some(Env::newlib), vendor: Some(Vendor::espressif), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("riscv32imc-unknown-none-elf"), os: None, abi: None, arch: Arch::riscv32, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::new_const(&[]), panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("riscv64-linux-android"), os: Some(Os::android), abi: None, arch: Arch::riscv64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("riscv64gc-unknown-freebsd"), os: Some(Os::freebsd), abi: None, arch: Arch::riscv64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("riscv64gc-unknown-fuchsia"), os: Some(Os::fuchsia), abi: None, arch: Arch::riscv64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("riscv64gc-unknown-hermit"), os: Some(Os::hermit), abi: None, arch: Arch::riscv64, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("riscv64gc-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::riscv64, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("riscv64gc-unknown-linux-musl"), os: Some(Os::linux), abi: None, arch: Arch::riscv64, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("riscv64gc-unknown-netbsd"), os: Some(Os::netbsd), abi: None, arch: Arch::riscv64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("riscv64gc-unknown-none-elf"), os: None, abi: None, arch: Arch::riscv64, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("riscv64gc-unknown-openbsd"), os: Some(Os::openbsd), abi: None, arch: Arch::riscv64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("riscv64imac-unknown-none-elf"), os: None, abi: None, arch: Arch::riscv64, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("s390x-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::s390x, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("s390x-unknown-linux-musl"), os: Some(Os::linux), abi: None, arch: Arch::s390x, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("sparc-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::sparc, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("sparc-unknown-none-elf"), os: None, abi: None, arch: Arch::sparc, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("sparc64-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::sparc64, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("sparc64-unknown-netbsd"), os: Some(Os::netbsd), abi: None, arch: Arch::sparc64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("sparc64-unknown-openbsd"), os: Some(Os::openbsd), abi: None, arch: Arch::sparc64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("sparcv9-sun-solaris"), os: Some(Os::solaris), abi: None, arch: Arch::sparc64, env: None, vendor: Some(Vendor::sun), families: Families::unix, pointer_width: 64, endian: Endian::big, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("thumbv4t-none-eabi"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::new_const(&[]), panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("thumbv5te-none-eabi"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::new_const(&[]), panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("thumbv6m-none-eabi"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::new_const(&[]), panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("thumbv7a-pc-windows-msvc"), os: Some(Os::windows), abi: None, arch: Arch::arm, env: Some(Env::msvc), vendor: Some(Vendor::pc), families: Families::windows, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("thumbv7a-uwp-windows-msvc"), os: Some(Os::windows), abi: None, arch: Arch::arm, env: Some(Env::msvc), vendor: Some(Vendor::uwp), families: Families::windows, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("thumbv7em-none-eabi"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("thumbv7em-none-eabihf"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("thumbv7m-none-eabi"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("thumbv7neon-linux-androideabi"), os: Some(Os::android), abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("thumbv7neon-unknown-linux-gnueabihf"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("thumbv7neon-unknown-linux-musleabihf"), os: Some(Os::linux), abi: None, arch: Arch::arm, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("thumbv8m.base-none-eabi"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("thumbv8m.main-none-eabi"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("thumbv8m.main-none-eabihf"), os: None, abi: None, arch: Arch::arm, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("wasm32-unknown-emscripten"), os: Some(Os::emscripten), abi: None, arch: Arch::wasm32, env: None, vendor: Some(Vendor::unknown), families: Families::unix_wasm, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("wasm32-unknown-unknown"), os: Some(Os::unknown), abi: None, arch: Arch::wasm32, env: None, vendor: Some(Vendor::unknown), families: Families::wasm, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("wasm32-wasi"), os: Some(Os::wasi), abi: None, arch: Arch::wasm32, env: None, vendor: Some(Vendor::unknown), families: Families::wasm, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("wasm32-wasi-preview1-threads"), os: Some(Os::wasi), abi: None, arch: Arch::wasm32, env: None, vendor: Some(Vendor::unknown), families: Families::wasm, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("wasm64-unknown-unknown"), os: Some(Os::unknown), abi: None, arch: Arch::wasm64, env: None, vendor: Some(Vendor::unknown), families: Families::wasm, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("x86_64-apple-darwin"), os: Some(Os::macos), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-apple-ios"), os: Some(Os::ios), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-apple-ios-macabi"), os: Some(Os::ios), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-apple-tvos"), os: Some(Os::tvos), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-apple-watchos-sim"), os: Some(Os::watchos), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-fortanix-unknown-sgx"), os: Some(Os::unknown), abi: None, arch: Arch::x86_64, env: Some(Env::sgx), vendor: Some(Vendor::fortanix), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-fuchsia"), os: Some(Os::fuchsia), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-linux-android"), os: Some(Os::android), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-pc-nto-qnx710"), os: Some(Os::nto), abi: None, arch: Arch::x86_64, env: Some(Env::nto71), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-pc-solaris"), os: Some(Os::solaris), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::pc), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-pc-windows-gnu"), os: Some(Os::windows), abi: None, arch: Arch::x86_64, env: Some(Env::gnu), vendor: Some(Vendor::pc), families: Families::windows, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-pc-windows-gnullvm"), os: Some(Os::windows), abi: None, arch: Arch::x86_64, env: Some(Env::gnu), vendor: Some(Vendor::pc), families: Families::windows, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-pc-windows-msvc"), os: Some(Os::windows), abi: None, arch: Arch::x86_64, env: Some(Env::msvc), vendor: Some(Vendor::pc), families: Families::windows, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-unikraft-linux-musl"), os: Some(Os::linux), abi: None, arch: Arch::x86_64, env: Some(Env::musl), vendor: Some(Vendor::unikraft), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("x86_64-unknown-dragonfly"), os: Some(Os::dragonfly), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-unknown-freebsd"), os: Some(Os::freebsd), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-unknown-fuchsia"), os: Some(Os::fuchsia), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-unknown-haiku"), os: Some(Os::haiku), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-unknown-hermit"), os: Some(Os::hermit), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("x86_64-unknown-illumos"), os: Some(Os::illumos), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-unknown-l4re-uclibc"), os: Some(Os::l4re), abi: None, arch: Arch::x86_64, env: Some(Env::uclibc), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("x86_64-unknown-linux-gnu"), os: Some(Os::linux), abi: None, arch: Arch::x86_64, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-unknown-linux-gnux32"), os: Some(Os::linux), abi: None, arch: Arch::x86_64, env: Some(Env::gnu), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 32, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-unknown-linux-musl"), os: Some(Os::linux), abi: None, arch: Arch::x86_64, env: Some(Env::musl), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-unknown-linux-ohos"), os: Some(Os::linux), abi: None, arch: Arch::x86_64, env: Some(Env::ohos), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-unknown-netbsd"), os: Some(Os::netbsd), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-unknown-none"), os: None, abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("x86_64-unknown-openbsd"), os: Some(Os::openbsd), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-unknown-redox"), os: Some(Os::redox), abi: None, arch: Arch::x86_64, env: Some(Env::relibc), vendor: Some(Vendor::unknown), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-unknown-uefi"), os: Some(Os::uefi), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::unknown), families: Families::new_const(&[]), pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::abort, }, TargetInfo { triple: Triple::new_const("x86_64-uwp-windows-gnu"), os: Some(Os::windows), abi: None, arch: Arch::x86_64, env: Some(Env::gnu), vendor: Some(Vendor::uwp), families: Families::windows, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-uwp-windows-msvc"), os: Some(Os::windows), abi: None, arch: Arch::x86_64, env: Some(Env::msvc), vendor: Some(Vendor::uwp), families: Families::windows, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-win7-windows-msvc"), os: Some(Os::windows), abi: None, arch: Arch::x86_64, env: Some(Env::msvc), vendor: Some(Vendor::win7), families: Families::windows, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64-wrs-vxworks"), os: Some(Os::vxworks), abi: None, arch: Arch::x86_64, env: Some(Env::gnu), vendor: Some(Vendor::wrs), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_ptr, panic: Panic::unwind, }, TargetInfo { triple: Triple::new_const("x86_64h-apple-darwin"), os: Some(Os::macos), abi: None, arch: Arch::x86_64, env: None, vendor: Some(Vendor::apple), families: Families::unix, pointer_width: 64, endian: Endian::little, has_atomics: HasAtomics::atomic_8_16_32_64_128_ptr, panic: Panic::unwind, }, ]; impl super::Abi {} impl super::Arch { pub const aarch64: Arch = Arch::new_const("aarch64"); pub const arm: Arch = Arch::new_const("arm"); pub const avr: Arch = Arch::new_const("avr"); pub const bpf: Arch = Arch::new_const("bpf"); pub const csky: Arch = Arch::new_const("csky"); pub const hexagon: Arch = Arch::new_const("hexagon"); pub const loongarch64: Arch = Arch::new_const("loongarch64"); pub const m68k: Arch = Arch::new_const("m68k"); pub const mips: Arch = Arch::new_const("mips"); pub const mips32r6: Arch = Arch::new_const("mips32r6"); pub const mips64: Arch = Arch::new_const("mips64"); pub const mips64r6: Arch = Arch::new_const("mips64r6"); pub const msp430: Arch = Arch::new_const("msp430"); pub const nvptx64: Arch = Arch::new_const("nvptx64"); pub const powerpc: Arch = Arch::new_const("powerpc"); pub const powerpc64: Arch = Arch::new_const("powerpc64"); pub const riscv32: Arch = Arch::new_const("riscv32"); pub const riscv64: Arch = Arch::new_const("riscv64"); pub const s390x: Arch = Arch::new_const("s390x"); pub const sparc: Arch = Arch::new_const("sparc"); pub const sparc64: Arch = Arch::new_const("sparc64"); pub const wasm32: Arch = Arch::new_const("wasm32"); pub const wasm64: Arch = Arch::new_const("wasm64"); pub const x86: Arch = Arch::new_const("x86"); pub const x86_64: Arch = Arch::new_const("x86_64"); } impl super::Vendor { pub const apple: Vendor = Vendor::new_const("apple"); pub const espressif: Vendor = Vendor::new_const("espressif"); pub const fortanix: Vendor = Vendor::new_const("fortanix"); pub const ibm: Vendor = Vendor::new_const("ibm"); pub const kmc: Vendor = Vendor::new_const("kmc"); pub const nintendo: Vendor = Vendor::new_const("nintendo"); pub const nvidia: Vendor = Vendor::new_const("nvidia"); pub const pc: Vendor = Vendor::new_const("pc"); pub const risc0: Vendor = Vendor::new_const("risc0"); pub const sony: Vendor = Vendor::new_const("sony"); pub const sun: Vendor = Vendor::new_const("sun"); pub const unikraft: Vendor = Vendor::new_const("unikraft"); pub const unknown: Vendor = Vendor::new_const("unknown"); pub const uwp: Vendor = Vendor::new_const("uwp"); pub const win7: Vendor = Vendor::new_const("win7"); pub const wrs: Vendor = Vendor::new_const("wrs"); } impl super::Os { pub const aix: Os = Os::new_const("aix"); pub const android: Os = Os::new_const("android"); pub const cuda: Os = Os::new_const("cuda"); pub const dragonfly: Os = Os::new_const("dragonfly"); pub const emscripten: Os = Os::new_const("emscripten"); pub const espidf: Os = Os::new_const("espidf"); pub const freebsd: Os = Os::new_const("freebsd"); pub const fuchsia: Os = Os::new_const("fuchsia"); pub const haiku: Os = Os::new_const("haiku"); pub const hermit: Os = Os::new_const("hermit"); pub const horizon: Os = Os::new_const("horizon"); pub const hurd: Os = Os::new_const("hurd"); pub const illumos: Os = Os::new_const("illumos"); pub const ios: Os = Os::new_const("ios"); pub const l4re: Os = Os::new_const("l4re"); pub const linux: Os = Os::new_const("linux"); pub const macos: Os = Os::new_const("macos"); pub const netbsd: Os = Os::new_const("netbsd"); pub const nto: Os = Os::new_const("nto"); pub const openbsd: Os = Os::new_const("openbsd"); pub const psp: Os = Os::new_const("psp"); pub const redox: Os = Os::new_const("redox"); pub const solaris: Os = Os::new_const("solaris"); pub const solid_asp3: Os = Os::new_const("solid_asp3"); pub const teeos: Os = Os::new_const("teeos"); pub const tvos: Os = Os::new_const("tvos"); pub const uefi: Os = Os::new_const("uefi"); pub const unknown: Os = Os::new_const("unknown"); pub const vita: Os = Os::new_const("vita"); pub const vxworks: Os = Os::new_const("vxworks"); pub const wasi: Os = Os::new_const("wasi"); pub const watchos: Os = Os::new_const("watchos"); pub const windows: Os = Os::new_const("windows"); pub const xous: Os = Os::new_const("xous"); pub const zkvm: Os = Os::new_const("zkvm"); } impl super::Family { pub const unix: Family = Family::new_const("unix"); pub const wasm: Family = Family::new_const("wasm"); pub const windows: Family = Family::new_const("windows"); } const __families_unix: &[Family] = &[Family::unix]; const __families_unix_wasm: &[Family] = &[Family::unix, Family::wasm]; const __families_wasm: &[Family] = &[Family::wasm]; const __families_windows: &[Family] = &[Family::windows]; impl super::Families { pub const unix: Families = Families::new_const(__families_unix); pub const unix_wasm: Families = Families::new_const(__families_unix_wasm); pub const wasm: Families = Families::new_const(__families_wasm); pub const windows: Families = Families::new_const(__families_windows); } impl super::Env { pub const eabihf: Env = Env::new_const("eabihf"); pub const gnu: Env = Env::new_const("gnu"); pub const gnueabihf: Env = Env::new_const("gnueabihf"); pub const msvc: Env = Env::new_const("msvc"); pub const musl: Env = Env::new_const("musl"); pub const newlib: Env = Env::new_const("newlib"); pub const nto70: Env = Env::new_const("nto70"); pub const nto71: Env = Env::new_const("nto71"); pub const ohos: Env = Env::new_const("ohos"); pub const psx: Env = Env::new_const("psx"); pub const relibc: Env = Env::new_const("relibc"); pub const sgx: Env = Env::new_const("sgx"); pub const uclibc: Env = Env::new_const("uclibc"); } const __has_atomics_8_16_32_64_128_ptr: &[HasAtomic] = &[ HasAtomic::IntegerSize(8), HasAtomic::IntegerSize(16), HasAtomic::IntegerSize(32), HasAtomic::IntegerSize(64), HasAtomic::IntegerSize(128), HasAtomic::Pointer, ]; const __has_atomics_8_16_32_64_ptr: &[HasAtomic] = &[ HasAtomic::IntegerSize(8), HasAtomic::IntegerSize(16), HasAtomic::IntegerSize(32), HasAtomic::IntegerSize(64), HasAtomic::Pointer, ]; const __has_atomics_8_16_32_ptr: &[HasAtomic] = &[ HasAtomic::IntegerSize(8), HasAtomic::IntegerSize(16), HasAtomic::IntegerSize(32), HasAtomic::Pointer, ]; impl super::HasAtomics { pub const atomic_8_16_32_64_128_ptr: HasAtomics = HasAtomics::new_const(__has_atomics_8_16_32_64_128_ptr); pub const atomic_8_16_32_64_ptr: HasAtomics = HasAtomics::new_const(__has_atomics_8_16_32_64_ptr); pub const atomic_8_16_32_ptr: HasAtomics = HasAtomics::new_const(__has_atomics_8_16_32_ptr); } impl super::Panic { pub const abort: Panic = Panic::new_const("abort"); pub const unwind: Panic = Panic::new_const("unwind"); } cfg-expr-0.15.8/src/targets.rs000064400000000000000000000317461046102023000142530ustar 00000000000000use crate::error::{HasAtomicParseError, Reason}; use std::{borrow::Cow, ops::Deref}; mod builtins; /// A list of all of the [builtin](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/index.html#modules) /// targets known to rustc, as of 1.54.0 pub use builtins::ALL_BUILTINS; /// The unique identifier for a target. #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Triple(pub Cow<'static, str>); /// The "abi" field #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Abi(pub Cow<'static, str>); /// The "architecture" field #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Arch(pub Cow<'static, str>); /// The "vendor" field, which in practice is little more than an arbitrary modifier. #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Vendor(pub Cow<'static, str>); /// The "operating system" field, which sometimes implies an environment, and /// sometimes isn't an actual operating system. #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Os(pub Cow<'static, str>); /// Individual target families, which describe a set of targets grouped in some logical manner, /// typically by operating system. This includes values like `unix` and `windows`. #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Family(pub Cow<'static, str>); /// The "environment" field, which specifies an ABI environment on top of the /// operating system. In many configurations, this field is omitted, and the /// environment is implied by the operating system. #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Env(pub Cow<'static, str>); /// The panic strategy used on this target by default. #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Panic(pub Cow<'static, str>); macro_rules! field_impls { ($kind:ident) => { impl $kind { /// Constructs a new instance of this field. /// /// This method accepts both owned `String`s and `&'static str`s. #[inline] pub fn new(val: impl Into>) -> Self { Self(val.into()) } /// Constructs a new instance of this field from a `&'static str`. #[inline] pub const fn new_const(val: &'static str) -> Self { Self(Cow::Borrowed(val)) } /// Returns the string for the field. #[inline] pub fn as_str(&self) -> &str { &*self.0 } } impl AsRef for $kind { #[inline] fn as_ref(&self) -> &str { &*self.0 } } impl std::fmt::Display for $kind { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str(self.as_str()) } } }; } field_impls!(Triple); field_impls!(Abi); field_impls!(Arch); field_impls!(Vendor); field_impls!(Os); field_impls!(Family); field_impls!(Env); field_impls!(Panic); /// Integer size and pointers for which there's support for atomic functions. #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] pub enum HasAtomic { /// The platform supports atomics for the given integer size in bits (e.g. `AtomicU8` if /// `HasAtomic::IntegerSize(8)`). IntegerSize(u16), /// The platform supports atomics for pointers (`AtomicPtr`). Pointer, } impl std::str::FromStr for HasAtomic { type Err = HasAtomicParseError; fn from_str(s: &str) -> Result { if let Ok(size) = s.parse::() { Ok(Self::IntegerSize(size)) } else if s == "ptr" { Ok(HasAtomic::Pointer) } else { Err(HasAtomicParseError { input: s.to_owned(), }) } } } impl std::fmt::Display for HasAtomic { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::IntegerSize(size) => write!(f, "{size}"), Self::Pointer => write!(f, "ptr"), } } } /// A set of families for a target. /// /// Each target can be part of one or more families. This struct represents them. #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Families(Cow<'static, [Family]>); impl Families { /// Constructs a new instance. /// /// This method accepts both owned `String`s and `&'static str`s. /// /// If you have a `&'static [&'static str]`, prefer [`Self::new_const`]. #[inline] pub fn new(val: impl IntoIterator) -> Self { let mut fams: Vec<_> = val.into_iter().collect(); fams.sort_unstable(); Self(Cow::Owned(fams)) } /// Constructs a new instance of this field from a static slice of `&'static str`. /// /// `val` must be in sorted order: this constructor cannot check for that due to /// limitations in current versions of Rust. #[inline] pub const fn new_const(val: &'static [Family]) -> Self { // TODO: Check that val is sorted. Self(Cow::Borrowed(val)) } /// Returns true if this list of families contains a given family. #[inline] pub fn contains(&self, val: &Family) -> bool { self.0.contains(val) } } impl Deref for Families { type Target = [Family]; fn deref(&self) -> &Self::Target { &self.0 } } impl AsRef<[Family]> for Families { #[inline] fn as_ref(&self) -> &[Family] { &self.0 } } impl std::fmt::Display for Families { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{{")?; let len = self.0.len(); for (idx, family) in self.0.iter().enumerate() { write!(f, "{family}")?; if idx + 1 < len { write!(f, ", ")?; } } write!(f, "}}") } } /// A set of [`HasAtomic`] instances a target. #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct HasAtomics(Cow<'static, [HasAtomic]>); impl HasAtomics { /// Constructs a new instance. /// /// If you have a `&'static [HasAtomic]`, prefer [`Self::new_const`]. #[inline] pub fn new(val: impl IntoIterator) -> Self { let mut has_atomics: Vec<_> = val.into_iter().collect(); has_atomics.sort_unstable(); Self(Cow::Owned(has_atomics)) } /// Constructs a new instance of this struct from a static slice of [`HasAtomic`]. /// /// `val` must be in sorted order: this constructor cannot check for that due to /// limitations in current versions of Rust. #[inline] pub const fn new_const(val: &'static [HasAtomic]) -> Self { // TODO: Check that val is sorted. Self(Cow::Borrowed(val)) } /// Returns true if this list of families contains a given family. #[inline] pub fn contains(&self, val: HasAtomic) -> bool { self.0.contains(&val) } } impl Deref for HasAtomics { type Target = [HasAtomic]; fn deref(&self) -> &Self::Target { &self.0 } } impl AsRef<[HasAtomic]> for HasAtomics { #[inline] fn as_ref(&self) -> &[HasAtomic] { &self.0 } } impl std::fmt::Display for HasAtomics { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{{")?; let len = self.0.len(); for (idx, has_atomic) in self.0.iter().enumerate() { write!(f, "{has_atomic}")?; if idx + 1 < len { write!(f, ", ")?; } } write!(f, "}}") } } macro_rules! target_enum { ( $(#[$outer:meta])* pub enum $kind:ident { $( $(#[$inner:ident $($args:tt)*])* $name:ident $(= $value:expr)?, )+ } ) => { $(#[$outer])* #[allow(non_camel_case_types)] pub enum $kind { $( $(#[$inner $($args)*])* $name $(= $value)?, )+ } impl_from_str! { $kind { $( $(#[$inner $($args)*])* $name $(= $value)?, )+ } } }; } macro_rules! impl_from_str { ( $kind:ident { $( $(#[$attr:ident $($args:tt)*])* $name:ident $(= $value:expr)?, )+ } ) => { impl std::str::FromStr for $kind { type Err = Reason; fn from_str(s: &str) -> Result { match s { $(stringify!($name) => Ok(Self::$name),)+ _ => Err(Reason::Unexpected(&[$(stringify!($name),)+])), } } } }; } target_enum! { /// The endian types known to rustc #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub enum Endian { big, little, } } /// Contains information regarding a particular target known to rustc #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct TargetInfo { /// The target's unique identifier pub triple: Triple, /// The target's operating system, if any. Used by the /// [target_os](https://doc.rust-lang.org/reference/conditional-compilation.html#target_os) /// predicate. pub os: Option, /// The target's ABI, if any. Used by the /// [target_abi](https://github.com/rust-lang/rust/issues/80970) predicate. pub abi: Option, /// The target's CPU architecture. Used by the /// [target_arch](https://doc.rust-lang.org/reference/conditional-compilation.html#target_arch) /// predicate. pub arch: Arch, /// The target's ABI/libc used, if any. Used by the /// [target_env](https://doc.rust-lang.org/reference/conditional-compilation.html#target_env) /// predicate. pub env: Option, /// The target's vendor, if any. Used by the /// [target_vendor](https://doc.rust-lang.org/reference/conditional-compilation.html#target_vendor) /// predicate. pub vendor: Option, /// The target's families, if any. Used by the /// [target_family](https://doc.rust-lang.org/reference/conditional-compilation.html#target_family) /// predicate. pub families: Families, /// The size of the target's pointer type. Used by the /// [target_pointer_width](https://doc.rust-lang.org/reference/conditional-compilation.html#target_pointer_width) /// predicate. pub pointer_width: u8, /// The target's endianness. Used by the /// [target_endian](https://doc.rust-lang.org/reference/conditional-compilation.html#target_endian) /// predicate. pub endian: Endian, /// The target's support for atomics. Used by the has_target_atomics predicate. pub has_atomics: HasAtomics, /// The panic strategy used on this target by default. Used by the /// [panic](https://doc.rust-lang.org/beta/reference/conditional-compilation.html#panic) predicate. pub panic: Panic, } /// Attempts to find the `TargetInfo` for the specified target triple /// /// ``` /// assert!(cfg_expr::targets::get_builtin_target_by_triple("x86_64-unknown-linux-musl").is_some()); /// ``` pub fn get_builtin_target_by_triple(triple: &str) -> Option<&'static TargetInfo> { ALL_BUILTINS .binary_search_by(|ti| ti.triple.as_ref().cmp(triple)) .map(|i| &ALL_BUILTINS[i]) .ok() } /// Retrieves the version of rustc for which the built-in targets were /// retrieved from. /// /// Targets may be added and removed between different rustc versions. pub fn rustc_version() -> &'static str { builtins::RUSTC_VERSION } #[cfg(test)] mod test { use crate::targets::get_builtin_target_by_triple; use std::collections::{BTreeSet, HashSet}; // rustc's target-list is currently sorted lexicographically // by the target-triple, so ensure that stays the case #[test] fn targets_are_sorted() { for window in super::ALL_BUILTINS.windows(2) { assert!(window[0].triple < window[1].triple); } } // Ensure our workaround for https://github.com/rust-lang/rust/issues/36156 // still functions #[test] fn has_ios() { assert_eq!( 8, super::ALL_BUILTINS .iter() .filter(|ti| ti.os == Some(super::Os::ios)) .count() ); } // Ensure that TargetInfo can be used as keys for btree and hash-based data structures. #[test] fn set_map_key() { let target_info = get_builtin_target_by_triple("x86_64-unknown-linux-gnu").expect("known target"); let mut btree_set = BTreeSet::new(); btree_set.insert(target_info); let mut hash_set = HashSet::new(); hash_set.insert(target_info); } #[test] fn family_comp() { let a = super::Families::new([super::Family::unix, super::Family::wasm]); let b = super::Families::new([super::Family::wasm, super::Family::unix]); assert_eq!(a, b); } } cfg-expr-0.15.8/tests/eval.rs000064400000000000000000000334271046102023000141020ustar 00000000000000use cfg_expr::{ expr::{Predicate, TargetMatcher}, targets::{get_builtin_target_by_triple, ALL_BUILTINS as all}, Expression, TargetPredicate, }; struct Target { builtin: &'static cfg_expr::targets::TargetInfo, #[cfg(feature = "targets")] lexicon: Option, } impl Target { fn make(s: &str) -> Self { Self { builtin: get_builtin_target_by_triple(s).unwrap(), #[cfg(feature = "targets")] lexicon: { // Hack to workaround the addition in 1.48.0 of this weird, non-conformant // target triple, until https://github.com/bytecodealliance/target-lexicon/issues/63 is // resolved in a satisfactory manner, not really concerned about // the presence of this triple in most normal cases use target_lexicon as tl; match s { "avr-unknown-gnu-atmega328" => Some(tl::Triple { architecture: tl::Architecture::Avr, vendor: tl::Vendor::Unknown, operating_system: tl::OperatingSystem::Unknown, environment: tl::Environment::Unknown, binary_format: tl::BinaryFormat::Unknown, }), triple => match triple.parse::() { Ok(l) => Some(l), Err(e) => { // There are enough new weird architectures added in each version of // Rust that it is difficult to keep target-lexicon aware of all of // them. So try parsing this triple, but don't fail if it doesn't work. eprintln!("failed to parse '{triple}': {e:?}"); None } }, } }, } } } macro_rules! tg_match { ($pred:expr, $target:expr) => { match $pred { Predicate::Target(tg) => { let tinfo = tg.matches($target.builtin); #[cfg(feature = "targets")] if !matches!(tg, TargetPredicate::HasAtomic(_)) && !matches!(tg, TargetPredicate::Panic(_)) { if let Some(l) = &$target.lexicon { let linfo = tg.matches(l); assert_eq!( tinfo, linfo, "{:#?} builtin didn't match lexicon {:#?} for predicate {tg:#?}", $target.builtin, $target.lexicon, ); return linfo; } } tinfo } _ => panic!("not a target predicate"), } }; ($pred:expr, $target:expr, $feats:expr) => { match $pred { Predicate::Target(tg) => { let tinfo = tg.matches($target.builtin); #[cfg(feature = "targets")] if !matches!(tg, TargetPredicate::HasAtomic(_)) && !matches!(tg, TargetPredicate::Panic(_)) { if let Some(l) = &$target.lexicon { let linfo = tg.matches(l); assert_eq!( tinfo, linfo, "{:#?} builtin didn't match lexicon {:#?} for predicate {tg:#?}", $target.builtin, $target.lexicon, ); return linfo; } } tinfo } Predicate::TargetFeature(feat) => $feats.iter().find(|f| *f == feat).is_some(), _ => panic!("not a target predicate"), } }; } #[test] fn target_family() { let matches_any_family = Expression::parse("any(unix, target_family = \"windows\", target_family = \"wasm\")") .unwrap(); let impossible = Expression::parse("all(windows, target_family = \"unix\")").unwrap(); for target in all { let target = Target::make(target.triple.as_str()); if target.builtin.families.is_empty() { assert!(!matches_any_family.eval(|pred| { tg_match!(pred, target) })); } else { assert!(matches_any_family.eval(|pred| { tg_match!(pred, target) })); } assert!(!impossible.eval(|pred| { tg_match!(pred, target) })); } } #[test] fn tiny() { assert!(Expression::parse("all()").unwrap().eval(|_| false)); assert!(!Expression::parse("any()").unwrap().eval(|_| true)); assert!(!Expression::parse("not(all())").unwrap().eval(|_| false)); assert!(Expression::parse("not(any())").unwrap().eval(|_| true)); assert!(Expression::parse("all(not(blah))").unwrap().eval(|_| false)); assert!(!Expression::parse("any(not(blah))").unwrap().eval(|_| true)); } #[test] fn very_specific() { let specific = Expression::parse( r#"all( target_os = "windows", target_arch = "x86", windows, target_env = "msvc", target_feature = "fxsr", target_feature = "sse", target_feature = "sse2", target_pointer_width = "32", target_endian = "little", not(target_vendor = "uwp"), target_has_atomic = "8", target_has_atomic = "16", target_has_atomic = "32", target_has_atomic = "64", not(target_has_atomic = "128"), target_has_atomic = "ptr", panic = "unwind", not(panic = "abort"), )"#, ) .unwrap(); for target in all { let t = Target::make(target.triple.as_str()); assert_eq!( matches!( target.triple.as_str(), "i686-pc-windows-msvc" | "i586-pc-windows-msvc" | "i686-win7-windows-msvc" ), specific.eval(|pred| { tg_match!(pred, t, &["fxsr", "sse", "sse2"]) }), "expected true for i686-pc-windows-msvc, but got true for {}", target.triple, ); } for target in all { let expr = format!( r#"cfg( all( target_arch = "{}", {} {} target_env = "{}" ) )"#, target.arch.0, if let Some(v) = &target.vendor { format!(r#"target_vendor = "{}","#, v.0) } else { "".to_owned() }, if let Some(v) = &target.os { format!(r#"target_os = "{}","#, v.0) } else { "".to_owned() }, target.env.as_ref().map_or("", |e| e.as_str()), ); let specific = Expression::parse(&expr).unwrap(); let t = Target::make(target.triple.as_str()); assert!( specific.eval(|pred| { if target.triple.as_str() == "mips64-openwrt-linux-musl" { if let Predicate::Target(TargetPredicate::Vendor(vendor)) = pred { // This is a special predicate that doesn't follow the usual rules for // target-lexicon. return t.builtin.matches(&TargetPredicate::Vendor(vendor.clone())); } } tg_match!(pred, t) }), "failed expression '{}' for {:#?}", expr, t.builtin, ); } } #[test] fn complex() { let complex = Expression::parse(r#"cfg(all(unix, not(any(target_os="macos", target_os="android", target_os="emscripten"))))"#).unwrap(); // Should match linuxes let linux_gnu = Target::make("x86_64-unknown-linux-gnu"); let linux_musl = Target::make("x86_64-unknown-linux-musl"); assert!(complex.eval(|pred| tg_match!(pred, linux_gnu))); assert!(complex.eval(|pred| tg_match!(pred, linux_musl))); // Should *not* match windows or mac or android let windows_msvc = Target::make("x86_64-pc-windows-msvc"); let mac = Target::make("x86_64-apple-darwin"); let android = Target::make("aarch64-linux-android"); assert!(!complex.eval(|pred| tg_match!(pred, windows_msvc))); assert!(!complex.eval(|pred| tg_match!(pred, mac))); assert!(!complex.eval(|pred| tg_match!(pred, android))); let complex = Expression::parse(r#"all(not(target_os = "ios"), not(target_os = "android"))"#).unwrap(); assert!(complex.eval(|pred| tg_match!(pred, linux_gnu))); assert!(complex.eval(|pred| tg_match!(pred, linux_musl))); assert!(complex.eval(|pred| tg_match!(pred, windows_msvc))); assert!(complex.eval(|pred| tg_match!(pred, mac))); assert!(!complex.eval(|pred| tg_match!(pred, android))); let complex = Expression::parse(r#"all(any(unix, target_arch="x86"), not(any(target_os="android", target_os="emscripten")))"#).unwrap(); // Should match linuxes and mac assert!(complex.eval(|pred| tg_match!(pred, linux_gnu))); assert!(complex.eval(|pred| tg_match!(pred, linux_musl))); assert!(complex.eval(|pred| tg_match!(pred, mac))); // Should *not* match x86_64 windows or android assert!(!complex.eval(|pred| tg_match!(pred, windows_msvc))); assert!(!complex.eval(|pred| tg_match!(pred, android))); // Ensure that target_os = "none" matches against Os == None. let complex = Expression::parse(r#"all(target_os="none")"#).unwrap(); let armebv7r_none_eabi = Target::make("armebv7r-none-eabi"); assert!(!complex.eval(|pred| tg_match!(pred, linux_gnu))); assert!(complex.eval(|pred| tg_match!(pred, armebv7r_none_eabi))); } #[test] fn unstable_target_abi() { let linux_gnu = Target::make("x86_64-unknown-linux-gnu"); let linux_musl = Target::make("x86_64-unknown-linux-musl"); let windows_msvc = Target::make("x86_64-pc-windows-msvc"); let mac = Target::make("x86_64-apple-darwin"); let android = Target::make("aarch64-linux-android"); let target_with_abi_that_matches = cfg_expr::targets::TargetInfo { triple: cfg_expr::targets::Triple::new_const("aarch64-apple-darwin"), os: None, abi: Some(cfg_expr::targets::Abi::new_const("eabihf")), arch: cfg_expr::targets::Arch::aarch64, env: None, vendor: None, families: cfg_expr::targets::Families::unix, pointer_width: 64, endian: cfg_expr::targets::Endian::little, has_atomics: cfg_expr::targets::HasAtomics::atomic_8_16_32_64_128_ptr, panic: cfg_expr::targets::Panic::unwind, }; let target_with_abi_that_doesnt_match = cfg_expr::targets::TargetInfo { abi: Some(cfg_expr::targets::Abi::new_const("ilp32")), ..target_with_abi_that_matches.clone() }; let abi_pred = Expression::parse(r#"cfg(any(target_arch = "wasm32", target_abi = "eabihf"))"#).unwrap(); // Should match a specified target_abi that's the same assert!(abi_pred.eval(|pred| { match pred { Predicate::Target(tp) => tp.matches(&target_with_abi_that_matches), _ => false, } })); // Should *not* match a specified target_abi that isn't the same assert!(!abi_pred.eval(|pred| { match pred { Predicate::Target(tp) => tp.matches(&target_with_abi_that_doesnt_match), _ => false, } })); // Should *not* match any builtins at this point because target_abi isn't stable assert!(!abi_pred.eval(|pred| tg_match!(pred, linux_gnu))); assert!(!abi_pred.eval(|pred| tg_match!(pred, linux_musl))); assert!(!abi_pred.eval(|pred| tg_match!(pred, mac))); assert!(!abi_pred.eval(|pred| tg_match!(pred, windows_msvc))); assert!(!abi_pred.eval(|pred| tg_match!(pred, android))); } #[test] fn wasm_family() { let wasm = Expression::parse(r#"cfg(target_family = "wasm")"#).unwrap(); let wasm32_unknown = Target::make("wasm32-unknown-unknown"); let wasm32_emscripten = Target::make("wasm32-unknown-emscripten"); let wasm32_wasi = Target::make("wasm32-wasi"); let wasm64_unknown = Target::make("wasm64-unknown-unknown"); // All of the above targets match. assert!(wasm.eval(|pred| tg_match!(pred, wasm32_unknown))); assert!(wasm.eval(|pred| tg_match!(pred, wasm32_emscripten))); assert!(wasm.eval(|pred| tg_match!(pred, wasm32_wasi))); assert!(wasm.eval(|pred| tg_match!(pred, wasm64_unknown))); } #[test] fn features() { let enabled = ["good", "bad", "ugly"]; let many_features = Expression::parse( r#"all(feature = "good", feature = "bad", feature = "ugly", not(feature = "nope"))"#, ) .unwrap(); assert!(many_features.eval(|pred| { match pred { Predicate::Feature(name) => enabled.contains(name), _ => false, } })); let feature_and_target_feature = Expression::parse(r#"all(feature = "make_fast", target_feature = "sse4.2")"#).unwrap(); assert!(feature_and_target_feature.eval(|pred| { match pred { Predicate::Feature(name) => *name == "make_fast", Predicate::TargetFeature(feat) => *feat == "sse4.2", _ => false, } })); assert_eq!( feature_and_target_feature.eval(|pred| { match pred { Predicate::Feature(_) => Some(false), Predicate::TargetFeature(_) => None, _ => panic!("unexpected predicate"), } }), Some(false), "all() with Some(false) and None evaluates to Some(false)" ); assert_eq!( feature_and_target_feature.eval(|pred| { match pred { Predicate::Feature(_) => Some(true), Predicate::TargetFeature(_) => None, _ => panic!("unexpected predicate"), } }), None, "all() with Some(true) and None evaluates to None" ); } cfg-expr-0.15.8/tests/lexer.rs000064400000000000000000000025111046102023000142600ustar 00000000000000use cfg_expr::expr::lexer::{Lexer, Token}; macro_rules! test_lex { ($text:expr, [$($token:expr),+$(,)?]) => { let lexed: Vec<_> = Lexer::new($text).map(|lt| lt.unwrap().token).collect(); let expected = vec![$($token),+]; assert_eq!(lexed, expected); } } #[test] fn handles_raw() { test_lex!("key", [Token::Key("key")]); } #[test] fn strips_attribute() { test_lex!("cfg(key)", [Token::Key("key")]); } #[test] fn handle_key_value() { test_lex!( "key = \"value\"", [Token::Key("key"), Token::Equals, Token::Value("value"),] ); } #[test] fn handle_empty_value() { test_lex!( "key = \"\"", [Token::Key("key"), Token::Equals, Token::Value(""),] ); } #[test] fn handle_short_key() { test_lex!("k", [Token::Key("k"),]); } #[test] fn handle_cfg_keywords() { test_lex!( "all(any(not(anyblah,allnope,notany)))", [ Token::All, Token::OpenParen, Token::Any, Token::OpenParen, Token::Not, Token::OpenParen, Token::Key("anyblah"), Token::Comma, Token::Key("allnope"), Token::Comma, Token::Key("notany"), Token::CloseParen, Token::CloseParen, Token::CloseParen, ] ); } cfg-expr-0.15.8/tests/parser.rs000064400000000000000000000124651046102023000144460ustar 00000000000000use cfg_expr::{ error::Reason, expr::{Predicate as P, TargetPredicate as TP}, targets::*, Expression, ParseError, }; macro_rules! test_validate { (ok [$($text:expr => [$($expected:expr),*$(,)?]),+$(,)?]) => { $( let val_expr = Expression::parse($text).unwrap(); let mut preds = val_expr.predicates().enumerate(); $( let actual = preds.next().unwrap(); similar_asserts::assert_eq!($expected, actual.1, "failed @ index {}", actual.0); )* if let Some((_, additional)) = preds.next() { assert!(false, "found additional requirement {:?}", additional); } )+ }; } macro_rules! err { ($text:expr => $reason:ident @ $range:expr) => { let act_err = Expression::parse($text).unwrap_err(); let expected = ParseError { original: $text.to_owned(), span: $range, reason: Reason::$reason, }; similar_asserts::assert_eq!(expected, act_err); }; ($text:expr => $unexpected:expr; $range:expr) => { let act_err = Expression::parse($text).unwrap_err(); let expected = ParseError { original: $text.to_owned(), span: $range, reason: Reason::Unexpected($unexpected), }; similar_asserts::assert_eq!(expected, act_err); }; } #[test] fn fails_empty() { err!("" => Empty @ 0..0); err!(" " => Empty @ 0..1); err!("\n\t\n" => Empty @ 0..3); } #[test] fn fails_malformed() { err!("," => &["", "all", "any", "not"]; 0..1); // Keys can't begin with a number err!("8" => &["", "all", "any", "not"]; 0..1); err!("=" => &["", "all", "any", "not"]; 0..1); err!("(" => &["", "all", "any", "not"]; 0..1); err!("key =" => &["\"\""]; 5..5); err!("key1, key2" => MultipleRootPredicates @ 0..10); err!("key1, key2, " => MultipleRootPredicates @ 0..16); err!("key1 = \"v\", key2" => MultipleRootPredicates @ 0..16); } #[test] fn fails_unbalanced_parens() { err!("not(key" => UnclosedParens @ 3..7); err!("key)" => UnopenedParens @ 3..4); err!("foo (" => &["=", ",", ")"]; 4..5); } #[test] fn fails_unbalanced_quotes() { err!("key = \"value" => UnclosedQuotes @ 6..12); err!("key = \"" => UnclosedQuotes @ 6..7); err!("key = \"value, key = \"value\"" => &[",", ")"]; 21..26); err!("all(key = \"value), key = \"value\"" => &[",", ")"]; 26..31); err!("not(key = \"value)" => UnclosedQuotes @ 10..17); } #[test] #[allow(clippy::cognitive_complexity)] fn handles_single_predicate() { test_validate!(ok [ "cfg(key)" => [P::Flag("key")], "unix" => [P::Target(TP::Family(Family::unix))], "target_arch = \"mips\"" => [P::Target(TP::Arch(Arch::mips))], "feature = \"awesome\"" => [P::Feature("awesome")], "_key" => [P::Flag("_key")], " key" => [P::Flag("key")], " key " => [P::Flag("key")], " key = \"val\"" => [P::KeyValue{ key: "key", val: "val" }], "key=\"\"" => [P::KeyValue{ key: "key", val: "" }], " key=\"7\" " => [P::KeyValue{ key: "key", val: "7" }], "key = \"7 q\" " => [P::KeyValue{ key: "key", val: "7 q" }], "target_has_atomic = \"ptr\"" => [P::Target(TP::HasAtomic(HasAtomic::Pointer))], "target_has_atomic = \"4\"" => [P::Target(TP::HasAtomic(HasAtomic::IntegerSize(4)))], "target_has_atomic = \"64\"" => [P::Target(TP::HasAtomic(HasAtomic::IntegerSize(64)))], "target_has_atomic = \"128\" " => [P::Target(TP::HasAtomic(HasAtomic::IntegerSize(128)))], "panic = \"unwind\"" => [P::Target(TP::Panic(Panic("unwind".into())))], "panic = \"abort\"" => [P::Target(TP::Panic(Panic("abort".into())))], ]); } #[test] fn handles_simple_funcs() { test_validate!(ok [ "any()" => [], "all()" => [], "not(key = \"value\")" => [P::KeyValue { key: "key", val: "value" }], ]); } #[test] fn fails_invalid_funcs() { err!("nope()" => &["=", ",", ")"]; 4..5); err!("all(nope())" => &["=", ",", ")"]; 8..9); err!("any(,)" => &["", ")", "all", "any", "not"]; 4..5); err!("blah(key)" => &["=", ",", ")"]; 4..5); } #[test] fn ensures_not_has_one_predicate() { assert_eq!( Expression::parse("not()").unwrap_err(), ParseError { original: "not()".to_owned(), span: 0..5, reason: Reason::InvalidNot(0), } ); assert_eq!( Expression::parse("not(key_one, key_two)").unwrap_err(), ParseError { original: "not(key_one, key_two)".to_owned(), span: 0..21, reason: Reason::InvalidNot(2), } ); assert_eq!( Expression::parse("any(not(not(key_one, key_two)))").unwrap_err(), ParseError { original: "any(not(not(key_one, key_two)))".to_owned(), span: 8..29, reason: Reason::InvalidNot(2), } ); test_validate!(ok [ "not(key)" => [P::Flag("key")], "not(key,)" => [P::Flag("key")], "not(key = \"value\")" => [P::KeyValue { key: "key", val: "value" }], "not(key = \"value\",)" => [P::KeyValue { key: "key", val: "value" }], "not(not(not(key = \"value\",)))" => [P::KeyValue { key: "key", val: "value" }], ]); }