Parse target_abi if it's present even though it's unstable #52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!! 👋🏻
Checklist
Description of Changes
This supports parsing the currently unstable
target_abi
cfg
predicate, which is described in:Because this is unstable, the
Abi
will beNone
for all current builtins.However, this change enables
cfg-expr
to successfully parsecfg
predicates that containtarget_abi
for those crates that decide to use it.I believe once
target_abi
is stabilized that this code will Just Work™️, but of course I don't have a way to predict the future 😅 I did hack the update binary to use nightly Rust and it did set theAbi
field as I expected, so 🤞🏻The reason I want this is because:
cargo-hakari
to manage a workspace hack crate.cargo hakari
usescfg-expr
to parsecfg
s.ahash
crate.ahash
v0.8.1 usestarget_abi
in some of itscfg
scargo hakari
can't parsetarget_abi
and fails with this error:So from what I can tell, we either can't upgrade
ahash
or we can't usecargo hakari
without this change tocfg-expr
.I'm totally open to being told no, this isn't something you want to support, and I'll figure out a workaround some other way :) But this seemed like the "right" place to fix it.
Related Issues
None directly related that I could find; I searched for "target_abi" and "nightly". Support older builtins is tangentially related as this is supporting all future possible predicates whereas that issue expresses desire to support all past possible ones.
There are other unstable
cfg
attributes liketarget_has_atomic_equal_alignment
that ideally should be supported here too, and I'm happy to work on adding those if you'd rather support all unstablecfg
s or none of them, buttarget_abi
is the only one that's affecting me directly right now 😉Thank you!! ❤️