-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix builds fail with error: symbol init___rust_ctor___ctor is already defined #6495
#6505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| }; | ||
| use std::ops::Add; | ||
|
|
||
| #[cfg(test)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something about ctor 2.1 doesn't like two ctors for a single library
tustvold
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a massive fan of the use of static constructors, but as this is a pre-existing pattern 👍
FWIW the only alternative I know is to do what we do in IOx and sprinkle setup in all the tests: https://github.com/search?q=repo%3Ainfluxdata/influxdb_iox%20maybe_start_logging&type=code e.g. #[test]
fn test_panic_counter_and_logging() {
maybe_start_logging();Do you know a better pattern to enable logging during unit test run? |
yes, one second |
What about this? https://github.com/apache/arrow-datafusion/blob/201a2a903325ad4dddd94572cfd0a19287131f04/datafusion/sql/tests/integration_test.rs#LL41C7-L41C7 Oh, never mind, I see now the conversation started with not liking static constructor. |
Which issue does this PR close?
Closes #6495
Rationale for this change
CI / builds are failing after the update of the ctor library
What changes are included in this PR?
Ensure we only use
#[ctor]once in the datafusion-optimizer libraryAre these changes tested?
yes by CI
Are there any user-facing changes?