diff options
| author | bors <bors@rust-lang.org> | 2024-02-20 22:55:07 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-02-20 22:55:07 +0000 |
| commit | 2dc0170233689435f988579a2080f27b02027d21 (patch) | |
| tree | ae3169e55db5932a1b589728ce6c0c90133b237d /compiler/rustc_ty_utils/src/instance.rs | |
| parent | bb594538fc6e84213a6b8d5e165442570aa48923 (diff) | |
| parent | c03f61ba698e0e4a8de5fab63c4d4d63c0805dfd (diff) | |
| download | rust-2dc0170233689435f988579a2080f27b02027d21.tar.gz rust-2dc0170233689435f988579a2080f27b02027d21.zip | |
Auto merge of #121356 - matthiaskrgr:rollup-d80af2s, r=matthiaskrgr
Rollup of 7 pull requests
Successful merges:
- #119203 (Correct the simd_masked_{load,store} intrinsic docs)
- #121277 (Refactor trait implementations in `core::convert::num`.)
- #121322 (Don't ICE when hitting overflow limit in fulfillment loop in next solver)
- #121323 (Don't use raw parameter types in `find_builder_fn`)
- #121344 (Expand weak alias types before collecting constrained/referenced late bound regions + refactorings)
- #121350 (Fix stray trait mismatch in `resolve_associated_item` for `AsyncFn`)
- #121352 (docs: add missing "the" to `str::strip_prefix` doc)
Failed merges:
- #121340 (bootstrap: apply most of clippy's suggestions)
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_ty_utils/src/instance.rs')
| -rw-r--r-- | compiler/rustc_ty_utils/src/instance.rs | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/compiler/rustc_ty_utils/src/instance.rs b/compiler/rustc_ty_utils/src/instance.rs index 5fc93d666ab..3e3bccce47f 100644 --- a/compiler/rustc_ty_utils/src/instance.rs +++ b/compiler/rustc_ty_utils/src/instance.rs @@ -246,7 +246,7 @@ fn resolve_associated_item<'tcx>( span: tcx.def_span(trait_item_id), }) } - } else if tcx.fn_trait_kind_from_def_id(trait_ref.def_id).is_some() { + } else if let Some(target_kind) = tcx.fn_trait_kind_from_def_id(trait_ref.def_id) { // FIXME: This doesn't check for malformed libcore that defines, e.g., // `trait Fn { fn call_once(&self) { .. } }`. This is mostly for extension // methods. @@ -265,13 +265,7 @@ fn resolve_associated_item<'tcx>( } match *rcvr_args.type_at(0).kind() { ty::Closure(closure_def_id, args) => { - let trait_closure_kind = tcx.fn_trait_kind_from_def_id(trait_id).unwrap(); - Some(Instance::resolve_closure( - tcx, - closure_def_id, - args, - trait_closure_kind, - )) + Some(Instance::resolve_closure(tcx, closure_def_id, args, target_kind)) } ty::FnDef(..) | ty::FnPtr(..) => Some(Instance { def: ty::InstanceDef::FnPtrShim(trait_item_id, rcvr_args.type_at(0)), @@ -324,13 +318,7 @@ fn resolve_associated_item<'tcx>( } } ty::Closure(closure_def_id, args) => { - let trait_closure_kind = tcx.fn_trait_kind_from_def_id(trait_id).unwrap(); - Some(Instance::resolve_closure( - tcx, - closure_def_id, - args, - trait_closure_kind, - )) + Some(Instance::resolve_closure(tcx, closure_def_id, args, target_kind)) } ty::FnDef(..) | ty::FnPtr(..) => Some(Instance { def: ty::InstanceDef::FnPtrShim(trait_item_id, rcvr_args.type_at(0)), |
