Document new field and function
This commit is contained in:
parent
ba198af81f
commit
bd111f5c4b
1 changed files with 5 additions and 0 deletions
|
@ -418,6 +418,8 @@ pub struct DiagCtxt {
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct DiagCtxtHandle<'a> {
|
pub struct DiagCtxtHandle<'a> {
|
||||||
dcx: &'a DiagCtxt,
|
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>>>,
|
tainted_with_errors: Option<&'a Cell<Option<ErrorGuaranteed>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -757,6 +759,9 @@ impl DiagCtxt {
|
||||||
DiagCtxtHandle { dcx: self, tainted_with_errors: None }
|
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>(
|
pub fn taintable_handle<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
tainted_with_errors: &'a Cell<Option<ErrorGuaranteed>>,
|
tainted_with_errors: &'a Cell<Option<ErrorGuaranteed>>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue