about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-05-04 07:40:13 +0000
committerbors <bors@rust-lang.org>2019-05-04 07:40:13 +0000
commit2f1bc91803b04caf3e20b3849633bb7ffe6b4074 (patch)
tree0fe4a4b339119c497a066dca4c9229b3cbde56d7 /src/libsyntax/parse
parente2326366935613816927e679d3b2dc04db44678c (diff)
parent1599877c7e246dc7e7cca4830734bde7d93a3c1b (diff)
downloadrust-2f1bc91803b04caf3e20b3849633bb7ffe6b4074.tar.gz
rust-2f1bc91803b04caf3e20b3849633bb7ffe6b4074.zip
Auto merge of #60537 - Centril:rollup-42jxz82, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #60429 (Account for paths in incorrect pub qualifier help)
 - #60449 (Constrain all regions in the concrete type for an opaque type)
 - #60486 (Place related refactors)
 - #60513 (Remove -Z borrowck=compare flag)
 - #60516 (Remove TypeckMir)
 - #60517 (Reword casting message)
 - #60520 (Add rustfmt toml)
 - #60521 (Migrate tidy to rust 2018 edition)
 - #60527 (Fix async fn lowering ICE with APIT.)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index c5173aa5569..d46feeab335 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -7149,7 +7149,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`
@@ -7192,7 +7194,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);