-
Notifications
You must be signed in to change notification settings - Fork 13k
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
panic=abort with no_mangle function causes monomorphisation ICE #116953
Comments
can reproduce |
can you include a Cargo.toml and Cargo.lock (for example as a link to a project (+commit), or right here), to be able to reproduce this in the future? |
Sorry, forgot to add those, I've attached them |
@Nilstrieb does needs MCVE mean an example not relying on tokio? |
yes |
Ran a bisect. searched nightlies: from bisected with cargo-bisect-rustc v0.6.7Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --preserve --start=2023-05-31 --end=2023-10-17 --access=github -- rustc -- -C panic=abort |
Spent some unforgettable time chopping down 80k lines of tokio code piece by piece, but it was worth it, I hope. Here's an MCVE:
[package]
edition = "2021"
name = "issue_116953"
version = "0.0.0"
use std::{future::Future, marker::PhantomData, pin::Pin, task::Poll};
struct Guard<'a> {
_marker: PhantomData<&'a ()>,
}
pub struct Runtime {}
impl Runtime {
fn enter<'a>(&'a self) -> Guard<'a> {
Guard {
_marker: PhantomData,
}
}
pub fn block_on<F: Future>(&self, _: F) -> F::Output {
let _guard = self.enter();
loop {}
}
}
struct Wrapper<F> {
future: F,
}
impl<T: Future> Future for Wrapper<T> {
type Output = T::Output;
fn poll(self: Pin<&mut Self>, _: &mut std::task::Context<'_>) -> Poll<Self::Output> {
loop {}
}
}
pub async fn wrap_and_await<F>(future: F) -> F::Output
where
F: Future,
{
Wrapper { future }.await
}
use issue_116953::{wrap_and_await, Runtime};
#[no_mangle]
fn ice() {
Runtime {}.block_on(wrap_and_await(async {}))
}
fn main() {
ice()
} |
Since this seems to be somehow caused by mir drop tracking, cc @cjgillot. |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-high |
Rollup merge of rust-lang#118422 - tmiasko:mix, r=compiler-errors Fix coroutine validation for mixed panic strategy Validation introduced in rust-lang#113124 allows `UnwindAction::Continue` and `TerminatorKind::Resume` to occur only in functions with ABI that can unwind. The function ABI depends on the panic strategy, which can vary across crates. Usually MIR is built and validated in the same crate. The coroutine drop glue thus far was an exception. As a result validation could fail when mixing different panic strategies. Avoid the problem by executing `AbortUnwindingCalls` along with the validation. Fixes rust-lang#116953.
Code
Cargo.lock:
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: