@@ -23,7 +23,7 @@ use codemap::{CodeMap, FilePathMapping};
23
23
use syntax_pos:: { self , MacroBacktrace , Span , SpanLabel , MultiSpan } ;
24
24
use errors:: registry:: Registry ;
25
25
use errors:: { DiagnosticBuilder , SubDiagnostic , CodeSuggestion , CodeMapper } ;
26
- use errors:: DiagnosticId ;
26
+ use errors:: { DiagnosticId , Applicability } ;
27
27
use errors:: emitter:: { Emitter , EmitterWriter } ;
28
28
29
29
use rustc_data_structures:: sync:: { self , Lrc } ;
@@ -39,21 +39,21 @@ pub struct JsonEmitter {
39
39
cm : Lrc < CodeMapper + sync:: Send + sync:: Sync > ,
40
40
pretty : bool ,
41
41
/// Whether "approximate suggestions" are enabled in the config
42
- approximate_suggestions : bool ,
42
+ suggestion_applicability : bool ,
43
43
ui_testing : bool ,
44
44
}
45
45
46
46
impl JsonEmitter {
47
47
pub fn stderr ( registry : Option < Registry > ,
48
48
code_map : Lrc < CodeMap > ,
49
49
pretty : bool ,
50
- approximate_suggestions : bool ) -> JsonEmitter {
50
+ suggestion_applicability : bool ) -> JsonEmitter {
51
51
JsonEmitter {
52
52
dst : Box :: new ( io:: stderr ( ) ) ,
53
53
registry,
54
54
cm : code_map,
55
55
pretty,
56
- approximate_suggestions ,
56
+ suggestion_applicability ,
57
57
ui_testing : false ,
58
58
}
59
59
}
@@ -68,13 +68,13 @@ impl JsonEmitter {
68
68
registry : Option < Registry > ,
69
69
code_map : Lrc < CodeMap > ,
70
70
pretty : bool ,
71
- approximate_suggestions : bool ) -> JsonEmitter {
71
+ suggestion_applicability : bool ) -> JsonEmitter {
72
72
JsonEmitter {
73
73
dst,
74
74
registry,
75
75
cm : code_map,
76
76
pretty,
77
- approximate_suggestions ,
77
+ suggestion_applicability ,
78
78
ui_testing : false ,
79
79
}
80
80
}
@@ -138,7 +138,7 @@ struct DiagnosticSpan {
138
138
suggested_replacement : Option < String > ,
139
139
/// If the suggestion is approximate
140
140
#[ rustc_serialize_exclude_null]
141
- suggestion_approximate : Option < bool > ,
141
+ suggestion_applicability : Option < Applicability > ,
142
142
/// Macro invocations that created the code at this span, if any.
143
143
expansion : Option < Box < DiagnosticSpanMacroExpansion > > ,
144
144
}
@@ -239,7 +239,7 @@ impl Diagnostic {
239
239
240
240
impl DiagnosticSpan {
241
241
fn from_span_label ( span : SpanLabel ,
242
- suggestion : Option < ( & String , bool ) > ,
242
+ suggestion : Option < ( & String , Applicability ) > ,
243
243
je : & JsonEmitter )
244
244
-> DiagnosticSpan {
245
245
Self :: from_span_etc ( span. span ,
@@ -252,7 +252,7 @@ impl DiagnosticSpan {
252
252
fn from_span_etc ( span : Span ,
253
253
is_primary : bool ,
254
254
label : Option < String > ,
255
- suggestion : Option < ( & String , bool ) > ,
255
+ suggestion : Option < ( & String , Applicability ) > ,
256
256
je : & JsonEmitter )
257
257
-> DiagnosticSpan {
258
258
// obtain the full backtrace from the `macro_backtrace`
@@ -272,7 +272,7 @@ impl DiagnosticSpan {
272
272
fn from_span_full ( span : Span ,
273
273
is_primary : bool ,
274
274
label : Option < String > ,
275
- suggestion : Option < ( & String , bool ) > ,
275
+ suggestion : Option < ( & String , Applicability ) > ,
276
276
mut backtrace : vec:: IntoIter < MacroBacktrace > ,
277
277
je : & JsonEmitter )
278
278
-> DiagnosticSpan {
@@ -301,7 +301,7 @@ impl DiagnosticSpan {
301
301
} )
302
302
} ) ;
303
303
304
- let suggestion_approximate = if je. approximate_suggestions {
304
+ let suggestion_applicability = if je. suggestion_applicability {
305
305
suggestion. map ( |x| x. 1 )
306
306
} else {
307
307
None
@@ -318,7 +318,7 @@ impl DiagnosticSpan {
318
318
is_primary,
319
319
text : DiagnosticSpanLine :: from_span ( span, je) ,
320
320
suggested_replacement : suggestion. map ( |x| x. 0 . clone ( ) ) ,
321
- suggestion_approximate ,
321
+ suggestion_applicability ,
322
322
expansion : backtrace_step,
323
323
label,
324
324
}
@@ -344,7 +344,7 @@ impl DiagnosticSpan {
344
344
} ;
345
345
DiagnosticSpan :: from_span_label ( span_label,
346
346
Some ( ( & suggestion_inner. snippet ,
347
- suggestion. approximate ) ) ,
347
+ suggestion. applicability ) ) ,
348
348
je)
349
349
} )
350
350
} )
0 commit comments