1
- use crate::errors::{
2
- CantEmitMIR, EmojiIdentifier, ErrorWritingDependencies, FerrisIdentifier,
3
- GeneratedFileConflictsWithDirectory, InputFileWouldBeOverWritten, MixedBinCrate,
4
- MixedProcMacroCrate, OutDirError, ProcMacroCratePanicAbort, ProcMacroDocWithoutArg,
5
- TempsDirError,
6
- };
1
+ use crate::errors;
7
2
use crate::interface::{Compiler, Result};
8
3
use crate::proc_macro_decls;
9
4
use crate::util;
@@ -374,15 +369,15 @@ pub fn configure_and_expand(
374
369
375
370
if crate_types.len() > 1 {
376
371
if is_executable_crate {
377
- sess.emit_err(MixedBinCrate);
372
+ sess.emit_err(errors:: MixedBinCrate);
378
373
}
379
374
if is_proc_macro_crate {
380
- sess.emit_err(MixedProcMacroCrate);
375
+ sess.emit_err(errors:: MixedProcMacroCrate);
381
376
}
382
377
}
383
378
384
379
if is_proc_macro_crate && sess.panic_strategy() == PanicStrategy::Abort {
385
- sess.emit_warning(ProcMacroCratePanicAbort);
380
+ sess.emit_warning(errors:: ProcMacroCratePanicAbort);
386
381
}
387
382
388
383
// For backwards compatibility, we don't try to run proc macro injection
@@ -392,7 +387,7 @@ pub fn configure_and_expand(
392
387
// However, we do emit a warning, to let such users know that they should
393
388
// start passing '--crate-type proc-macro'
394
389
if has_proc_macro_decls && sess.opts.actually_rustdoc && !is_proc_macro_crate {
395
- sess.emit_warning(ProcMacroDocWithoutArg);
390
+ sess.emit_warning(errors:: ProcMacroDocWithoutArg);
396
391
} else {
397
392
krate = sess.time("maybe_create_a_macro_crate", || {
398
393
let is_test_crate = sess.opts.test;
@@ -441,9 +436,9 @@ pub fn configure_and_expand(
441
436
spans.sort();
442
437
if ident == sym::ferris {
443
438
let first_span = spans[0];
444
- sess.emit_err(FerrisIdentifier { spans, first_span });
439
+ sess.emit_err(errors:: FerrisIdentifier { spans, first_span });
445
440
} else {
446
- sess.emit_err(EmojiIdentifier { spans, ident });
441
+ sess.emit_err(errors:: EmojiIdentifier { spans, ident });
447
442
}
448
443
}
449
444
});
@@ -655,7 +650,7 @@ fn write_out_deps(
655
650
}
656
651
}
657
652
Err(error) => {
658
- sess.emit_fatal(ErrorWritingDependencies { path: &deps_filename, error });
653
+ sess.emit_fatal(errors:: ErrorWritingDependencies { path: &deps_filename, error });
659
654
}
660
655
}
661
656
}
@@ -676,17 +671,20 @@ fn output_filenames(tcx: TyCtxt<'_>, (): ()) -> Arc<OutputFilenames> {
676
671
if let Some(ref input_path) = sess.io.input.opt_path() {
677
672
if sess.opts.will_create_output_file() {
678
673
if output_contains_path(&output_paths, input_path) {
679
- sess.emit_fatal(InputFileWouldBeOverWritten { path: input_path });
674
+ sess.emit_fatal(errors:: InputFileWouldBeOverWritten { path: input_path });
680
675
}
681
676
if let Some(ref dir_path) = output_conflicts_with_dir(&output_paths) {
682
- sess.emit_fatal(GeneratedFileConflictsWithDirectory { input_path, dir_path });
677
+ sess.emit_fatal(errors::GeneratedFileConflictsWithDirectory {
678
+ input_path,
679
+ dir_path,
680
+ });
683
681
}
684
682
}
685
683
}
686
684
687
685
if let Some(ref dir) = sess.io.temps_dir {
688
686
if fs::create_dir_all(dir).is_err() {
689
- sess.emit_fatal(TempsDirError);
687
+ sess.emit_fatal(errors:: TempsDirError);
690
688
}
691
689
}
692
690
@@ -698,7 +696,7 @@ fn output_filenames(tcx: TyCtxt<'_>, (): ()) -> Arc<OutputFilenames> {
698
696
if !only_dep_info {
699
697
if let Some(ref dir) = sess.io.output_dir {
700
698
if fs::create_dir_all(dir).is_err() {
701
- sess.emit_fatal(OutDirError);
699
+ sess.emit_fatal(errors:: OutDirError);
702
700
}
703
701
}
704
702
}
@@ -977,7 +975,7 @@ pub fn start_codegen<'tcx>(
977
975
978
976
if tcx.sess.opts.output_types.contains_key(&OutputType::Mir) {
979
977
if let Err(error) = rustc_mir_transform::dump_mir::emit_mir(tcx) {
980
- tcx.sess.emit_err(CantEmitMIR { error });
978
+ tcx.sess.emit_err(errors:: CantEmitMIR { error });
981
979
tcx.sess.abort_if_errors();
982
980
}
983
981
}
0 commit comments