diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-11-13 13:01:43 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-03-10 07:26:27 +0100 |
| commit | fd302f46dcf80cc23358f0f31744d6083a6997c1 (patch) | |
| tree | 6326d28eabeb638888eaa5e4a392f45f3af07af4 /src/librustc_errors | |
| parent | 3dbade652ed8ebac70f903e01f51cd92c4e4302c (diff) | |
Store `TokenStream` in `rmeta::MacroDef`.
This removes a hack from `load_macro_untracked` in which parsing is used.
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/emitter.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index eb9d4b887ad..b38ea6b4241 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -414,8 +414,8 @@ pub trait Emitter { } // This does a small "fix" for multispans by looking to see if it can find any that - // point directly at <*macros>. Since these are often difficult to read, this - // will change the span to point at the use site. + // point directly at external macros. Since these are often difficult to read, + // this will change the span to point at the use site. fn fix_multispans_in_extern_macros( &self, source_map: &Option<Lrc<SourceMap>>, @@ -427,9 +427,9 @@ pub trait Emitter { } } - // This "fixes" MultiSpans that contain Spans that are pointing to locations inside of - // <*macros>. Since these locations are often difficult to read, we move these Spans from - // <*macros> to their corresponding use site. + // This "fixes" MultiSpans that contain `Span`s pointing to locations inside of external macros. + // Since these locations are often difficult to read, + // we move these spans from the external macros to their corresponding use site. fn fix_multispan_in_extern_macros( &self, source_map: &Option<Lrc<SourceMap>>, @@ -440,14 +440,14 @@ pub trait Emitter { None => return, }; - // First, find all the spans in <*macros> and point instead at their use site + // First, find all the spans in external macros and point instead at their use site. let replacements: Vec<(Span, Span)> = span .primary_spans() .iter() .copied() .chain(span.span_labels().iter().map(|sp_label| sp_label.span)) .filter_map(|sp| { - if !sp.is_dummy() && sm.span_to_filename(sp).is_macros() { + if !sp.is_dummy() && sm.is_imported(sp) { let maybe_callsite = sp.source_callsite(); if sp != maybe_callsite { return Some((sp, maybe_callsite)); @@ -457,7 +457,7 @@ pub trait Emitter { }) .collect(); - // After we have them, make sure we replace these 'bad' def sites with their use sites + // After we have them, make sure we replace these 'bad' def sites with their use sites. for (from, to) in replacements { span.replace(from, to); } |
