about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-04-22 23:19:24 +0200
committerGitHub <noreply@github.com>2020-04-22 23:19:24 +0200
commit0f806534c01ea906a2e178b31ea2733a92e4bc0a (patch)
tree4e9e25f2d3c3a1d755c7852e9393dc24e4871d82 /src/rustllvm/RustWrapper.cpp
parent16be619c6aec0db952be61ebb45c63a1ebe4b1a5 (diff)
parent3bd742ff4e61f6752d76a75f53c140170a117554 (diff)
downloadrust-0f806534c01ea906a2e178b31ea2733a92e4bc0a.tar.gz
rust-0f806534c01ea906a2e178b31ea2733a92e4bc0a.zip
Rollup merge of #71400 - dtolnay:isavailable, r=petrochenkov
proc_macro::is_available()

This PR adds `proc_macro::is_available() -> bool` to determine whether proc_macro has been made accessible to the currently running program.

The proc_macro crate is only intended for use inside the implementation of procedural macros. All the functions in the crate panic if invoked from outside of a procedural macro, such as from a build script or unit test or ordinary Rust binary.

Unfortunately those panics made it impossible for libraries that are designed to support both macro and non-macro use cases (e.g. Syn) to be used from binaries that are compiled with panic=abort. In panic=unwind mode we're able to attempt a proc macro call inside catch_unwind and use libproc_macro's result if it succeeds, otherwise fall back to a non-macro alternative implementation. But in panic=abort there was no way to determine which implementation needs to be used.

r? @eddyb
attn: @petrochenkov @adetaylor
ref: https://github.com/dtolnay/cxx/issues/130
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions