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-18 15:51:47 -0600
committerNathan Stocks <cleancut@github.com>2022-08-25 11:06:32 -0600
commit137f20c11265ea70e3ed3ed7798662b9abfbaad2 (patch)
treee9e9323ebecadd0740083c3169c97fbd9dc6f65b /compiler/rustc_monomorphize/src/partitioning/mod.rs
parent4d45b0745ab227feb9000bc15713ade4b99241ea (diff)
downloadrust-137f20c11265ea70e3ed3ed7798662b9abfbaad2.tar.gz
rust-137f20c11265ea70e3ed3ed7798662b9abfbaad2.zip
rebased: convert rustc_monomorphize errors to SessionDiagnostic
Diffstat (limited to 'compiler/rustc_monomorphize/src/partitioning/mod.rs')
-rw-r--r--compiler/rustc_monomorphize/src/partitioning/mod.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_monomorphize/src/partitioning/mod.rs b/compiler/rustc_monomorphize/src/partitioning/mod.rs
index ff2d3869328..d88b7e0a813 100644
--- a/compiler/rustc_monomorphize/src/partitioning/mod.rs
+++ b/compiler/rustc_monomorphize/src/partitioning/mod.rs
@@ -108,6 +108,7 @@ use rustc_span::symbol::Symbol;
 
 use crate::collector::InliningMap;
 use crate::collector::{self, MonoItemCollectionMode};
+use crate::errors::{FatalError, SpanFatalError};
 
 pub struct PartitioningCx<'a, 'tcx> {
     tcx: TyCtxt<'tcx>,
@@ -149,7 +150,10 @@ fn get_partitioner<'tcx>(tcx: TyCtxt<'tcx>) -> Box<dyn Partitioner<'tcx>> {
 
     match strategy {
         "default" => Box::new(default::DefaultPartitioning),
-        _ => tcx.sess.fatal("unknown partitioning strategy"),
+        _ => {
+            let error_message = "unknown partitioning strategy".to_string();
+            tcx.sess.emit_fatal(FatalError { error_message: error_message.clone() });
+        }
     }
 }
 
@@ -334,9 +338,9 @@ where
             let error_message = format!("symbol `{}` is already defined", sym1);
 
             if let Some(span) = span {
-                tcx.sess.span_fatal(span, &error_message)
+                tcx.sess.emit_fatal(SpanFatalError { span, error_message: error_message.clone() });
             } else {
-                tcx.sess.fatal(&error_message)
+                tcx.sess.emit_fatal(FatalError { error_message: error_message.clone() });
             }
         }
     }