Skip to main content

rustc_next_trait_solver/solve/
effect_goals.rs

1//! Dealing with host effect goals, i.e. enforcing the constness in
2//! `T: const Trait` or `T: [const] Trait`.
3
4use rustc_type_ir::fast_reject::DeepRejectCtxt;
5use rustc_type_ir::inherent::*;
6use rustc_type_ir::lang_items::SolverTraitLangItem;
7use rustc_type_ir::solve::inspect::ProbeKind;
8use rustc_type_ir::solve::{
9    AliasBoundKind, NoSolutionOrRerunNonErased, QueryResultOrRerunNonErased, RerunNonErased,
10    SizedTraitKind,
11};
12use rustc_type_ir::{self as ty, Interner, Unnormalized, elaborate};
13use tracing::instrument;
14
15use super::assembly::{Candidate, structural_traits};
16use crate::delegate::SolverDelegate;
17use crate::solve::{
18    BuiltinImplSource, CandidateSource, Certainty, EvalCtxt, Goal, GoalSource, NoSolution, assembly,
19};
20
21impl<D, I> assembly::GoalKind<D> for ty::HostEffectClause<I>
22where
23    D: SolverDelegate<Interner = I>,
24    I: Interner,
25{
26    fn self_ty(self) -> I::Ty {
27        self.self_ty()
28    }
29
30    fn trait_ref(self, _: I) -> ty::TraitRef<I> {
31        self.trait_ref
32    }
33
34    fn with_replaced_self_ty(self, cx: I, self_ty: I::Ty) -> Self {
35        self.with_replaced_self_ty(cx, self_ty)
36    }
37
38    fn trait_def_id(self, _: I) -> I::TraitId {
39        self.def_id()
40    }
41
42    fn fast_reject_assumption(
43        ecx: &mut EvalCtxt<'_, D>,
44        goal: Goal<I, Self>,
45        assumption: I::Clause,
46    ) -> Result<(), NoSolution> {
47        if let Some(host_clause) = assumption.as_host_effect_clause()
48            && host_clause.def_id() == goal.predicate.def_id()
49            && host_clause.constness().satisfies(goal.predicate.constness)
50            && DeepRejectCtxt::relate_rigid_rigid(ecx.cx()).args_may_unify(
51                goal.predicate.trait_ref.args,
52                host_clause.skip_binder().trait_ref.args,
53            )
54        {
55            Ok(())
56        } else {
57            Err(NoSolution)
58        }
59    }
60
61    fn match_assumption(
62        ecx: &mut EvalCtxt<'_, D>,
63        goal: Goal<I, Self>,
64        assumption: I::Clause,
65        then: impl FnOnce(&mut EvalCtxt<'_, D>) -> QueryResultOrRerunNonErased<I>,
66    ) -> QueryResultOrRerunNonErased<I> {
67        let host_clause = assumption.as_host_effect_clause().unwrap();
68
69        let assumption_trait_pred = ecx.instantiate_binder_with_infer(host_clause);
70        ecx.eq(goal.param_env, goal.predicate.trait_ref, assumption_trait_pred.trait_ref)?;
71
72        then(ecx)
73    }
74
75    /// Register additional assumptions for aliases corresponding to `[const]` item bounds.
76    ///
77    /// Unlike item bounds, they are not simply implied by the well-formedness of the alias.
78    /// Instead, they only hold if the const conditions on the alias also hold. This is why
79    /// we also register the const conditions of the alias after matching the goal against
80    /// the assumption.
81    fn consider_additional_alias_assumptions(
82        ecx: &mut EvalCtxt<'_, D>,
83        goal: Goal<I, Self>,
84        alias_ty: ty::AliasTy<I>,
85    ) -> Vec<Candidate<I>> {
86        let cx = ecx.cx();
87        let mut candidates = ::alloc::vec::Vec::new()vec![];
88
89        let def_id = match alias_ty.kind {
90            ty::AliasTyKind::Projection { def_id } => def_id.into(),
91            ty::AliasTyKind::Inherent { def_id } => def_id.into(),
92            ty::AliasTyKind::Opaque { def_id } => def_id.into(),
93            ty::AliasTyKind::Free { def_id } => def_id.into(),
94        };
95
96        if !ecx.cx().alias_has_const_conditions(def_id) {
97            return ::alloc::vec::Vec::new()vec![];
98        }
99
100        for clause in elaborate::elaborate(
101            cx,
102            cx.explicit_implied_const_bounds(def_id).iter_instantiated(cx, alias_ty.args).map(
103                |trait_ref| {
104                    trait_ref.to_host_effect_clause(cx, goal.predicate.constness).skip_norm_wip()
105                },
106            ),
107        ) {
108            candidates.extend(Self::probe_and_match_goal_against_assumption(
109                ecx,
110                CandidateSource::AliasBound(AliasBoundKind::SelfBounds),
111                goal,
112                clause,
113                |ecx| {
114                    // Const conditions must hold for the implied const bound to hold.
115                    ecx.add_goals(
116                        GoalSource::AliasBoundConstCondition,
117                        cx.const_conditions(def_id).iter_instantiated(cx, alias_ty.args).map(
118                            |trait_ref| {
119                                goal.with(
120                                    cx,
121                                    trait_ref
122                                        .to_host_effect_clause(cx, goal.predicate.constness)
123                                        .skip_norm_wip(),
124                                )
125                            },
126                        ),
127                    )?;
128                    ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
129                },
130            ));
131        }
132
133        candidates
134    }
135
136    fn consider_impl_candidate(
137        ecx: &mut EvalCtxt<'_, D>,
138        goal: Goal<I, Self>,
139        goal_trait_ref: ty::TraitRef<I>,
140        impl_def_id: I::ImplId,
141        then: impl FnOnce(&mut EvalCtxt<'_, D>, Certainty) -> QueryResultOrRerunNonErased<I>,
142    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
143        let cx = ecx.cx();
144
145        let impl_trait_ref = cx.impl_trait_ref(impl_def_id);
146        if !DeepRejectCtxt::relate_rigid_infer(ecx.cx())
147            .args_may_unify(goal_trait_ref.args, impl_trait_ref.skip_binder().args)
148        {
149            return Err(NoSolution.into());
150        }
151
152        let impl_polarity = cx.impl_polarity(impl_def_id);
153        let certainty = match impl_polarity {
154            ty::ImplPolarity::Negative => return Err(NoSolution.into()),
155            ty::ImplPolarity::Reservation => {
156                if ecx.typing_mode().is_coherence() {
157                    Certainty::AMBIGUOUS
158                } else {
159                    return Err(NoSolution.into());
160                }
161            }
162            ty::ImplPolarity::Positive => Certainty::Yes,
163        };
164
165        if !cx.impl_is_const(impl_def_id) {
166            return Err(NoSolution.into());
167        }
168
169        ecx.probe_trait_candidate(CandidateSource::Impl(impl_def_id)).enter(|ecx| {
170            let impl_args = ecx.fresh_args_for_item(impl_def_id.into());
171            ecx.record_impl_args(impl_args);
172            let impl_trait_ref = impl_trait_ref.instantiate(cx, impl_args).skip_norm_wip();
173
174            ecx.eq(goal.param_env, goal_trait_ref, impl_trait_ref)?;
175            let where_clause_bounds = cx
176                .clauses_of(impl_def_id.into())
177                .iter_instantiated(cx, impl_args)
178                .map(Unnormalized::skip_norm_wip)
179                .map(|clause| goal.with(cx, clause));
180            ecx.add_goals(GoalSource::ImplWhereBound, where_clause_bounds)?;
181
182            // For this impl to be `const`, we need to check its `[const]` bounds too.
183            let const_conditions = cx
184                .const_conditions(impl_def_id.into())
185                .iter_instantiated(cx, impl_args)
186                .map(|bound_trait_ref| {
187                    goal.with(
188                        cx,
189                        bound_trait_ref
190                            .to_host_effect_clause(cx, goal.predicate.constness)
191                            .skip_norm_wip(),
192                    )
193                });
194            ecx.add_goals(GoalSource::ImplWhereBound, const_conditions)?;
195
196            then(ecx, certainty)
197        })
198    }
199
200    fn consider_error_guaranteed_candidate(
201        ecx: &mut EvalCtxt<'_, D>,
202        _goal: Goal<I, Self>,
203        _guar: I::ErrorGuaranteed,
204    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
205        ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc)
206            .enter(|ecx| ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes))
207    }
208
209    fn consider_auto_trait_candidate(
210        ecx: &mut EvalCtxt<'_, D>,
211        _goal: Goal<I, Self>,
212    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
213        ecx.cx().delay_bug("auto traits are never const");
214        Err(NoSolution.into())
215    }
216
217    fn consider_trait_alias_candidate(
218        ecx: &mut EvalCtxt<'_, D>,
219        goal: Goal<I, Self>,
220    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
221        let cx = ecx.cx();
222
223        ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|ecx| {
224            let where_clause_bounds = cx
225                .clauses_of(goal.predicate.def_id().into())
226                .iter_instantiated(cx, goal.predicate.trait_ref.args)
227                .map(Unnormalized::skip_norm_wip)
228                .map(|c| goal.with(cx, c));
229
230            let const_conditions = cx
231                .const_conditions(goal.predicate.def_id().into())
232                .iter_instantiated(cx, goal.predicate.trait_ref.args)
233                .map(|bound_trait_ref| {
234                    goal.with(
235                        cx,
236                        bound_trait_ref
237                            .to_host_effect_clause(cx, goal.predicate.constness)
238                            .skip_norm_wip(),
239                    )
240                });
241            // While you could think of trait aliases to have a single builtin impl
242            // which uses its implied trait bounds as where-clauses, using
243            // `GoalSource::ImplWhereClause` here would be incorrect, as we also
244            // impl them, which means we're "stepping out of the impl constructor"
245            // again. To handle this, we treat these cycles as ambiguous for now.
246            ecx.add_goals(GoalSource::Misc, where_clause_bounds)?;
247            ecx.add_goals(GoalSource::Misc, const_conditions)?;
248            ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
249        })
250    }
251
252    fn consider_builtin_sizedness_candidates(
253        _ecx: &mut EvalCtxt<'_, D>,
254        _goal: Goal<I, Self>,
255        _sizedness: SizedTraitKind,
256    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
257        {
    ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
            format_args!("Sized/MetaSized is never const")));
}unreachable!("Sized/MetaSized is never const")
258    }
259
260    fn consider_builtin_copy_clone_candidate(
261        ecx: &mut EvalCtxt<'_, D>,
262        goal: Goal<I, Self>,
263    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
264        let cx = ecx.cx();
265
266        let self_ty = goal.predicate.self_ty();
267        let constituent_tys =
268            structural_traits::instantiate_constituent_tys_for_copy_clone_trait(ecx, self_ty)?;
269
270        ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|ecx| {
271            ecx.enter_forall_with_assumptions(constituent_tys, goal.param_env, |ecx, tys| {
272                ecx.add_goals(
273                    GoalSource::ImplWhereBound,
274                    tys.into_iter().map(|ty| {
275                        goal.with(
276                            cx,
277                            ty::ClauseKind::HostEffect(
278                                goal.predicate.with_replaced_self_ty(cx, ty),
279                            ),
280                        )
281                    }),
282                )
283            })?;
284
285            ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
286        })
287    }
288
289    fn consider_builtin_fn_ptr_trait_candidate(
290        _ecx: &mut EvalCtxt<'_, D>,
291        _goal: Goal<I, Self>,
292    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
293        {
    ::core::panicking::panic_fmt(format_args!("not implemented: {0}",
            format_args!("Fn* are not yet const")));
}unimplemented!("Fn* are not yet const")
294    }
295
296    x;#[instrument(level = "trace", skip_all, ret)]
297    fn consider_builtin_fn_trait_candidates(
298        ecx: &mut EvalCtxt<'_, D>,
299        goal: Goal<I, Self>,
300        _kind: rustc_type_ir::ClosureKind,
301    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
302        let cx = ecx.cx();
303
304        let self_ty = goal.predicate.self_ty();
305        let (inputs_and_output, def_id, args) =
306            structural_traits::extract_fn_def_from_const_callable(cx, self_ty)?;
307        let (inputs, output) = ecx.instantiate_binder_with_infer(inputs_and_output);
308
309        // A built-in `Fn` impl only holds if the output is sized.
310        // (FIXME: technically we only need to check this if the type is a fn ptr...)
311        let output_is_sized_pred =
312            ty::TraitRef::new(cx, cx.require_trait_lang_item(SolverTraitLangItem::Sized), [output]);
313        let requirements = cx
314            .const_conditions(def_id)
315            .iter_instantiated(cx, args)
316            .map(|trait_ref| {
317                (
318                    GoalSource::ImplWhereBound,
319                    goal.with(
320                        cx,
321                        trait_ref
322                            .to_host_effect_clause(cx, goal.predicate.constness)
323                            .skip_norm_wip(),
324                    ),
325                )
326            })
327            .chain([(GoalSource::ImplWhereBound, goal.with(cx, output_is_sized_pred))]);
328
329        let pred = ty::Binder::dummy(ty::TraitRef::new(
330            cx,
331            goal.predicate.def_id(),
332            [goal.predicate.self_ty(), inputs],
333        ))
334        .to_host_effect_clause(cx, goal.predicate.constness);
335
336        Self::probe_and_consider_implied_clause(
337            ecx,
338            CandidateSource::BuiltinImpl(BuiltinImplSource::Misc),
339            goal,
340            pred,
341            requirements,
342        )
343        .map_err(Into::into)
344    }
345
346    fn consider_builtin_async_fn_trait_candidates(
347        _ecx: &mut EvalCtxt<'_, D>,
348        _goal: Goal<I, Self>,
349        _kind: rustc_type_ir::ClosureKind,
350    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
351        {
    ::core::panicking::panic_fmt(format_args!("not implemented: {0}",
            format_args!("AsyncFn* are not yet const")));
}unimplemented!("AsyncFn* are not yet const")
352    }
353
354    fn consider_builtin_async_fn_kind_helper_candidate(
355        _ecx: &mut EvalCtxt<'_, D>,
356        _goal: Goal<I, Self>,
357    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
358        {
    ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
            format_args!("AsyncFnKindHelper is not const")));
}unreachable!("AsyncFnKindHelper is not const")
359    }
360
361    fn consider_builtin_tuple_candidate(
362        _ecx: &mut EvalCtxt<'_, D>,
363        _goal: Goal<I, Self>,
364    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
365        {
    ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
            format_args!("Tuple trait is not const")));
}unreachable!("Tuple trait is not const")
366    }
367
368    fn consider_builtin_pointee_candidate(
369        _ecx: &mut EvalCtxt<'_, D>,
370        _goal: Goal<I, Self>,
371    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
372        {
    ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
            format_args!("Pointee is not const")));
}unreachable!("Pointee is not const")
373    }
374
375    fn consider_builtin_future_candidate(
376        _ecx: &mut EvalCtxt<'_, D>,
377        _goal: Goal<I, Self>,
378    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
379        {
    ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
            format_args!("Future is not const")));
}unreachable!("Future is not const")
380    }
381
382    fn consider_builtin_iterator_candidate(
383        _ecx: &mut EvalCtxt<'_, D>,
384        _goal: Goal<I, Self>,
385    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
386        Err(NoSolutionOrRerunNonErased::NoSolution(NoSolution))
387    }
388
389    fn consider_builtin_fused_iterator_candidate(
390        _ecx: &mut EvalCtxt<'_, D>,
391        _goal: Goal<I, Self>,
392    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
393        {
    ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
            format_args!("FusedIterator is not const")));
}unreachable!("FusedIterator is not const")
394    }
395
396    fn consider_builtin_async_iterator_candidate(
397        _ecx: &mut EvalCtxt<'_, D>,
398        _goal: Goal<I, Self>,
399    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
400        {
    ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
            format_args!("AsyncIterator is not const")));
}unreachable!("AsyncIterator is not const")
401    }
402
403    fn consider_builtin_coroutine_candidate(
404        _ecx: &mut EvalCtxt<'_, D>,
405        _goal: Goal<I, Self>,
406    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
407        {
    ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
            format_args!("Coroutine is not const")));
}unreachable!("Coroutine is not const")
408    }
409
410    fn consider_builtin_discriminant_kind_candidate(
411        _ecx: &mut EvalCtxt<'_, D>,
412        _goal: Goal<I, Self>,
413    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
414        {
    ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
            format_args!("DiscriminantKind is not const")));
}unreachable!("DiscriminantKind is not const")
415    }
416
417    fn consider_builtin_destruct_candidate(
418        ecx: &mut EvalCtxt<'_, D>,
419        goal: Goal<I, Self>,
420    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
421        let cx = ecx.cx();
422
423        let self_ty = goal.predicate.self_ty();
424        let const_conditions = structural_traits::const_conditions_for_destruct(cx, self_ty)?;
425
426        ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|ecx| {
427            ecx.add_goals(
428                GoalSource::AliasBoundConstCondition,
429                const_conditions.into_iter().map(|trait_ref| {
430                    goal.with(
431                        cx,
432                        ty::Binder::dummy(trait_ref)
433                            .to_host_effect_clause(cx, goal.predicate.constness),
434                    )
435                }),
436            )?;
437            ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
438        })
439    }
440
441    fn consider_builtin_transmute_candidate(
442        _ecx: &mut EvalCtxt<'_, D>,
443        _goal: Goal<I, Self>,
444    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
445        {
    ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
            format_args!("TransmuteFrom is not const")));
}unreachable!("TransmuteFrom is not const")
446    }
447
448    fn consider_builtin_bikeshed_guaranteed_no_drop_candidate(
449        _ecx: &mut EvalCtxt<'_, D>,
450        _goal: Goal<I, Self>,
451    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
452        {
    ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
            format_args!("BikeshedGuaranteedNoDrop is not const")));
};unreachable!("BikeshedGuaranteedNoDrop is not const");
453    }
454
455    fn consider_builtin_try_as_dyn_candidate(
456        _ecx: &mut EvalCtxt<'_, D>,
457        goal: Goal<I, Self>,
458    ) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
459        {
    ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
            format_args!("`TryAsDynCompat` is not const: {0:?}", goal)));
}unreachable!("`TryAsDynCompat` is not const: {:?}", goal)
460    }
461
462    fn consider_structural_builtin_unsize_candidates(
463        _ecx: &mut EvalCtxt<'_, D>,
464        _goal: Goal<I, Self>,
465    ) -> Result<Vec<Candidate<I>>, RerunNonErased> {
466        {
    ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
            format_args!("Unsize is not const")));
}unreachable!("Unsize is not const")
467    }
468
469    fn consider_builtin_field_candidate(
470        _ecx: &mut EvalCtxt<'_, D>,
471        _goal: Goal<<D as SolverDelegate>::Interner, Self>,
472    ) -> Result<Candidate<<D as SolverDelegate>::Interner>, NoSolutionOrRerunNonErased> {
473        {
    ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
            format_args!("Field is not const")));
}unreachable!("Field is not const")
474    }
475}
476
477impl<D, I> EvalCtxt<'_, D>
478where
479    D: SolverDelegate<Interner = I>,
480    I: Interner,
481{
482    #[allow(clippy :: suspicious_else_formatting)]
{
    let __tracing_attr_span;
    let __tracing_attr_guard;
    if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::TRACE <=
                    ::tracing::level_filters::LevelFilter::current() ||
            { false } {
        __tracing_attr_span =
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("compute_host_effect_goal",
                                    "rustc_next_trait_solver::solve::effect_goals",
                                    ::tracing::Level::TRACE,
                                    ::tracing_core::__macro_support::Option::Some("compiler/rustc_next_trait_solver/src/solve/effect_goals.rs"),
                                    ::tracing_core::__macro_support::Option::Some(482u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::effect_goals"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("goal")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("goal");
                                                        NAME.as_str()
                                                    }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                    ::tracing::metadata::Kind::SPAN)
                            };
                        ::tracing::callsite::DefaultCallsite::new(&META)
                    };
                let mut interest = ::tracing::subscriber::Interest::never();
                if ::tracing::Level::TRACE <=
                                    ::tracing::level_filters::STATIC_MAX_LEVEL &&
                                ::tracing::Level::TRACE <=
                                    ::tracing::level_filters::LevelFilter::current() &&
                            { interest = __CALLSITE.interest(); !interest.is_never() }
                        &&
                        ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                            interest) {
                    let meta = __CALLSITE.metadata();
                    ::tracing::Span::new(meta,
                        &{
                                #[allow(unused_imports)]
                                use ::tracing::field::{debug, display, Value};
                                meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&goal)
                                                            as &dyn ::tracing::field::Value))])
                            })
                } else {
                    let span =
                        ::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
                    {};
                    span
                }
            };
        __tracing_attr_guard = __tracing_attr_span.enter();
    }

    #[warn(clippy :: suspicious_else_formatting)]
    {

        #[allow(unknown_lints, unreachable_code, clippy ::
        diverging_sub_expression, clippy :: empty_loop, clippy ::
        let_unit_value, clippy :: let_with_type_underscore, clippy ::
        needless_return, clippy :: unreachable)]
        if false {
            let __tracing_attr_fake_return: QueryResultOrRerunNonErased<I> =
                loop {};
            return __tracing_attr_fake_return;
        }
        {
            let (_, proven_via) =
                self.probe(|_|
                                ProbeKind::ShadowedEnvProbing).enter(|ecx|
                            {
                                let trait_goal: Goal<I, ty::TraitPredicate<I>> =
                                    goal.with(ecx.cx(), goal.predicate.trait_ref);
                                ecx.compute_trait_goal(trait_goal).map_err(Into::into)
                            })?;
            self.assemble_and_merge_candidates(proven_via, goal, |_ecx| None,
                |_ecx| Err(NoSolution.into()))
        }
    }
}#[instrument(level = "trace", skip(self))]
483    pub(super) fn compute_host_effect_goal(
484        &mut self,
485        goal: Goal<I, ty::HostEffectClause<I>>,
486    ) -> QueryResultOrRerunNonErased<I> {
487        let (_, proven_via) = self.probe(|_| ProbeKind::ShadowedEnvProbing).enter(|ecx| {
488            let trait_goal: Goal<I, ty::TraitPredicate<I>> =
489                goal.with(ecx.cx(), goal.predicate.trait_ref);
490            ecx.compute_trait_goal(trait_goal).map_err(Into::into)
491        })?;
492        self.assemble_and_merge_candidates(
493            proven_via,
494            goal,
495            |_ecx| None,
496            |_ecx| Err(NoSolution.into()),
497        )
498    }
499}