Rollup merge of #132243 - compiler-errors:no-span, r=jieyouxu
Remove `ObligationCause::span()` method I think it's an incredibly confusing footgun to expose both `obligation_cause.span` and `obligation_cause.span()`. Especially because `ObligationCause::span()` (the method) seems to just be hacking around a single quirk in the way we set up obligation causes for match arms. First commit removes the need for that hack, with only one diagnostic span changing (but IMO not really getting worse -- I'd argue that it was already confusing).
This commit is contained in:
commit
3e3feac7c3
12 changed files with 38 additions and 46 deletions
|
@ -611,7 +611,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
|
|||
Err(terr) => {
|
||||
let mut diag = struct_span_code_err!(
|
||||
tcx.dcx(),
|
||||
cause.span(),
|
||||
cause.span,
|
||||
E0053,
|
||||
"method `{}` has an incompatible return type for trait",
|
||||
trait_m.name
|
||||
|
@ -1169,7 +1169,7 @@ fn extract_spans_for_error_reporting<'tcx>(
|
|||
TypeError::ArgumentMutability(i) | TypeError::ArgumentSorts(ExpectedFound { .. }, i) => {
|
||||
(impl_args.nth(i).unwrap(), trait_args.and_then(|mut args| args.nth(i)))
|
||||
}
|
||||
_ => (cause.span(), tcx.hir().span_if_local(trait_m.def_id)),
|
||||
_ => (cause.span, tcx.hir().span_if_local(trait_m.def_id)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -612,7 +612,7 @@ pub fn check_function_signature<'tcx>(
|
|||
match err {
|
||||
TypeError::ArgumentMutability(i)
|
||||
| TypeError::ArgumentSorts(ExpectedFound { .. }, i) => args.nth(i).unwrap(),
|
||||
_ => cause.span(),
|
||||
_ => cause.span,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue