Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions macro/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1127,9 +1127,11 @@ fn expand_rust_function_shim_super(
Some(ret) => quote!(#ret),
None => quote!(()),
};
let impl_trait = quote_spanned!(result.span=> impl);
let display = quote_spanned!(rangle.span=> ::std::fmt::Display);
quote!(-> ::std::result::Result<#ok, #impl_trait #display>)
// Set spans that result in the `Result<...>` written by the user being
// highlighted as the cause if their error type has no Display impl.
let result_begin = quote_spanned!(result.span=> ::std::result::Result<#ok, impl);
let result_end = quote_spanned!(rangle.span=> ::std::fmt::Display>);
quote!(-> #result_begin #result_end)
} else {
expand_return_type(&sig.ret)
};
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/array_len_suffix.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ error[E0308]: mismatched types
help: change the type of the numeric literal from `u16` to `usize`
|
4 | fn array() -> [String; 12usize];
| ^^^^^^^
| ~~~~~~~
2 changes: 1 addition & 1 deletion tests/ui/expected_named.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ error[E0106]: missing lifetime specifier
help: consider using the `'static` lifetime
|
5 | fn borrowed() -> UniquePtr<Borrowed<'static>>;
| ^^^^^^^^^^^^^^^^^
| ~~~~~~~~~~~~~~~~~
2 changes: 1 addition & 1 deletion tests/ui/unsupported_elided.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ error[E0106]: missing lifetime specifier
help: consider introducing a named lifetime parameter
|
8 | fn f<'a>(t: &'a T) -> &'a str;
| ^^^^ ^^^^^ ^^^
| ++++ ~~~~~ ~~~