1
Fork 0

Introduce proc_macro::Span::source_text

This commit is contained in:
Olivier Goffart 2018-11-08 10:07:02 +01:00
parent d48ab693d1
commit e88b0d9a94
5 changed files with 59 additions and 2 deletions

View file

@ -748,4 +748,7 @@ impl server::Span for Rustc<'_> {
fn resolved_at(&mut self, span: Self::Span, at: Self::Span) -> Self::Span {
span.with_ctxt(at.ctxt())
}
fn source_text(&mut self, span: Self::Span) -> Option<String> {
self.sess.source_map().span_to_snippet(span).ok()
}
}