Skip to content

Conversation

@tgross35
Copy link
Contributor

Currently there is an interesting situation with the way features get enabled; testcrate enables mangled-names, but the intrinsics.rs example requires this feature be disabled (otherwise the test fails with missing symbols, as expected). This is also the reason that testcrate is not a default workspace member, meaning cargo test doesn't actually run testcrate's tests; making it a default member would mean that compiler-builtins/mangled-names gets enabled when examples/intrinsics.rs gets built, due to the way features get unified.

Simplify the situation by making moving the example to its own crate as builtins-test-intrinsics. This also means testcrate can become a default member so it is included in cargo check or cargo test when run at the workspace root.

testcrate and builtins-test-intrinsics still can't be built at the same time since there isn't a straightforward way to have Cargo build compiler-builtins twice with different features. This is a side effect of us using non-additive features, but there isn't really a better option since enabling both mangled and unmangled names would render builtins-test-intrinsics useless.

Currently there is an interesting situation with the way features get
enabled; `testcrate` enables `mangled-names`, but the `intrinsics.rs`
example requires this feature be disabled (otherwise the test fails with
missing symbols, as expected). This is also the reason that `testcrate`
is not a default workspace member, meaning `cargo test` doesn't actually
run `testcrate`'s tests; making it a default member would mean that
`compiler-builtins/mangled-names` gets enabled when
`examples/intrinsics.rs` gets built, due to the way features get
unified.

Simplify the situation by making moving the example to its own crate as
`builtins-test-intrinsics`. This also means `testcrate` can become a
default member so it is included in `cargo check` or `cargo test` when
run at the workspace root.

`testcrate` and `builtins-test-intrinsics` still can't be built at the
same time since there isn't a straightforward way to have Cargo build
`compiler-builtins` twice with different features. This is a side effect
of us using non-additive features, but there isn't really a better
option since enabling both mangled and unmangled names would render
`builtins-test-intrinsics` useless.
@tgross35 tgross35 enabled auto-merge (rebase) March 18, 2025 10:33
@tgross35 tgross35 merged commit 942ab9f into rust-lang:master Mar 18, 2025
26 checks passed
@tgross35 tgross35 deleted the builtins-test-intrinsics branch March 18, 2025 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant