From 809acd2a8058f3d7f284c33ccfe1716b96136393 Mon Sep 17 00:00:00 2001 From: lcnr Date: Fri, 12 Jul 2024 11:58:56 +0200 Subject: [PATCH] `SearchGraphDelegate`: use `PhantomData` + comment --- .../rustc_next_trait_solver/src/solve/search_graph.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_next_trait_solver/src/solve/search_graph.rs b/compiler/rustc_next_trait_solver/src/solve/search_graph.rs index 47a82e0d684d7..3d287d5875e05 100644 --- a/compiler/rustc_next_trait_solver/src/solve/search_graph.rs +++ b/compiler/rustc_next_trait_solver/src/solve/search_graph.rs @@ -3,13 +3,17 @@ use rustc_type_ir::inherent::Predicate; use rustc_type_ir::search_graph::{self, CycleKind, UsageKind}; use rustc_type_ir::solve::{CanonicalInput, Certainty, QueryResult}; use rustc_type_ir::Interner; +use std::marker::PhantomData; use super::inspect; use super::{inspect::ProofTreeBuilder, FIXPOINT_STEP_LIMIT}; +/// This type is never constructed. We only use it to implement `search_graph::Delegate` +/// for all types which impl `SolverDelegate` and doing it directly fails in coherence. +pub(super) struct SearchGraphDelegate { + _marker: PhantomData, +} pub(super) type SearchGraph = search_graph::SearchGraph>; - -pub(super) struct SearchGraphDelegate(D); impl search_graph::Delegate for SearchGraphDelegate where D: SolverDelegate,