rust/src/librustc_passes
Dylan DPC 84b9145076
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
2020-06-11 19:04:16 +02:00
..
Cargo.toml Remove unused dependencies 2020-04-20 17:59:27 +09:00
check_attr.rs Mark query function as must_use. 2020-05-01 17:45:30 +02:00
check_const.rs Use hir::ConstContext instead of local enums 2020-05-07 11:28:55 -07:00
dead.rs Rollup merge of #71555 - cjgillot:nameless, r=matthewjasper 2020-05-09 13:36:39 +02:00
diagnostic_items.rs Use the query system to allocate. 2020-04-28 11:34:17 +02:00
entry.rs Use OnceCell instead of Once 2020-05-22 13:31:02 -07:00
hir_id_validator.rs librustc_middle: return LocalDefId instead of DefId in local_def_id 2020-04-23 23:14:07 +01:00
hir_stats.rs rustc -> rustc_middle part 3 (rustfmt) 2020-03-30 07:19:55 +02:00
intrinsicck.rs Fix more clippy warnings 2020-06-09 18:51:08 +02:00
lang_items.rs Use the query system to allocate. 2020-04-28 11:34:17 +02:00
layout_test.rs librustc_middle: return LocalDefId instead of DefId in local_def_id 2020-04-23 23:14:07 +01:00
lib.rs Dogfood more or_patterns in the compiler 2020-04-19 07:33:58 -07:00
lib_features.rs Use the query system to allocate. 2020-04-28 11:34:17 +02:00
liveness.rs Track span of function in method calls, and use this in #[track_caller] 2020-06-10 17:30:11 -04:00
loops.rs Allow unlabeled breaks from desugared ? in labeled blocks 2020-05-26 01:18:07 +05:30
reachable.rs Use OnceCell instead of Once 2020-05-22 13:31:02 -07:00
region.rs Fix clippy warnings 2020-05-11 17:13:32 +02:00
stability.rs Use the query system to allocate. 2020-04-28 11:34:17 +02:00
upvars.rs librustc_middle: Rename upvars query to upvars_mentioned 2020-05-24 14:36:39 -04:00
weak_lang_items.rs Use OnceCell instead of Once 2020-05-22 13:31:02 -07:00