@@ -39,7 +39,7 @@ use rustc_span::{DUMMY_SP, Ident, Span, Symbol, sym};
3939use rustc_target:: spec:: { PanicStrategy , Target } ;
4040use tracing:: { debug, info, trace} ;
4141
42- use crate :: errors ;
42+ use crate :: diagnostics ;
4343use crate :: locator:: { CrateError , CrateLocator , CratePaths , CrateRejections } ;
4444use crate :: rmeta:: {
4545 CrateDep , CrateMetadata , CrateNumMap , CrateRoot , MetadataBlob , TargetModifiers ,
@@ -365,7 +365,7 @@ impl CStore {
365365
366366 match ( flag_local_value, flag_extern_value) {
367367 ( Some ( local_value) , Some ( extern_value) ) => {
368- tcx. dcx ( ) . emit_err ( errors :: IncompatibleTargetModifiers {
368+ tcx. dcx ( ) . emit_err ( diagnostics :: IncompatibleTargetModifiers {
369369 span,
370370 extern_crate,
371371 local_crate,
@@ -376,7 +376,7 @@ impl CStore {
376376 } )
377377 }
378378 ( None , Some ( extern_value) ) => {
379- tcx. dcx ( ) . emit_err ( errors :: IncompatibleTargetModifiersLMissed {
379+ tcx. dcx ( ) . emit_err ( diagnostics :: IncompatibleTargetModifiersLMissed {
380380 span,
381381 extern_crate,
382382 local_crate,
@@ -386,7 +386,7 @@ impl CStore {
386386 } )
387387 }
388388 ( Some ( local_value) , None ) => {
389- tcx. dcx ( ) . emit_err ( errors :: IncompatibleTargetModifiersRMissed {
389+ tcx. dcx ( ) . emit_err ( diagnostics :: IncompatibleTargetModifiersRMissed {
390390 span,
391391 extern_crate,
392392 local_crate,
@@ -458,7 +458,7 @@ impl CStore {
458458 pub fn report_incompatible_target_modifiers ( & self , tcx : TyCtxt < ' _ > , krate : & Crate ) {
459459 for flag_name in & tcx. sess . opts . cg . unsafe_allow_abi_mismatch {
460460 if !OptionsTargetModifiers :: is_target_modifier ( flag_name) {
461- tcx. dcx ( ) . emit_err ( errors :: UnknownTargetModifierUnsafeAllowed {
461+ tcx. dcx ( ) . emit_err ( diagnostics :: UnknownTargetModifierUnsafeAllowed {
462462 span : krate. spans . inner_span . shrink_to_lo ( ) ,
463463 flag_name : flag_name. clone ( ) ,
464464 } ) ;
@@ -502,7 +502,7 @@ impl CStore {
502502 }
503503 * errors += 1 ;
504504
505- tcx. dcx ( ) . emit_err ( errors :: MitigationLessStrictInDependency {
505+ tcx. dcx ( ) . emit_err ( diagnostics :: MitigationLessStrictInDependency {
506506 span : krate. spans . inner_span . shrink_to_lo ( ) ,
507507 mitigation_name : my_mitigation. kind . to_string ( ) ,
508508 mitigation_level : my_mitigation. level . level_str ( ) . to_string ( ) ,
@@ -525,7 +525,7 @@ impl CStore {
525525 if data. has_async_drops ( ) {
526526 let extern_crate = data. name ( ) ;
527527 let local_crate = tcx. crate_name ( LOCAL_CRATE ) ;
528- tcx. dcx ( ) . emit_warn ( errors :: AsyncDropTypesInDependency {
528+ tcx. dcx ( ) . emit_warn ( diagnostics :: AsyncDropTypesInDependency {
529529 span : krate. spans . inner_span . shrink_to_lo ( ) ,
530530 extern_crate,
531531 local_crate,
@@ -1034,11 +1034,13 @@ impl CStore {
10341034 // Sanity check the loaded crate to ensure it is indeed a panic runtime
10351035 // and the panic strategy is indeed what we thought it was.
10361036 if !cdata. is_panic_runtime ( ) {
1037- tcx. dcx ( ) . emit_err ( errors :: CrateNotPanicRuntime { crate_name : name } ) ;
1037+ tcx. dcx ( ) . emit_err ( diagnostics :: CrateNotPanicRuntime { crate_name : name } ) ;
10381038 }
10391039 if cdata. required_panic_strategy ( ) != Some ( desired_strategy) {
1040- tcx. dcx ( )
1041- . emit_err ( errors:: NoPanicStrategy { crate_name : name, strategy : desired_strategy } ) ;
1040+ tcx. dcx ( ) . emit_err ( diagnostics:: NoPanicStrategy {
1041+ crate_name : name,
1042+ strategy : desired_strategy,
1043+ } ) ;
10421044 }
10431045
10441046 self . injected_panic_runtime = Some ( cnum) ;
@@ -1074,25 +1076,29 @@ impl CStore {
10741076
10751077 // Sanity check the loaded crate to ensure it is indeed a profiler runtime
10761078 if !cdata. is_profiler_runtime ( ) {
1077- tcx. dcx ( ) . emit_err ( errors :: NotProfilerRuntime { crate_name : name } ) ;
1079+ tcx. dcx ( ) . emit_err ( diagnostics :: NotProfilerRuntime { crate_name : name } ) ;
10781080 }
10791081 }
10801082
10811083 fn inject_allocator_crate ( & mut self , tcx : TyCtxt < ' _ > , krate : & ast:: Crate ) {
10821084 self . has_global_allocator =
10831085 match & * fn_spans ( krate, Symbol :: intern ( & global_fn_name ( sym:: alloc) ) ) {
10841086 [ span1, span2, ..] => {
1085- tcx. dcx ( )
1086- . emit_err ( errors:: NoMultipleGlobalAlloc { span2 : * span2, span1 : * span1 } ) ;
1087+ tcx. dcx ( ) . emit_err ( diagnostics:: NoMultipleGlobalAlloc {
1088+ span2 : * span2,
1089+ span1 : * span1,
1090+ } ) ;
10871091 true
10881092 }
10891093 spans => !spans. is_empty ( ) ,
10901094 } ;
10911095 let alloc_error_handler = Symbol :: intern ( & global_fn_name ( ALLOC_ERROR_HANDLER ) ) ;
10921096 self . has_alloc_error_handler = match & * fn_spans ( krate, alloc_error_handler) {
10931097 [ span1, span2, ..] => {
1094- tcx. dcx ( )
1095- . emit_err ( errors:: NoMultipleAllocErrorHandler { span2 : * span2, span1 : * span1 } ) ;
1098+ tcx. dcx ( ) . emit_err ( diagnostics:: NoMultipleAllocErrorHandler {
1099+ span2 : * span2,
1100+ span1 : * span1,
1101+ } ) ;
10961102 true
10971103 }
10981104 spans => !spans. is_empty ( ) ,
@@ -1130,7 +1136,7 @@ impl CStore {
11301136 if data. has_global_allocator ( ) {
11311137 match global_allocator {
11321138 Some ( other_crate) => {
1133- tcx. dcx ( ) . emit_err ( errors :: ConflictingGlobalAlloc {
1139+ tcx. dcx ( ) . emit_err ( diagnostics :: ConflictingGlobalAlloc {
11341140 crate_name : data. name ( ) ,
11351141 other_crate_name : other_crate,
11361142 } ) ;
@@ -1144,7 +1150,7 @@ impl CStore {
11441150 if data. has_alloc_error_handler ( ) {
11451151 match alloc_error_handler {
11461152 Some ( other_crate) => {
1147- tcx. dcx ( ) . emit_err ( errors :: ConflictingAllocErrorHandler {
1153+ tcx. dcx ( ) . emit_err ( diagnostics :: ConflictingAllocErrorHandler {
11481154 crate_name : data. name ( ) ,
11491155 other_crate_name : other_crate,
11501156 } ) ;
@@ -1164,7 +1170,7 @@ impl CStore {
11641170 if !attr:: contains_name ( & krate. attrs , sym:: default_lib_allocator)
11651171 && !self . iter_crate_data ( ) . any ( |( _, data) | data. has_default_lib_allocator ( ) )
11661172 {
1167- tcx. dcx ( ) . emit_err ( errors :: GlobalAllocRequired ) ;
1173+ tcx. dcx ( ) . emit_err ( diagnostics :: GlobalAllocRequired ) ;
11681174 }
11691175 self . allocator_kind = Some ( AllocatorKind :: Default ) ;
11701176 }
@@ -1229,7 +1235,7 @@ impl CStore {
12291235 // Sanity check that the loaded crate is `#![compiler_builtins]`
12301236 let cdata = self . get_crate_data ( cnum) ;
12311237 if !cdata. is_compiler_builtins ( ) {
1232- tcx. dcx ( ) . emit_err ( errors :: CrateNotCompilerBuiltins { crate_name : cdata. name ( ) } ) ;
1238+ tcx. dcx ( ) . emit_err ( diagnostics :: CrateNotCompilerBuiltins { crate_name : cdata. name ( ) } ) ;
12331239 }
12341240 }
12351241
@@ -1261,7 +1267,7 @@ impl CStore {
12611267 lint:: builtin:: UNUSED_CRATE_DEPENDENCIES ,
12621268 span,
12631269 ast:: CRATE_NODE_ID ,
1264- errors :: UnusedCrateDependency {
1270+ diagnostics :: UnusedCrateDependency {
12651271 extern_crate : name_interned,
12661272 local_crate : tcx. crate_name ( LOCAL_CRATE ) ,
12671273 } ,
@@ -1298,7 +1304,7 @@ impl CStore {
12981304 // Make a point span rather than covering the whole file
12991305 let span = krate. spans . inner_span . shrink_to_lo ( ) ;
13001306
1301- tcx. sess . dcx ( ) . emit_err ( errors :: WasmCAbi { span } ) ;
1307+ tcx. sess . dcx ( ) . emit_err ( diagnostics :: WasmCAbi { span } ) ;
13021308 }
13031309 }
13041310
0 commit comments