Convert empty tuple to DefaultReturn in ty path
This commit is contained in:
parent
2f7b7d5f4a
commit
1c82e5ed9c
1 changed files with 8 additions and 1 deletions
|
@ -895,8 +895,15 @@ fn clean_fn_decl_from_did_and_sig(
|
|||
) -> FnDecl {
|
||||
let mut names = did.map_or(&[] as &[_], |did| cx.tcx.fn_arg_names(did)).iter();
|
||||
|
||||
// We assume all empty tuples are default return type. This theoretically can discard `-> ()`,
|
||||
// but shouldn't change any code meaning.
|
||||
let output = match sig.skip_binder().output().clean(cx) {
|
||||
Type::Tuple(inner) if inner.len() == 0 => DefaultReturn,
|
||||
ty => Return(ty),
|
||||
};
|
||||
|
||||
FnDecl {
|
||||
output: Return(sig.skip_binder().output().clean(cx)),
|
||||
output,
|
||||
c_variadic: sig.skip_binder().c_variadic,
|
||||
inputs: Arguments {
|
||||
values: sig
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue