Open
Description
Adding the no_mangle attribute to a function which contains an await results in a compilation error for armv7-linux-androideabi and aarch64-linux-android targets. Removing the attribute fixes the issue (though that's not a solution). There are no problems with x86_64-linux-android and i686-linux-android targets.
#![cfg(target_os = "android")]
#![allow(non_snake_case)]
use tokio::{runtime::Runtime };
#[no_mangle]
pub fn Java_blah_blah_func() -> &'static str {
Runtime::new().unwrap().block_on(async {
myfunc().await
})
}
async fn myfunc() -> &'static str {
"hello"
}
I expected to see this happen: library should get compiled successfully.
Instead, I get the following error:
Function return type does not match operand type of return inst!
ret i32 undef
{ i8*, i32 }in function _ZN80_$LT$std..future..GenFuture$LT$T$GT$$u20$as$u20$core..future..future..Future$GT$4poll17h2e6af84f5e832d75E
LLVM ERROR: Broken function found, compilation aborted!
Meta
The error exists in the beta and nightly versions. RUST_BACKTRACE=1 doesn't seem to add additional information.
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Async & AwaitAsync-await issues that have been triaged during a working group meeting.Category: This is a bug.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Operating system: AndroidMedium priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.