diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-06-03 12:07:51 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-06-05 07:43:15 +1000 |
| commit | dc807a9f7ec02d425b4e3350a87b29f6cf7fa4ff (patch) | |
| tree | 05a0bcdc93c8c3ed0ff0d1b95da645b38e2b5f19 /src/librustc_codegen_ssa/mir | |
| parent | 6596743d5e710e69d88f9522a207f41731177ef0 (diff) | |
| download | rust-dc807a9f7ec02d425b4e3350a87b29f6cf7fa4ff.tar.gz rust-dc807a9f7ec02d425b4e3350a87b29f6cf7fa4ff.zip | |
Add `walk_chain`.
This combines multiple `HygieneData::with` calls on a hot path.
Diffstat (limited to 'src/librustc_codegen_ssa/mir')
| -rw-r--r-- | src/librustc_codegen_ssa/mir/mod.rs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index 1d40d004e2d..dd69d358313 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -128,14 +128,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // Walk up the macro expansion chain until we reach a non-expanded span. // We also stop at the function body level because no line stepping can occur // at the level above that. - let mut span = source_info.span; - while span.ctxt() != NO_EXPANSION && span.ctxt() != self.mir.span.ctxt() { - if let Some(info) = span.ctxt().outer_expn_info() { - span = info.call_site; - } else { - break; - } - } + let span = syntax_pos::hygiene::walk_chain(source_info.span, self.mir.span.ctxt()); let scope = self.scope_metadata_for_loc(source_info.scope, span.lo()); // Use span of the outermost expansion site, while keeping the original lexical scope. (scope, span) |
