about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/lib.rs
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-06-27 09:45:26 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-06-27 09:45:26 +0000
commitbd111f5c4bbf3726ef0c9daf78c16c453bf5cb3d (patch)
treef11a55e2337e5c5f167554ca572f04852c8a0997 /compiler/rustc_errors/src/lib.rs
parentba198af81f75ef01b7d603a7b1c001fafe8ad4a4 (diff)
downloadrust-bd111f5c4bbf3726ef0c9daf78c16c453bf5cb3d.tar.gz
rust-bd111f5c4bbf3726ef0c9daf78c16c453bf5cb3d.zip
Document new field and function
Diffstat (limited to 'compiler/rustc_errors/src/lib.rs')
-rw-r--r--compiler/rustc_errors/src/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs
index 242684e63a0..2086d4030f9 100644
--- a/compiler/rustc_errors/src/lib.rs
+++ b/compiler/rustc_errors/src/lib.rs
@@ -418,6 +418,8 @@ pub struct DiagCtxt {
 #[derive(Copy, Clone)]
 pub struct DiagCtxtHandle<'a> {
     dcx: &'a DiagCtxt,
+    /// Some contexts create `DiagCtxtHandle` with this field set, and thus all
+    /// errors emitted with it will automatically taint when emitting errors.
     tainted_with_errors: Option<&'a Cell<Option<ErrorGuaranteed>>>,
 }
 
@@ -757,6 +759,9 @@ impl DiagCtxt {
         DiagCtxtHandle { dcx: self, tainted_with_errors: None }
     }
 
+    /// Link this to a taintable context so that emitting errors will automatically set
+    /// the `Option<ErrorGuaranteed>` instead of having to do that manually at every error
+    /// emission site.
     pub fn taintable_handle<'a>(
         &'a self,
         tainted_with_errors: &'a Cell<Option<ErrorGuaranteed>>,