help wantedneeds design
仓库指标
- 星标
- (4,472 个星标)
- PR 合并指标
- (平均合并 8分钟) (30 天内合并 3 个 PR)
描述
use anyhow::{anyhow, Result};
#[cxx::bridge]
mod ffi {
extern "C" {
include!("repro.h");
fn cthing() -> Result<()>;
}
extern "Rust" {
fn rustthing() -> Result<()>;
}
}
fn rustthing() -> Result<()> {
Err(anyhow!("no such file or directory").context("failed to open: /nonexist"))
}
fn main() -> Result<()> {
ffi::cthing()?;
Ok(())
}
// repro.cc
void cthing() {
rustthing();
}
This currently loses the cause chain and only prints:
Error: failed to open: /nonexist