From 0b81f992e9cc41d4fb957f1b9d2a99b1f73f8160 Mon Sep 17 00:00:00 2001 From: lcnr Date: Mon, 29 May 2023 14:35:11 +0200 Subject: [PATCH] update universe used by the leak check --- .../rustc_trait_selection/src/solve/eval_ctxt/canonical.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs index 91a093f30bd..bca2343e424 100644 --- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs +++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs @@ -137,7 +137,9 @@ impl<'tcx> EvalCtxt<'_, 'tcx> { #[instrument(level = "debug", skip(self), ret)] fn compute_external_query_constraints(&self) -> Result, NoSolution> { - self.infcx.leak_check(ty::UniverseIndex::ROOT, None).map_err(|e| { + // We only check for leaks from universes which were entered inside + // of the query. + self.infcx.leak_check(self.max_input_universe, None).map_err(|e| { debug!(?e, "failed the leak check"); NoSolution })?;