Skip to content

Only load libclang once, and don't unload it #356

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

Merged
merged 2 commits into from
Dec 22, 2016

Conversation

fitzgen
Copy link
Member

@fitzgen fitzgen commented Dec 22, 2016

See the first commit for details.

Second commit is just cargo fmt.

r? @emilio

… it is not prematurely dropped.

Honestly, I'm still not 100% sure what the root cause of the Clang and
LLVM issues I was seeing were, but when I ensure that we only have one
libclang loaded across all threads and that it is never dropped, the
assertions go away.

Fixes rust-lang#350.
@highfive
Copy link

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@emilio
Copy link
Contributor

emilio commented Dec 22, 2016

Makes sense.

@bors-servo r+

@bors-servo
Copy link

📌 Commit c109c73 has been approved by emilio

@bors-servo
Copy link

⚡ Test exempted - status

@bors-servo bors-servo merged commit c109c73 into rust-lang:master Dec 22, 2016
bors-servo pushed a commit that referenced this pull request Dec 22, 2016
Only load libclang once, and don't unload it

See the first commit for details.

Second commit is just `cargo fmt`.

r? @emilio
@emilio
Copy link
Contributor

emilio commented Dec 22, 2016

Thanks for digging into it! :)

@nox
Copy link
Contributor

nox commented Dec 22, 2016

Noooooo. https://doc.rust-lang.org/nightly/std/sync/struct.Once.html Please use that instead of lazy_static...

@fitzgen fitzgen deleted the libclang-is-my-enemy branch December 22, 2016 18:44
@fitzgen
Copy link
Member Author

fitzgen commented Dec 22, 2016

Noooooo. https://doc.rust-lang.org/nightly/std/sync/struct.Once.html Please use that instead of lazy_static...

How would we save libclang in a global for other threads to reuse with Once?

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.

5 participants