save-analysis: be even more aggressive about ignorning macro-generated defs

This commit is contained in:
Nick Cameron 2018-11-14 10:56:45 +13:00
parent 5c9f7dcd83
commit 547ac5ef0a
2 changed files with 8 additions and 10 deletions

View File

@ -658,11 +658,13 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
impl_items: &'l [ast::ImplItem],
) {
if let Some(impl_data) = self.save_ctxt.get_item_data(item) {
if let super::Data::RelationData(rel, imp) = impl_data {
self.dumper.dump_relation(rel);
self.dumper.dump_impl(imp);
} else {
span_bug!(item.span, "unexpected data kind: {:?}", impl_data);
if !self.span.filter_generated(item.span) {
if let super::Data::RelationData(rel, imp) = impl_data {
self.dumper.dump_relation(rel);
self.dumper.dump_impl(imp);
} else {
span_bug!(item.span, "unexpected data kind: {:?}", impl_data);
}
}
}
self.visit_ty(&typ);

View File

@ -124,14 +124,10 @@ impl<'a> SpanUtils<'a> {
/// Used to filter out spans of minimal value,
/// such as references to macro internal variables.
pub fn filter_generated(&self, span: Span) -> bool {
if span.is_dummy() {
if generated_code(span) {
return true;
}
if !generated_code(span) {
return false;
}
//If the span comes from a fake source_file, filter it.
!self.sess
.source_map()