diff options
| author | bors <bors@rust-lang.org> | 2018-02-23 11:21:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-02-23 11:21:29 +0000 |
| commit | 063deba92e44809125a433ca6e6c1ad0993313bf (patch) | |
| tree | 95ff2922a9ae38b3059361343514e920f2931a4d /src/libsyntax/diagnostics/plugin.rs | |
| parent | 928435305ad1d778d7c4d2c2ff989c6a87be0223 (diff) | |
| parent | 8e9fa57055a083ebc2378d855514166e3ec7a566 (diff) | |
| download | rust-063deba92e44809125a433ca6e6c1ad0993313bf.tar.gz rust-063deba92e44809125a433ca6e6c1ad0993313bf.zip | |
Auto merge of #47799 - topecongiro:fix-span-of-visibility, r=petrochenkov
Fix span of visibility This PR 1. adds a closing parenthesis to the span of `Visibility::Crate` (e.g. `pub(crate)`). The current span only covers `pub(crate`. 2. adds a `span` field to `Visibility::Restricted`. This span covers the entire visibility expression (e.g. `pub (in self)`). Currently all we can have is a span for `Path`. This PR is motivated by the bug found in rustfmt (https://github.com/rust-lang-nursery/rustfmt/issues/2398). The first change is a strict improvement IMHO. The second change may not be desirable, as it adds a field which is currently not used by the compiler.
Diffstat (limited to 'src/libsyntax/diagnostics/plugin.rs')
| -rw-r--r-- | src/libsyntax/diagnostics/plugin.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 5224f52c496..dd27dea4f0d 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -14,6 +14,7 @@ use std::env; use ast; use ast::{Ident, Name}; +use codemap; use syntax_pos::Span; use ext::base::{ExtCtxt, MacEager, MacResult}; use ext::build::AstBuilder; @@ -234,7 +235,7 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt, ty, expr, ), - vis: ast::Visibility::Public, + vis: codemap::respan(span.empty(), ast::VisibilityKind::Public), span, tokens: None, }) |
