Restrict diagnostic context lifetime of InferCtxt to itself instead of TyCtxt
This commit is contained in:
parent
79ac8982ca
commit
5988078aa2
12 changed files with 79 additions and 53 deletions
|
@ -582,6 +582,11 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
|
|||
Self::new_diagnostic(dcx, DiagInner::new(level, message))
|
||||
}
|
||||
|
||||
/// Allow moving diagnostics between different error tainting contexts
|
||||
pub fn with_dcx(mut self, dcx: DiagCtxtHandle<'_>) -> Diag<'_, G> {
|
||||
Diag { dcx, diag: self.diag.take(), _marker: PhantomData }
|
||||
}
|
||||
|
||||
/// Creates a new `Diag` with an already constructed diagnostic.
|
||||
#[track_caller]
|
||||
pub(crate) fn new_diagnostic(dcx: DiagCtxtHandle<'a>, diag: DiagInner) -> Self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue