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/parse/mod.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/parse/mod.rs')
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index b671f81c2a8..06eb64e157c 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -664,7 +664,7 @@ pub fn integer_lit(s: &str, suffix: Option<Symbol>, diag: Option<(Span, &Handler mod tests { use super::*; use syntax_pos::{self, Span, BytePos, Pos, NO_EXPANSION}; - use codemap::Spanned; + use codemap::{respan, Spanned}; use ast::{self, Ident, PatKind}; use abi::Abi; use attr::first_attr_value_str_by_name; @@ -932,7 +932,7 @@ mod tests { span: sp(15,21), recovered: false, })), - vis: ast::Visibility::Inherited, + vis: respan(sp(0, 0), ast::VisibilityKind::Inherited), span: sp(0,21)}))); } |
