Don't use exported generics from conditional dependencies (panic runtimes and profiler-builtins) - #160306
Conversation
|
r? @wesleywiser rustbot has assigned @wesleywiser. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| // If std depends on exported generics from the unwinding runtime, it may encounter | ||
| // link-time errors when swapped to a different one. | ||
| // https://github.com/rust-lang/rust/issues/159682 | ||
| if self.is_panic_runtime(LOCAL_CRATE) { |
There was a problem hiding this comment.
Can we check for conditional dependencies here instead of hard coding panic runtimes?
There was a problem hiding this comment.
🤷 it seems kind of goofy to export the symbols then never use them but sure
There was a problem hiding this comment.
A single crate can be a conditional dependency of one crate and an unconditional dependency of a later crate. For the second crate it would be safe to use the exported generics. I guess it doesn't matter much for panic runtimes. The current code is a bit safer against any future kinds of conditional dependencies we might introduce.
There was a problem hiding this comment.
Why would we introduce more conditional dependencies?
There was a problem hiding this comment.
We might want to turn the profiler runtime into one in the future for build-std for example. (if we don't turn that into a regular C static library instead)
39dd7ac to
0fb8cb8
Compare
This comment has been minimized.
This comment has been minimized.
0fb8cb8 to
601ee8e
Compare
|
r=me with CI passing. |
|
@bors r=bjorn3 |
|
⌛ Testing commit 601ee8e with merge 34c93c4... Workflow: https://github.com/rust-lang/rust/actions/runs/30787902693 |
Don't use exported generics from conditional dependencies (panic runtimes and profiler-builtins) This is a fix for #159682. This seems like a generalized footgun for writing FFI plugins? But at least right now, a very specific change to the crates we often swap around seems prudent.
|
@bors yield |
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #160414. |
Rollup merge of #160306 - saethlin:panic-runtimes-dont-share, r=bjorn3 Don't use exported generics from conditional dependencies (panic runtimes and profiler-builtins) This is a fix for #159682. This seems like a generalized footgun for writing FFI plugins? But at least right now, a very specific change to the crates we often swap around seems prudent.
This is a fix for #159682.
This seems like a generalized footgun for writing FFI plugins? But at least right now, a very specific change to the crates we often swap around seems prudent.