about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits/codegen.rs
diff options
context:
space:
mode:
authormark <markm@cs.wisc.edu>2022-01-22 18:49:12 -0600
committermark <markm@cs.wisc.edu>2022-03-16 10:35:24 -0500
commitbb8d4307eb723850e98bcb52d71d860a4aba220a (patch)
treef3215627c474542776bdbcb03f634651a89b70f8 /compiler/rustc_trait_selection/src/traits/codegen.rs
parent461e8078010433ff7de2db2aaae8a3cfb0847215 (diff)
downloadrust-bb8d4307eb723850e98bcb52d71d860a4aba220a.tar.gz
rust-bb8d4307eb723850e98bcb52d71d860a4aba220a.zip
rustc_error: make ErrorReported impossible to construct
There are a few places were we have to construct it, though, and a few
places that are more invasive to change. To do this, we create a
constructor with a long obvious name.
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits/codegen.rs')
-rw-r--r--compiler/rustc_trait_selection/src/traits/codegen.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/codegen.rs b/compiler/rustc_trait_selection/src/traits/codegen.rs
index 3e0c8234eda..a607fb6c1b8 100644
--- a/compiler/rustc_trait_selection/src/traits/codegen.rs
+++ b/compiler/rustc_trait_selection/src/traits/codegen.rs
@@ -51,7 +51,7 @@ pub fn codegen_fulfill_obligation<'tcx>(
                 // leading to an ambiguous result. So report this as an
                 // overflow bug, since I believe this is the only case
                 // where ambiguity can result.
-                infcx.tcx.sess.delay_span_bug(
+                let reported = infcx.tcx.sess.delay_span_bug(
                     rustc_span::DUMMY_SP,
                     &format!(
                         "encountered ambiguity selecting `{:?}` during codegen, presuming due to \
@@ -59,21 +59,21 @@ pub fn codegen_fulfill_obligation<'tcx>(
                         trait_ref
                     ),
                 );
-                return Err(ErrorGuaranteed);
+                return Err(reported);
             }
             Err(Unimplemented) => {
                 // This can trigger when we probe for the source of a `'static` lifetime requirement
                 // on a trait object: `impl Foo for dyn Trait {}` has an implicit `'static` bound.
                 // This can also trigger when we have a global bound that is not actually satisfied,
                 // but was included during typeck due to the trivial_bounds feature.
-                infcx.tcx.sess.delay_span_bug(
+                let guar = infcx.tcx.sess.delay_span_bug(
                     rustc_span::DUMMY_SP,
                     &format!(
                         "Encountered error `Unimplemented` selecting `{:?}` during codegen",
                         trait_ref
                     ),
                 );
-                return Err(ErrorGuaranteed);
+                return Err(guar);
             }
             Err(e) => {
                 bug!("Encountered error `{:?}` selecting `{:?}` during codegen", e, trait_ref)