Rollup merge of #59216 - stepnivlk:type_dependent_defs-wrappers, r=oli-obk
Type dependent defs wrappers First of all, forgive me if something would seem lame to you or I offend some rule (although I tried to read through docs), this is my first PR. Issue: https://github.com/rust-lang/rust/issues/59094 This PR adds 3 helper methods to `TypeckTables`: * `opt_type_dependent_def` * `opt_type_dependent_def_id` * `type_dependent_def_id` I didn't add `type_dependent_def` as was proposed in the issue simply because it wasn't used anywhere in the code. Only non-option wrapped`type_dependent_defs()[]` accesses were found in clippy which always called `def_id()` on result. Speaking of clippy, should I open separate PR in its own repo, given it's used as submodule here? Sry it took me so long, as I said I'm new here and I had tough week :).
This commit is contained in:
commit
4720fcac4c
10 changed files with 24 additions and 19 deletions
|
|
@ -405,8 +405,7 @@ fn check_expr_kind<'a, 'tcx>(
|
|||
for index in hirvec.iter() {
|
||||
method_call_result &= v.check_expr(index);
|
||||
}
|
||||
if let Some(def) = v.tables.type_dependent_defs().get(e.hir_id) {
|
||||
let def_id = def.def_id();
|
||||
if let Some(def_id) = v.tables.type_dependent_def_id(e.hir_id) {
|
||||
match v.tcx.associated_item(def_id).container {
|
||||
ty::ImplContainer(_) => method_call_result & v.handle_const_fn_call(def_id),
|
||||
ty::TraitContainer(_) => NotPromotable,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue