diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-06-26 10:52:57 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-06-26 16:01:44 +0000 |
| commit | 5988078aa20bf642bc1bbab15a45ac5cb74e77e2 (patch) | |
| tree | 0b8a07c5f03b72422c1ff961bb6ec4491ed2007f /compiler/rustc_errors/src | |
| parent | 79ac8982ca24e25b592b06ef636050f5a5a81bde (diff) | |
| download | rust-5988078aa20bf642bc1bbab15a45ac5cb74e77e2.tar.gz rust-5988078aa20bf642bc1bbab15a45ac5cb74e77e2.zip | |
Restrict diagnostic context lifetime of InferCtxt to itself instead of TyCtxt
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index e580910af77..0231665b64c 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -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 { |
