Skip to content

Commit cc8ceb0

Browse files
committedNov 24, 2017
Auto merge of #46116 - oli-obk:json_ui, r=nikomatsakis
Check //~ERROR comments in ui tests r? @nikomatsakis cc #44844 @Phlosioneer @estebank @petrochenkov this depends on #46052 getting merged first (the commits are included in here) The relevant changes of this PR are c2f0af7 and 979269b
2 parents eb44c89 + 8c1f9ef commit cc8ceb0

File tree

671 files changed

+2224
-2125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

671 files changed

+2224
-2125
lines changed
 

‎src/librustc/session/mod.rs

+5-18
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,15 @@ impl Session {
355355

356356
/// Analogous to calling methods on the given `DiagnosticBuilder`, but
357357
/// deduplicates on lint ID, span (if any), and message for this `Session`
358-
/// if we're not outputting in JSON mode.
359358
fn diag_once<'a, 'b>(&'a self,
360359
diag_builder: &'b mut DiagnosticBuilder<'a>,
361360
method: DiagnosticBuilderMethod,
362361
lint: &'static lint::Lint, message: &str, span: Option<Span>) {
363-
let mut do_method = || {
362+
363+
let lint_id = DiagnosticMessageId::LintId(lint::LintId::of(lint));
364+
let id_span_message = (lint_id, span, message.to_owned());
365+
let fresh = self.one_time_diagnostics.borrow_mut().insert(id_span_message);
366+
if fresh {
364367
match method {
365368
DiagnosticBuilderMethod::Note => {
366369
diag_builder.note(message);
@@ -369,22 +372,6 @@ impl Session {
369372
diag_builder.span_note(span.expect("span_note expects a span"), message);
370373
}
371374
}
372-
};
373-
374-
match self.opts.error_format {
375-
// when outputting JSON for tool consumption, the tool might want
376-
// the duplicates
377-
config::ErrorOutputType::Json(_) => {
378-
do_method()
379-
},
380-
_ => {
381-
let lint_id = DiagnosticMessageId::LintId(lint::LintId::of(lint));
382-
let id_span_message = (lint_id, span, message.to_owned());
383-
let fresh = self.one_time_diagnostics.borrow_mut().insert(id_span_message);
384-
if fresh {
385-
do_method()
386-
}
387-
}
388375
}
389376
}
390377

‎src/test/compile-fail/issue-31221.rs

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
#![allow(non_snake_case)]
1414
#![deny(unreachable_patterns)]
1515
//~^ NOTE lint level defined here
16-
//~^^ NOTE lint level defined here
17-
//~^^^ NOTE lint level defined here
1816

1917
#[derive(Clone, Copy)]
2018
enum Enum {

0 commit comments

Comments
 (0)