Skip to content

Commit

Permalink
Document new field and function
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Jun 27, 2024
1 parent ba198af commit bd111f5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>>>,
}

Expand Down Expand Up @@ -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>>,
Expand Down

0 comments on commit bd111f5

Please sign in to comment.