about summary refs log tree commit diff
path: root/src/librustc_parse/parser/diagnostics.rs
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-11-07 11:26:36 +0100
committerMazdak Farrokhzad <twingoow@gmail.com>2019-11-11 06:33:09 +0100
commit9a88364525a4660dbd6f6a371b3b25199f5bbe4a (patch)
tree36a46f60d870ddf657e871e22f8b7ef4564d0fef /src/librustc_parse/parser/diagnostics.rs
parente2fa9527d44522b900c739cc82faa734f877bcda (diff)
downloadrust-9a88364525a4660dbd6f6a371b3b25199f5bbe4a.tar.gz
rust-9a88364525a4660dbd6f6a371b3b25199f5bbe4a.zip
syntactically allow visibility on trait item & enum variant
Diffstat (limited to 'src/librustc_parse/parser/diagnostics.rs')
-rw-r--r--src/librustc_parse/parser/diagnostics.rs20
1 files changed, 0 insertions, 20 deletions
diff --git a/src/librustc_parse/parser/diagnostics.rs b/src/librustc_parse/parser/diagnostics.rs
index 38eae008537..1b465f326c0 100644
--- a/src/librustc_parse/parser/diagnostics.rs
+++ b/src/librustc_parse/parser/diagnostics.rs
@@ -1187,26 +1187,6 @@ impl<'a> Parser<'a> {
         }
     }
 
-    /// Recovers from `pub` keyword in places where it seems _reasonable_ but isn't valid.
-    pub(super) fn eat_bad_pub(&mut self) {
-        // When `unclosed_delims` is populated, it means that the code being parsed is already
-        // quite malformed, which might mean that, for example, a pub struct definition could be
-        // parsed as being a trait item, which is invalid and this error would trigger
-        // unconditionally, resulting in misleading diagnostics. Because of this, we only attempt
-        // this nice to have recovery for code that is otherwise well formed.
-        if self.token.is_keyword(kw::Pub) && self.unclosed_delims.is_empty() {
-            match self.parse_visibility(false) {
-                Ok(vis) => {
-                    self.diagnostic()
-                        .struct_span_err(vis.span, "unnecessary visibility qualifier")
-                        .span_label(vis.span, "`pub` not permitted here")
-                        .emit();
-                }
-                Err(mut err) => err.emit(),
-            }
-        }
-    }
-
     /// Eats tokens until we can be relatively sure we reached the end of the
     /// statement. This is something of a best-effort heuristic.
     ///