From 395f23c9f7c7e1107dce5a05e71b3a9480d4e331 Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Thu, 2 Feb 2017 16:23:27 +1300 Subject: [PATCH] save-analysis: be more paranoid about generated paths fixes https://github.com/rust-lang-nursery/rls/issues/160 --- src/librustc_save_analysis/lib.rs | 3 +++ src/libsyntax/parse/parser.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 8d0cdd1678c73..ebb33a12c8703 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -430,6 +430,9 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { -> Option { self.lookup_ref_id(trait_ref.ref_id).and_then(|def_id| { let span = trait_ref.path.span; + if generated_code(span) { + return None; + } let sub_span = self.span_utils.sub_span_for_type_name(span).or(Some(span)); filter!(self.span_utils, sub_span, span, None); Some(TypeRefData { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 3480db8ec3b7d..d2bc7bf4f4810 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1693,6 +1693,7 @@ impl<'a> Parser<'a> { } // Assemble the span. + // FIXME(#39450) This is bogus if part of the path is macro generated. let span = mk_sp(lo, self.prev_span.hi); // Assemble the result.