mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
rename codegen_fulfill_obligation
This commit is contained in:
parent
14f2acd0ac
commit
c63020a7c3
@ -1202,14 +1202,11 @@ rustc_queries! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
query codegen_fulfill_obligation(
|
query codegen_select_candidate(
|
||||||
key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)
|
key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)
|
||||||
) -> Result<&'tcx ImplSource<'tcx, ()>, traits::CodegenObligationError> {
|
) -> Result<&'tcx ImplSource<'tcx, ()>, traits::CodegenObligationError> {
|
||||||
cache_on_disk_if { true }
|
cache_on_disk_if { true }
|
||||||
desc { |tcx|
|
desc { |tcx| "computing candidate for `{}`", key.1 }
|
||||||
"checking if `{}` fulfills its obligations",
|
|
||||||
tcx.def_path_str(key.1.def_id())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return all `impl` blocks in the current crate.
|
/// Return all `impl` blocks in the current crate.
|
||||||
|
@ -1024,7 +1024,7 @@ pub enum MethodViolationCode {
|
|||||||
UndispatchableReceiver(Option<Span>),
|
UndispatchableReceiver(Option<Span>),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// These are the error cases for `codegen_fulfill_obligation`.
|
/// These are the error cases for `codegen_select_candidate`.
|
||||||
#[derive(Copy, Clone, Debug, Hash, HashStable, Encodable, Decodable)]
|
#[derive(Copy, Clone, Debug, Hash, HashStable, Encodable, Decodable)]
|
||||||
pub enum CodegenObligationError {
|
pub enum CodegenObligationError {
|
||||||
/// Ambiguity can happen when monomorphizing during trans
|
/// Ambiguity can happen when monomorphizing during trans
|
||||||
|
@ -35,7 +35,7 @@ fn custom_coerce_unsize_info<'tcx>(
|
|||||||
substs: tcx.mk_substs_trait(source_ty, &[target_ty.into()]),
|
substs: tcx.mk_substs_trait(source_ty, &[target_ty.into()]),
|
||||||
});
|
});
|
||||||
|
|
||||||
match tcx.codegen_fulfill_obligation((ty::ParamEnv::reveal_all(), trait_ref)) {
|
match tcx.codegen_select_candidate((ty::ParamEnv::reveal_all(), trait_ref)) {
|
||||||
Ok(traits::ImplSource::UserDefined(traits::ImplSourceUserDefinedData {
|
Ok(traits::ImplSource::UserDefined(traits::ImplSourceUserDefinedData {
|
||||||
impl_def_id,
|
impl_def_id,
|
||||||
..
|
..
|
||||||
|
@ -18,7 +18,7 @@ use rustc_middle::ty::{self, TyCtxt};
|
|||||||
/// obligations *could be* resolved if we wanted to.
|
/// obligations *could be* resolved if we wanted to.
|
||||||
///
|
///
|
||||||
/// This also expects that `trait_ref` is fully normalized.
|
/// This also expects that `trait_ref` is fully normalized.
|
||||||
pub fn codegen_fulfill_obligation<'tcx>(
|
pub fn codegen_select_candidate<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
(param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>),
|
(param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>),
|
||||||
) -> Result<&'tcx ImplSource<'tcx, ()>, CodegenObligationError> {
|
) -> Result<&'tcx ImplSource<'tcx, ()>, CodegenObligationError> {
|
||||||
|
@ -971,7 +971,7 @@ pub fn provide(providers: &mut ty::query::Providers) {
|
|||||||
*providers = ty::query::Providers {
|
*providers = ty::query::Providers {
|
||||||
specialization_graph_of: specialize::specialization_graph_provider,
|
specialization_graph_of: specialize::specialization_graph_provider,
|
||||||
specializes: specialize::specializes,
|
specializes: specialize::specializes,
|
||||||
codegen_fulfill_obligation: codegen::codegen_fulfill_obligation,
|
codegen_select_candidate: codegen::codegen_select_candidate,
|
||||||
own_existential_vtable_entries,
|
own_existential_vtable_entries,
|
||||||
vtable_entries,
|
vtable_entries,
|
||||||
vtable_trait_upcasting_coercion_new_vptr_slot,
|
vtable_trait_upcasting_coercion_new_vptr_slot,
|
||||||
|
@ -3,9 +3,7 @@ use rustc_hir::def_id::{DefId, LocalDefId};
|
|||||||
use rustc_infer::infer::TyCtxtInferExt;
|
use rustc_infer::infer::TyCtxtInferExt;
|
||||||
use rustc_middle::traits::CodegenObligationError;
|
use rustc_middle::traits::CodegenObligationError;
|
||||||
use rustc_middle::ty::subst::SubstsRef;
|
use rustc_middle::ty::subst::SubstsRef;
|
||||||
use rustc_middle::ty::{
|
use rustc_middle::ty::{self, Instance, TyCtxt, TypeVisitable};
|
||||||
self, Instance, TyCtxt, TypeVisitable,
|
|
||||||
};
|
|
||||||
use rustc_span::{sym, DUMMY_SP};
|
use rustc_span::{sym, DUMMY_SP};
|
||||||
use rustc_trait_selection::traits;
|
use rustc_trait_selection::traits;
|
||||||
use traits::{translate_substs, Reveal};
|
use traits::{translate_substs, Reveal};
|
||||||
@ -101,7 +99,7 @@ fn resolve_associated_item<'tcx>(
|
|||||||
|
|
||||||
let trait_ref = ty::TraitRef::from_method(tcx, trait_id, rcvr_substs);
|
let trait_ref = ty::TraitRef::from_method(tcx, trait_id, rcvr_substs);
|
||||||
|
|
||||||
let vtbl = match tcx.codegen_fulfill_obligation((param_env, ty::Binder::dummy(trait_ref))) {
|
let vtbl = match tcx.codegen_select_candidate((param_env, ty::Binder::dummy(trait_ref))) {
|
||||||
Ok(vtbl) => vtbl,
|
Ok(vtbl) => vtbl,
|
||||||
Err(CodegenObligationError::Ambiguity) => {
|
Err(CodegenObligationError::Ambiguity) => {
|
||||||
let reported = tcx.sess.delay_span_bug(
|
let reported = tcx.sess.delay_span_bug(
|
||||||
|
@ -4,13 +4,13 @@ error[E0391]: cycle detected when resolving instance `<LazyUpdim<T, { T::DIM },
|
|||||||
LL | const DIM: usize;
|
LL | const DIM: usize;
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: ...which requires checking if `TensorDimension` fulfills its obligations...
|
note: ...which requires computing candidate for `<LazyUpdim<T, { T::DIM }, DIM> as TensorDimension>`...
|
||||||
--> $DIR/issue-83765.rs:4:1
|
--> $DIR/issue-83765.rs:4:1
|
||||||
|
|
|
|
||||||
LL | trait TensorDimension {
|
LL | trait TensorDimension {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: ...which again requires resolving instance `<LazyUpdim<T, { T::DIM }, DIM> as TensorDimension>::DIM`, completing the cycle
|
= note: ...which again requires resolving instance `<LazyUpdim<T, { T::DIM }, DIM> as TensorDimension>::DIM`, completing the cycle
|
||||||
note: cycle used when checking if `TensorDimension` fulfills its obligations
|
note: cycle used when computing candidate for `<LazyUpdim<T, { T::DIM }, DIM> as TensorDimension>`
|
||||||
--> $DIR/issue-83765.rs:4:1
|
--> $DIR/issue-83765.rs:4:1
|
||||||
|
|
|
|
||||||
LL | trait TensorDimension {
|
LL | trait TensorDimension {
|
||||||
|
Loading…
Reference in New Issue
Block a user