Skip to content

Commit 3f8919c

Browse files
get rid of a bit more calls to poly_select
1 parent 018c3e2 commit 3f8919c

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

compiler/rustc_middle/src/query/keys.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,11 @@ impl<'tcx> Key for (LocalDefId, DefId, SubstsRef<'tcx>) {
318318
}
319319
}
320320

321-
impl<'tcx> Key for (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>) {
321+
impl<'tcx> Key for (ty::ParamEnv<'tcx>, ty::TraitRef<'tcx>) {
322322
type CacheSelector = DefaultCacheSelector<Self>;
323323

324324
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
325-
tcx.def_span(self.1.def_id())
325+
tcx.def_span(self.1.def_id)
326326
}
327327
}
328328

compiler/rustc_middle/src/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ rustc_queries! {
12781278
}
12791279

12801280
query codegen_select_candidate(
1281-
key: (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)
1281+
key: (ty::ParamEnv<'tcx>, ty::TraitRef<'tcx>)
12821282
) -> Result<&'tcx ImplSource<'tcx, ()>, CodegenObligationError> {
12831283
cache_on_disk_if { true }
12841284
desc { |tcx| "computing candidate for `{}`", key.1 }

compiler/rustc_monomorphize/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ fn custom_coerce_unsize_info<'tcx>(
3131
source_ty: Ty<'tcx>,
3232
target_ty: Ty<'tcx>,
3333
) -> CustomCoerceUnsized {
34-
let trait_ref = ty::Binder::dummy(ty::TraitRef::from_lang_item(
34+
let trait_ref = ty::TraitRef::from_lang_item(
3535
tcx.tcx,
3636
LangItem::CoerceUnsized,
3737
tcx.span,
3838
[source_ty, target_ty],
39-
));
39+
);
4040

4141
match tcx.codegen_select_candidate((ty::ParamEnv::reveal_all(), trait_ref)) {
4242
Ok(traits::ImplSource::UserDefined(traits::ImplSourceUserDefinedData {

compiler/rustc_trait_selection/src/traits/auto_trait.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,19 @@ impl<'tcx> AutoTraitFinder<'tcx> {
9191
let infcx = tcx.infer_ctxt().build();
9292
let mut selcx = SelectionContext::new(&infcx);
9393
for polarity in [true, false] {
94-
let result = selcx.poly_select(&Obligation::new(
94+
let result = selcx.select(&Obligation::new(
9595
tcx,
9696
ObligationCause::dummy(),
9797
orig_env,
98-
ty::Binder::dummy(ty::TraitPredicate {
98+
ty::TraitPredicate {
9999
trait_ref,
100100
constness: ty::BoundConstness::NotConst,
101101
polarity: if polarity {
102102
ImplPolarity::Positive
103103
} else {
104104
ImplPolarity::Negative
105105
},
106-
}),
106+
},
107107
));
108108
if let Ok(Some(ImplSource::UserDefined(_))) = result {
109109
debug!(

compiler/rustc_trait_selection/src/traits/vtable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ pub(crate) fn vtable_trait_upcasting_coercion_new_vptr_slot<'tcx>(
362362

363363
let trait_ref = ty::TraitRef::new(tcx, unsize_trait_did, [source, target]);
364364

365-
match tcx.codegen_select_candidate((ty::ParamEnv::reveal_all(), ty::Binder::dummy(trait_ref))) {
365+
match tcx.codegen_select_candidate((ty::ParamEnv::reveal_all(), trait_ref)) {
366366
Ok(ImplSource::TraitUpcasting(implsrc_traitcasting)) => {
367367
implsrc_traitcasting.vtable_vptr_slot
368368
}

compiler/rustc_traits/src/codegen.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use rustc_trait_selection::traits::{
2222
/// This also expects that `trait_ref` is fully normalized.
2323
pub fn codegen_select_candidate<'tcx>(
2424
tcx: TyCtxt<'tcx>,
25-
(param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>),
25+
(param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::TraitRef<'tcx>),
2626
) -> Result<&'tcx ImplSource<'tcx, ()>, CodegenObligationError> {
2727
// We expect the input to be fully normalized.
2828
debug_assert_eq!(trait_ref, tcx.normalize_erasing_regions(param_env, trait_ref));
@@ -35,7 +35,7 @@ pub fn codegen_select_candidate<'tcx>(
3535
let obligation_cause = ObligationCause::dummy();
3636
let obligation = Obligation::new(tcx, obligation_cause, param_env, trait_ref);
3737

38-
let selection = match selcx.poly_select(&obligation) {
38+
let selection = match selcx.select(&obligation) {
3939
Ok(Some(selection)) => selection,
4040
Ok(None) => return Err(CodegenObligationError::Ambiguity),
4141
Err(Unimplemented) => return Err(CodegenObligationError::Unimplemented),

compiler/rustc_ty_utils/src/instance.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ fn resolve_associated_item<'tcx>(
8080

8181
let trait_ref = ty::TraitRef::from_method(tcx, trait_id, rcvr_substs);
8282

83-
let vtbl = match tcx.codegen_select_candidate((param_env, ty::Binder::dummy(trait_ref))) {
83+
let vtbl = match tcx.codegen_select_candidate((param_env, trait_ref)) {
8484
Ok(vtbl) => vtbl,
8585
Err(CodegenObligationError::Ambiguity) => {
8686
let reported = tcx.sess.delay_span_bug(

0 commit comments

Comments
 (0)