@@ -12,7 +12,7 @@ use rustc_span::{ErrorGuaranteed, InnerSpan, Span, Symbol, sym};
1212use rustc_target:: asm:: InlineAsmArch ;
1313use smallvec:: smallvec;
1414
15- use crate :: errors ;
15+ use crate :: diagnostics ;
1616use crate :: util:: { ExprToSpannedString , expr_to_spanned_string} ;
1717
1818/// Validated assembly arguments, ready for macro expansion.
@@ -65,7 +65,7 @@ fn validate_asm_args<'a>(
6565 for arg in args {
6666 for attr in arg. attributes . 0 . iter ( ) {
6767 if !matches ! ( attr. name( ) , Some ( sym:: cfg | sym:: cfg_attr) ) {
68- ecx. dcx ( ) . emit_err ( errors :: AsmAttributeNotSupported { span : attr. span ( ) } ) ;
68+ ecx. dcx ( ) . emit_err ( diagnostics :: AsmAttributeNotSupported { span : attr. span ( ) } ) ;
6969 }
7070 }
7171
@@ -86,7 +86,7 @@ fn validate_asm_args<'a>(
8686 ) => { }
8787 ast:: ExprKind :: MacCall ( ..) => { }
8888 _ => {
89- let err = dcx. create_err ( errors :: AsmExpectedOther {
89+ let err = dcx. create_err ( diagnostics :: AsmExpectedOther {
9090 span : template. span ,
9191 is_inline_asm : matches ! ( asm_macro, AsmMacro :: Asm ) ,
9292 } ) ;
@@ -111,12 +111,12 @@ fn validate_asm_args<'a>(
111111
112112 if explicit_reg {
113113 if name. is_some ( ) {
114- dcx. emit_err ( errors :: AsmExplicitRegisterName { span } ) ;
114+ dcx. emit_err ( diagnostics :: AsmExplicitRegisterName { span } ) ;
115115 }
116116 validated. reg_args . insert ( slot) ;
117117 } else if let Some ( name) = name {
118118 if let Some ( & prev) = validated. named_args . get ( & name) {
119- dcx. emit_err ( errors :: AsmDuplicateArg {
119+ dcx. emit_err ( diagnostics :: AsmDuplicateArg {
120120 span,
121121 name,
122122 prev : validated. operands [ prev] . 1 ,
@@ -130,7 +130,7 @@ fn validate_asm_args<'a>(
130130 let explicit =
131131 validated. reg_args . iter ( ) . map ( |p| validated. operands [ p] . 1 ) . collect ( ) ;
132132
133- dcx. emit_err ( errors :: AsmPositionalAfter { span, named, explicit } ) ;
133+ dcx. emit_err ( diagnostics :: AsmPositionalAfter { span, named, explicit } ) ;
134134 }
135135 }
136136 AsmArgKind :: Options ( new_options) => {
@@ -141,15 +141,15 @@ fn validate_asm_args<'a>(
141141
142142 if !asm_macro. is_supported_option ( options) {
143143 // Tool-only output.
144- dcx. emit_err ( errors :: AsmUnsupportedOption {
144+ dcx. emit_err ( diagnostics :: AsmUnsupportedOption {
145145 span,
146146 symbol,
147147 span_with_comma,
148148 macro_name : asm_macro. macro_name ( ) ,
149149 } ) ;
150150 } else if validated. options . contains ( options) {
151151 // Tool-only output.
152- dcx. emit_err ( errors :: AsmOptAlreadyprovided {
152+ dcx. emit_err ( diagnostics :: AsmOptAlreadyprovided {
153153 span,
154154 symbol,
155155 span_with_comma,
@@ -178,21 +178,21 @@ fn validate_asm_args<'a>(
178178 && validated. options . contains ( ast:: InlineAsmOptions :: READONLY )
179179 {
180180 let spans = validated. options_spans . clone ( ) ;
181- dcx. emit_err ( errors :: AsmMutuallyExclusive { spans, opt1 : "nomem" , opt2 : "readonly" } ) ;
181+ dcx. emit_err ( diagnostics :: AsmMutuallyExclusive { spans, opt1 : "nomem" , opt2 : "readonly" } ) ;
182182 }
183183 if validated. options . contains ( ast:: InlineAsmOptions :: PURE )
184184 && validated. options . contains ( ast:: InlineAsmOptions :: NORETURN )
185185 {
186186 let spans = validated. options_spans . clone ( ) ;
187- dcx. emit_err ( errors :: AsmMutuallyExclusive { spans, opt1 : "pure" , opt2 : "noreturn" } ) ;
187+ dcx. emit_err ( diagnostics :: AsmMutuallyExclusive { spans, opt1 : "pure" , opt2 : "noreturn" } ) ;
188188 }
189189 if validated. options . contains ( ast:: InlineAsmOptions :: PURE )
190190 && !validated
191191 . options
192192 . intersects ( ast:: InlineAsmOptions :: NOMEM | ast:: InlineAsmOptions :: READONLY )
193193 {
194194 let spans = validated. options_spans . clone ( ) ;
195- dcx. emit_err ( errors :: AsmPureCombine { spans } ) ;
195+ dcx. emit_err ( diagnostics :: AsmPureCombine { spans } ) ;
196196 }
197197
198198 let mut have_real_output = false ;
@@ -223,24 +223,24 @@ fn validate_asm_args<'a>(
223223 }
224224 }
225225 if validated. options . contains ( ast:: InlineAsmOptions :: PURE ) && !have_real_output {
226- dcx. emit_err ( errors :: AsmPureNoOutput { spans : validated. options_spans . clone ( ) } ) ;
226+ dcx. emit_err ( diagnostics :: AsmPureNoOutput { spans : validated. options_spans . clone ( ) } ) ;
227227 }
228228 if validated. options . contains ( ast:: InlineAsmOptions :: NORETURN )
229229 && !outputs_sp. is_empty ( )
230230 && labels_sp. is_empty ( )
231231 {
232- let err = dcx. create_err ( errors :: AsmNoReturn { outputs_sp } ) ;
232+ let err = dcx. create_err ( diagnostics :: AsmNoReturn { outputs_sp } ) ;
233233 // Bail out now since this is likely to confuse MIR
234234 return Err ( err) ;
235235 }
236236 if validated. options . contains ( ast:: InlineAsmOptions :: MAY_UNWIND ) && !labels_sp. is_empty ( ) {
237- dcx. emit_err ( errors :: AsmMayUnwind { labels_sp } ) ;
237+ dcx. emit_err ( diagnostics :: AsmMayUnwind { labels_sp } ) ;
238238 }
239239
240240 if !validated. clobber_abis . is_empty ( ) {
241241 match asm_macro {
242242 AsmMacro :: GlobalAsm | AsmMacro :: NakedAsm => {
243- let err = dcx. create_err ( errors :: AsmUnsupportedClobberAbi {
243+ let err = dcx. create_err ( diagnostics :: AsmUnsupportedClobberAbi {
244244 spans : validated. clobber_abis . iter ( ) . map ( |( _, span) | * span) . collect ( ) ,
245245 macro_name : asm_macro. macro_name ( ) ,
246246 } ) ;
@@ -250,7 +250,7 @@ fn validate_asm_args<'a>(
250250 }
251251 AsmMacro :: Asm => {
252252 if !regclass_outputs. is_empty ( ) {
253- dcx. emit_err ( errors :: AsmClobberNoReg {
253+ dcx. emit_err ( diagnostics :: AsmClobberNoReg {
254254 spans : regclass_outputs,
255255 clobbers : validated. clobber_abis . iter ( ) . map ( |( _, span) | * span) . collect ( ) ,
256256 } ) ;
@@ -354,15 +354,15 @@ fn expand_preparsed_asm(
354354 lint:: builtin:: BAD_ASM_STYLE ,
355355 find_span ( ".intel_syntax" ) ,
356356 ecx. current_expansion . lint_node_id ,
357- errors :: AvoidIntelSyntax ,
357+ diagnostics :: AvoidIntelSyntax ,
358358 ) ;
359359 }
360360 if template_str. contains ( ".att_syntax" ) {
361361 ecx. psess ( ) . buffer_lint (
362362 lint:: builtin:: BAD_ASM_STYLE ,
363363 find_span ( ".att_syntax" ) ,
364364 ecx. current_expansion . lint_node_id ,
365- errors :: AvoidAttSyntax ,
365+ diagnostics :: AvoidAttSyntax ,
366366 ) ;
367367 }
368368 }
@@ -482,7 +482,7 @@ fn expand_preparsed_asm(
482482 None => {
483483 let span = arg. position_span ;
484484 ecx. dcx ( )
485- . create_err ( errors :: AsmNoMatchedArgumentName {
485+ . create_err ( diagnostics :: AsmNoMatchedArgumentName {
486486 name : name. to_owned ( ) ,
487487 span : span_in_template ( span) ,
488488 } )
@@ -497,7 +497,7 @@ fn expand_preparsed_asm(
497497 let mut modifier = chars. next ( ) ;
498498 if chars. next ( ) . is_some ( ) {
499499 let span = arg. format . ty_span . map ( span_in_template) . unwrap_or ( template_sp) ;
500- ecx. dcx ( ) . emit_err ( errors :: AsmModifierInvalid { span } ) ;
500+ ecx. dcx ( ) . emit_err ( diagnostics :: AsmModifierInvalid { span } ) ;
501501 modifier = None ;
502502 }
503503
0 commit comments