about summary refs log tree commit diff
path: root/compiler/rustc_monomorphize/src/partitioning/mod.rs
diff options
context:
space:
mode:
authorNathan Stocks <cleancut@github.com>2022-08-23 11:20:01 -0600
committerNathan Stocks <cleancut@github.com>2022-08-25 11:06:45 -0600
commit40f44736e805d0576918bb7679e2737a704590f1 (patch)
tree4e17e7d4dc2115a892598ddd5bac6efa58256b53 /compiler/rustc_monomorphize/src/partitioning/mod.rs
parent137f20c11265ea70e3ed3ed7798662b9abfbaad2 (diff)
downloadrust-40f44736e805d0576918bb7679e2737a704590f1.tar.gz
rust-40f44736e805d0576918bb7679e2737a704590f1.zip
replace some usages of [Span]FatalError with error-specific types
Diffstat (limited to 'compiler/rustc_monomorphize/src/partitioning/mod.rs')
-rw-r--r--compiler/rustc_monomorphize/src/partitioning/mod.rs13
1 files changed, 3 insertions, 10 deletions
diff --git a/compiler/rustc_monomorphize/src/partitioning/mod.rs b/compiler/rustc_monomorphize/src/partitioning/mod.rs
index d88b7e0a813..3d9197c7549 100644
--- a/compiler/rustc_monomorphize/src/partitioning/mod.rs
+++ b/compiler/rustc_monomorphize/src/partitioning/mod.rs
@@ -108,7 +108,7 @@ use rustc_span::symbol::Symbol;
 
 use crate::collector::InliningMap;
 use crate::collector::{self, MonoItemCollectionMode};
-use crate::errors::{FatalError, SpanFatalError};
+use crate::errors::{SymbolAlreadyDefined, UnknownPartitionStrategy};
 
 pub struct PartitioningCx<'a, 'tcx> {
     tcx: TyCtxt<'tcx>,
@@ -151,8 +151,7 @@ fn get_partitioner<'tcx>(tcx: TyCtxt<'tcx>) -> Box<dyn Partitioner<'tcx>> {
     match strategy {
         "default" => Box::new(default::DefaultPartitioning),
         _ => {
-            let error_message = "unknown partitioning strategy".to_string();
-            tcx.sess.emit_fatal(FatalError { error_message: error_message.clone() });
+            tcx.sess.emit_fatal(UnknownPartitionStrategy);
         }
     }
 }
@@ -335,13 +334,7 @@ where
                 (span1, span2) => span1.or(span2),
             };
 
-            let error_message = format!("symbol `{}` is already defined", sym1);
-
-            if let Some(span) = span {
-                tcx.sess.emit_fatal(SpanFatalError { span, error_message: error_message.clone() });
-            } else {
-                tcx.sess.emit_fatal(FatalError { error_message: error_message.clone() });
-            }
+            tcx.sess.emit_fatal(SymbolAlreadyDefined { span, symbol: sym1.to_string() });
         }
     }
 }