Skip to content

Commit 9e2f590

Browse files
committed
Add ui test of returning a non-displayable error
1 parent 22f5ff7 commit 9e2f590

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

tests/ui/result_no_display.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#[cxx::bridge]
2+
mod ffi {
3+
extern "Rust" {
4+
fn f() -> Result<()>;
5+
}
6+
}
7+
8+
pub struct NonError;
9+
10+
fn f() -> Result<(), NonError> {
11+
Ok(())
12+
}
13+
14+
fn main() {}

tests/ui/result_no_display.stderr

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0277]: `NonError` doesn't implement `std::fmt::Display`
2+
--> $DIR/result_no_display.rs:1:1
3+
|
4+
1 | #[cxx::bridge]
5+
| ^^^^^^^^^^^^^^ `NonError` cannot be formatted with the default formatter
6+
|
7+
::: $WORKSPACE/src/result.rs
8+
|
9+
| E: Display,
10+
| ------- required by this bound in `cxx::private::r#try`
11+
|
12+
= help: the trait `std::fmt::Display` is not implemented for `NonError`
13+
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
14+
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

0 commit comments

Comments
 (0)