File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -670,12 +670,14 @@ fn expand_rust_function_shim_super(
670
670
let args = sig. args . iter ( ) . map ( |arg| quote ! ( #arg) ) ;
671
671
let all_args = receiver. chain ( args) ;
672
672
673
- let ret = if sig. throws {
673
+ let ret = if let Some ( ( result , _langle , rangle ) ) = sig. throws_tokens {
674
674
let ok = match & sig. ret {
675
675
Some ( ret) => quote ! ( #ret) ,
676
676
None => quote ! ( ( ) ) ,
677
677
} ;
678
- quote ! ( -> :: std:: result:: Result <#ok, impl :: std:: fmt:: Display >)
678
+ let impl_trait = quote_spanned ! ( result. span=> impl ) ;
679
+ let display = quote_spanned ! ( rangle. span=> :: std:: fmt:: Display ) ;
680
+ quote ! ( -> :: std:: result:: Result <#ok, #impl_trait #display>)
679
681
} else {
680
682
expand_return_type ( & sig. ret )
681
683
} ;
Original file line number Diff line number Diff line change 1
1
error[E0277]: `NonError` doesn't implement `std::fmt::Display`
2
- --> $DIR/result_no_display.rs:1:1
2
+ --> $DIR/result_no_display.rs:4:19
3
3
|
4
- 1 | #[cxx::bridge]
5
- | ^^^^ ^^^^^^^^^^ `NonError` cannot be formatted with the default formatter
4
+ 4 | fn f() -> Result<()>;
5
+ | ^^^^^^^^^^ `NonError` cannot be formatted with the default formatter
6
6
|
7
7
= help: the trait `std::fmt::Display` is not implemented for `NonError`
8
8
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
You can’t perform that action at this time.
0 commit comments