diff options
| author | Ralf Jung <post@ralfj.de> | 2023-09-11 23:09:11 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-09-14 22:34:05 +0200 |
| commit | 9ac8b363e3227fdc08634ce445b7787aa0fa6bba (patch) | |
| tree | fa4ccae3cb361f63c1aa533ddd6921a1b7c71045 /compiler/rustc_codegen_ssa | |
| parent | 89ac57db4dbc0a69a3d15b6818ca1de5bc5bd09c (diff) | |
| download | rust-9ac8b363e3227fdc08634ce445b7787aa0fa6bba.tar.gz rust-9ac8b363e3227fdc08634ce445b7787aa0fa6bba.zip | |
don't point at const usage site for resolution-time errors
also share the code that emits the actual error
Diffstat (limited to 'compiler/rustc_codegen_ssa')
| -rw-r--r-- | compiler/rustc_codegen_ssa/messages.ftl | 4 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/errors.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/mod.rs | 24 |
3 files changed, 8 insertions, 34 deletions
diff --git a/compiler/rustc_codegen_ssa/messages.ftl b/compiler/rustc_codegen_ssa/messages.ftl index 9ce13ff469c..d0a078505d2 100644 --- a/compiler/rustc_codegen_ssa/messages.ftl +++ b/compiler/rustc_codegen_ssa/messages.ftl @@ -19,8 +19,6 @@ codegen_ssa_copy_path_buf = unable to copy {$source_file} to {$output_path}: {$e codegen_ssa_create_temp_dir = couldn't create a temp dir: {$error} -codegen_ssa_erroneous_constant = erroneous constant encountered - codegen_ssa_error_creating_remark_dir = failed to create remark directory: {$error} codegen_ssa_expected_coverage_symbol = expected `coverage(off)` or `coverage(on)` @@ -174,8 +172,6 @@ codegen_ssa_no_natvis_directory = error enumerating natvis directory: {$error} codegen_ssa_option_gcc_only = option `-Z gcc-ld` is used even though linker flavor is not gcc -codegen_ssa_polymorphic_constant_too_generic = codegen encountered polymorphic constant: TooGeneric - codegen_ssa_processing_dymutil_failed = processing debug info with `dsymutil` failed: {$status} .note = {$output} diff --git a/compiler/rustc_codegen_ssa/src/errors.rs b/compiler/rustc_codegen_ssa/src/errors.rs index fa49095c9e8..bfd572a2eea 100644 --- a/compiler/rustc_codegen_ssa/src/errors.rs +++ b/compiler/rustc_codegen_ssa/src/errors.rs @@ -596,20 +596,6 @@ pub struct InvalidWindowsSubsystem { } #[derive(Diagnostic)] -#[diag(codegen_ssa_erroneous_constant)] -pub struct ErroneousConstant { - #[primary_span] - pub span: Span, -} - -#[derive(Diagnostic)] -#[diag(codegen_ssa_polymorphic_constant_too_generic)] -pub struct PolymorphicConstantTooGeneric { - #[primary_span] - pub span: Span, -} - -#[derive(Diagnostic)] #[diag(codegen_ssa_shuffle_indices_evaluation)] pub struct ShuffleIndicesEvaluation { #[primary_span] diff --git a/compiler/rustc_codegen_ssa/src/mir/mod.rs b/compiler/rustc_codegen_ssa/src/mir/mod.rs index aece73fb3e5..4c80ba54c76 100644 --- a/compiler/rustc_codegen_ssa/src/mir/mod.rs +++ b/compiler/rustc_codegen_ssa/src/mir/mod.rs @@ -1,10 +1,8 @@ use crate::base; -use crate::errors; use crate::traits::*; use rustc_index::bit_set::BitSet; use rustc_index::IndexVec; use rustc_middle::mir; -use rustc_middle::mir::interpret::ErrorHandled; use rustc_middle::mir::traversal; use rustc_middle::mir::UnwindTerminateReason; use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, TyAndLayout}; @@ -214,20 +212,14 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( fx.per_local_var_debug_info = fx.compute_per_local_var_debug_info(&mut start_bx); // Rust post-monomorphization checks; we later rely on them. - match mir.post_mono_checks(cx.tcx(), ty::ParamEnv::reveal_all(), |c| Ok(fx.monomorphize(c))) { - Ok(()) => {} - Err(ErrorHandled::TooGeneric(span)) => { - cx.tcx().sess.diagnostic().emit_bug(errors::PolymorphicConstantTooGeneric { span }); - } - Err(ErrorHandled::Reported(info, span)) => { - if !info.is_tainted_by_errors() { - cx.tcx().sess.emit_err(errors::ErroneousConstant { span }); - } - // This IR shouldn't ever be emitted, but let's try to guard against any of this code - // ever running. - start_bx.abort(); - return; - } + if let Err(err) = + mir.post_mono_checks(cx.tcx(), ty::ParamEnv::reveal_all(), |c| Ok(fx.monomorphize(c))) + { + err.emit_err(cx.tcx()); + // This IR shouldn't ever be emitted, but let's try to guard against any of this code + // ever running. + start_bx.abort(); + return; } let memory_locals = analyze::non_ssa_locals(&fx); |
