Skip to content

Commit 693365c

Browse files
author
llesha
committed
rust-lang#3390: hide_parse_errors to show_parse_errors
1 parent 37489e4 commit 693365c

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/config/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ create_config! {
169169
"Enables unstable features. Only available on nightly channel";
170170
disable_all_formatting: bool, false, true, "Don't reformat anything";
171171
skip_children: bool, false, false, "Don't reformat out of line modules";
172-
hide_parse_errors: bool, false, false, "Hide errors from the parser";
172+
show_parse_errors: bool, true, true, "Show errors from the parser";
173+
hide_parse_errors: bool, false, false, "(deprecated: use show_parse_errors instead)";
173174
error_on_line_overflow: bool, false, false, "Error if unable to get all lines within max_width";
174175
error_on_unformatted: bool, false, false,
175176
"Error if unable to get comments or string literals within max_width, \

src/parse/session.rs

+13-3
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ fn default_handler(
122122
source_map: Lrc<SourceMap>,
123123
ignore_path_set: Lrc<IgnorePathSet>,
124124
can_reset: Lrc<AtomicBool>,
125-
hide_parse_errors: bool,
125+
show_parse_errors: bool,
126126
color: Color,
127127
) -> Handler {
128128
let supports_color = term::stderr().map_or(false, |term| term.supports_color());
@@ -132,7 +132,7 @@ fn default_handler(
132132
ColorConfig::Never
133133
};
134134

135-
let emitter = if hide_parse_errors {
135+
let emitter = if !show_parse_errors {
136136
silent_emitter()
137137
} else {
138138
let fallback_bundle = rustc_errors::fallback_fluent_bundle(
@@ -159,11 +159,21 @@ impl ParseSess {
159159
let source_map = Lrc::new(SourceMap::new(FilePathMapping::empty()));
160160
let can_reset_errors = Lrc::new(AtomicBool::new(false));
161161

162+
let show_parse_errors = if config.was_set().hide_parse_errors() {
163+
eprintln!(
164+
"Warning: the `hide_parse_errors` option is deprecated. \
165+
Use `show_parse_errors` instead"
166+
);
167+
config.hide_parse_errors()
168+
} else {
169+
config.show_parse_errors()
170+
};
171+
162172
let handler = default_handler(
163173
Lrc::clone(&source_map),
164174
Lrc::clone(&ignore_path_set),
165175
Lrc::clone(&can_reset_errors),
166-
config.hide_parse_errors(),
176+
show_parse_errors,
167177
config.color(),
168178
);
169179
let parse_sess = RawParseSess::with_span_handler(handler, source_map);

0 commit comments

Comments
 (0)