From bd111f5c4bbf3726ef0c9daf78c16c453bf5cb3d Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 27 Jun 2024 09:45:26 +0000 Subject: Document new field and function --- compiler/rustc_errors/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'compiler/rustc_errors/src') 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>>, } @@ -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` instead of having to do that manually at every error + /// emission site. pub fn taintable_handle<'a>( &'a self, tainted_with_errors: &'a Cell>, -- cgit 1.4.1-3-g733a5