about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/snippet.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-08-26 01:40:26 +0000
committerbors <bors@rust-lang.org>2020-08-26 01:40:26 +0000
commit3e98860425447e30e967e83a738f7c54b7fe8273 (patch)
tree7e6064b59e631310dafa67a4caccaf95d376420c /compiler/rustc_errors/src/snippet.rs
parentbf4342114e357f2934d59e12e31e94532ddb2adf (diff)
parentaae6c0fbfe3051e5539f47d0e9d84ddee53f72bd (diff)
downloadrust-3e98860425447e30e967e83a738f7c54b7fe8273.tar.gz
rust-3e98860425447e30e967e83a738f7c54b7fe8273.zip
Auto merge of #75811 - ecstatic-morse:better-dlerror, r=nagisa
Refactor dynamic library error checking on *nix

The old code was checking `dlerror` more often than necessary, since (unlike `dlsym`) checking the return value of [`dlopen`](https://www.man7.org/linux/man-pages/man3/dlopen.3.html) is enough to indicate whether an error occurred. In the first commit, I've refactored the code to minimize the number of system calls needed. It should be strictly better than the old version.

The second commit is an optional addendum which fixes the issue observed on illumos in #74469, a PR I reviewed that was ultimately closed due to inactivity. I'm not sure how hard we try to work around platform-specific bugs like this, and I believe that, due to the way that `dlerror` is specified in the POSIX standard, libc implementations that want to run on conforming systems cannot call `dlsym` in multi-threaded programs.
Diffstat (limited to 'compiler/rustc_errors/src/snippet.rs')
0 files changed, 0 insertions, 0 deletions