diff options
| author | lcnr <rust@lcnr.de> | 2024-05-02 15:44:05 +0000 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2024-05-02 15:44:05 +0000 |
| commit | c4e882fd993d575d65e841da02161263c0ff2d16 (patch) | |
| tree | c49538af77086f9702c3ecae390d755d4f03be76 /compiler/rustc_trait_selection/src/solve/eval_ctxt | |
| parent | 80451a485b006bd32732c003a54ee7de457d8266 (diff) | |
| download | rust-c4e882fd993d575d65e841da02161263c0ff2d16.tar.gz rust-c4e882fd993d575d65e841da02161263c0ff2d16.zip | |
shallow resolve in orphan check
Diffstat (limited to 'compiler/rustc_trait_selection/src/solve/eval_ctxt')
| -rw-r--r-- | compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs index 8425d68ab59..1710746ae50 100644 --- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs @@ -27,6 +27,7 @@ use rustc_span::DUMMY_SP; use std::io::Write; use std::ops::ControlFlow; +use crate::traits::coherence; use crate::traits::vtable::{count_own_vtable_entries, prepare_vtable_segments, VtblSegment}; use super::inspect::ProofTreeBuilder; @@ -942,6 +943,17 @@ impl<'tcx> EvalCtxt<'_, 'tcx> { } } + pub(super) fn trait_ref_is_knowable( + &mut self, + param_env: ty::ParamEnv<'tcx>, + trait_ref: ty::TraitRef<'tcx>, + ) -> Result<bool, NoSolution> { + let infcx = self.infcx; + let lazily_normalize_ty = |ty| self.structurally_normalize_ty(param_env, ty); + coherence::trait_ref_is_knowable(infcx, trait_ref, lazily_normalize_ty) + .map(|is_knowable| is_knowable.is_ok()) + } + pub(super) fn can_define_opaque_ty(&self, def_id: impl Into<DefId>) -> bool { self.infcx.can_define_opaque_ty(def_id) } |
