Rollup merge of #114434 - Nilstrieb:indexing-spans, r=est31
Improve spans for indexing expressions fixes #114388 Indexing is similar to method calls in having an arbitrary left-hand-side and then something on the right, which is the main part of the expression. Method calls already have a span for that right part, but indexing does not. This means that long method chains that use indexing have really bad spans, especially when the indexing panics and that span in coverted into a panic location. This does the same thing as method calls for the AST and HIR, storing an extra span which is then put into the `fn_span` field in THIR. r? compiler-errors
This commit is contained in:
commit
99e4127d85
82 changed files with 192 additions and 149 deletions
|
@ -2854,7 +2854,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
err.note("all local variables must have a statically known size");
|
||||
}
|
||||
Some(Node::Local(hir::Local {
|
||||
init: Some(hir::Expr { kind: hir::ExprKind::Index(_, _), span, .. }),
|
||||
init: Some(hir::Expr { kind: hir::ExprKind::Index(..), span, .. }),
|
||||
..
|
||||
})) => {
|
||||
// When encountering an assignment of an unsized trait, like
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue