about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2018-06-09 16:08:47 -0700
committerEsteban Küber <esteban@kuber.com.ar>2018-06-19 11:37:33 -0700
commitb3a1d56ebe34276916f34ffb0fed34d406f73c55 (patch)
tree45aafd8b33c78373e5def836df6eeb1560742133 /src/libsyntax/parse
parent09e42bcb10cf056213b1101648befa7d49d05e98 (diff)
downloadrust-b3a1d56ebe34276916f34ffb0fed34d406f73c55.tar.gz
rust-b3a1d56ebe34276916f34ffb0fed34d406f73c55.zip
Add code to incorrect `pub` restriction error
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index f38f4cc7137..afb0931f950 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -5986,12 +5986,13 @@ 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 path_span = self.prev_span;
+                let sp = self.prev_span;
                 let help_msg = format!("make this visible only to module `{}` with `in`", path);
                 self.expect(&token::CloseDelim(token::Paren))?;  // `)`
-                let mut err = self.span_fatal_help(path_span, msg, suggestion);
+                let mut err = struct_span_err!(self.sess.span_diagnostic, sp, E0698, "{}", msg);
+                err.help(suggestion);
                 err.span_suggestion_with_applicability(
-                    path_span, &help_msg, format!("in {}", path), Applicability::MachineApplicable
+                    sp, &help_msg, format!("in {}", path), Applicability::MachineApplicable
                 );
                 err.emit();  // emit diagnostic, but continue with public visibility
             }