From e27495c015c3df7f82cc15c73968f836c10cc9e9 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 5 Feb 2025 13:52:22 +0000 Subject: Couple of changes to run rustc in miri --- compiler/rustc_errors/src/emitter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/rustc_errors') diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index d0b4211c351..a9fa2e47641 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -1764,7 +1764,7 @@ impl HumanEmitter { let column_width = if let Some(width) = self.diagnostic_width { width.saturating_sub(code_offset) - } else if self.ui_testing { + } else if self.ui_testing || cfg!(miri) { DEFAULT_COLUMN_WIDTH } else { termize::dimensions() -- cgit 1.4.1-3-g733a5 From 8a0adec05bf99d229e33545ba16c65c210e40142 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 5 Feb 2025 15:09:15 +0000 Subject: Avoid manually producing FatalError in a couple of places --- compiler/rustc_driver_impl/src/lib.rs | 2 +- compiler/rustc_errors/src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'compiler/rustc_errors') diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 6ea14d15c14..370aba413ed 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -1024,7 +1024,7 @@ pub fn describe_flag_categories(early_dcx: &EarlyDiagCtxt, matches: &Matches) -> let wall = matches.opt_strs("W"); if wall.iter().any(|x| *x == "all") { print_wall_help(); - rustc_errors::FatalError.raise(); + return true; } // Don't handle -W help here, because we might first load additional lints. diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 7a02e0dd2f0..9af17db9a6e 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1048,8 +1048,8 @@ impl<'a> DiagCtxtHandle<'a> { /// bad results, such as spurious/uninteresting additional errors -- when /// returning an error `Result` is difficult. pub fn abort_if_errors(&self) { - if self.has_errors().is_some() { - FatalError.raise(); + if let Some(guar) = self.has_errors() { + guar.raise_fatal(); } } -- cgit 1.4.1-3-g733a5