about summary refs log tree commit diff
path: root/src/test/ui/iterators/iter-sum-overflow-overflow-checks.rs
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-06-11 19:04:16 +0200
committerGitHub <noreply@github.com>2020-06-11 19:04:16 +0200
commit84b9145076657579afb09c04b8653bf25b86f59d (patch)
tree5b93246b7a58dc3e138f34b3aead2a20633adf4d /src/test/ui/iterators/iter-sum-overflow-overflow-checks.rs
parentb34111591c6d70bb074e6812697b381048292c7b (diff)
parent9d36fa3d47b617930a8eb4a8a3a6c4db426cab45 (diff)
downloadrust-84b9145076657579afb09c04b8653bf25b86f59d.tar.gz
rust-84b9145076657579afb09c04b8653bf25b86f59d.zip
Rollup merge of #73182 - Aaron1011:feature/call-fn-span, r=matthewjasper
Track span of function in method calls, and use this in #[track_caller]

Fixes #69977

When we parse a chain of method calls like `foo.a().b().c()`, each
`MethodCallExpr` gets assigned a span that starts at the beginning of
the call chain (`foo`). While this is useful for diagnostics, it means
that `Location::caller` will return the same location for every call
in a call chain.

This PR makes us separately record the span of the function name and
arguments for a method call (e.g. `b()` in `foo.a().b().c()`). This
`Span` is passed through HIR lowering and MIR building to
`TerminatorKind::Call`, where it is used in preference to
`Terminator.source_info.span` when determining `Location::caller`.

This new span is also useful for diagnostics where we want to emphasize
a particular method call - for an example, see
https://github.com/rust-lang/rust/pull/72389#discussion_r436035990
Diffstat (limited to 'src/test/ui/iterators/iter-sum-overflow-overflow-checks.rs')
0 files changed, 0 insertions, 0 deletions