diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-04-30 17:48:18 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-04-30 17:48:18 -0700 |
| commit | a3aafea68fcb3a2e7026ab4a9e33e031f2b01821 (patch) | |
| tree | c0cbde1a2be363c8314cb9c2ed83bade3003d84f /src/libsyntax/parse/parser.rs | |
| parent | a55c2eb325029960991508e64650a139b040d24f (diff) | |
| download | rust-a3aafea68fcb3a2e7026ab4a9e33e031f2b01821.tar.gz rust-a3aafea68fcb3a2e7026ab4a9e33e031f2b01821.zip | |
Account for paths in incorrect pub qualifier help
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 8efe84cdf01..181acb74ebc 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -7276,7 +7276,9 @@ impl<'a> Parser<'a> { // `()` or a tuple might be allowed. For example, `struct Struct(pub (), pub (usize));`. // Because of this, we only `bump` the `(` if we're assured it is appropriate to do so // by the following tokens. - if self.look_ahead(1, |t| t.is_keyword(keywords::Crate)) { + if self.look_ahead(1, |t| t.is_keyword(keywords::Crate)) && + self.look_ahead(2, |t| t != &token::ModSep) // account for `pub(crate::foo)` + { // `pub(crate)` self.bump(); // `(` self.bump(); // `crate` @@ -7319,7 +7321,7 @@ impl<'a> Parser<'a> { `pub(super)`: visible only in the current module's parent `pub(in path::to::module)`: visible only on the specified path"##; let path = self.parse_path(PathStyle::Mod)?; - let sp = self.prev_span; + let sp = path.span; let help_msg = format!("make this visible only to module `{}` with `in`", path); self.expect(&token::CloseDelim(token::Paren))?; // `)` let mut err = struct_span_err!(self.sess.span_diagnostic, sp, E0704, "{}", msg); |
