Rollup merge of #116296 - compiler-errors:default-return, r=estebank
More accurately point to where default return type should go When getting the "default return type" span, instead of pointing to the low span of the next token, point to the high span of the previous token. This: 1. Makes forming return type suggestions more uniform, since we expect them all in the same place. 2. Arguably makes labels easier to understand, since we're pointing to where the implicit `-> ()` would've gone, rather than the starting brace or the semicolon. r? ```@estebank```
This commit is contained in:
commit
cfce3a919d
42 changed files with 105 additions and 89 deletions
|
@ -1189,7 +1189,7 @@ fn report_trait_method_mismatch<'tcx>(
|
|||
let ap = Applicability::MachineApplicable;
|
||||
match sig.decl.output {
|
||||
hir::FnRetTy::DefaultReturn(sp) => {
|
||||
let sugg = format!("-> {} ", trait_sig.output());
|
||||
let sugg = format!(" -> {}", trait_sig.output());
|
||||
diag.span_suggestion_verbose(sp, msg, sugg, ap);
|
||||
}
|
||||
hir::FnRetTy::Return(hir_ty) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue