diff options
| author | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-09-20 14:11:23 +0900 | 
|---|---|---|
| committer | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-09-24 23:21:19 +0900 | 
| commit | 8fe936099a3a2ea236d40212a340fc4a326eb506 (patch) | |
| tree | 26b0d90d8a211b35dd4a48d312e018d4fe6de4fa /src/librustdoc/scrape_examples.rs | |
| parent | bb5a01617589b5e3ece5a36435fc285bfd13c9a4 (diff) | |
| download | rust-8fe936099a3a2ea236d40212a340fc4a326eb506.tar.gz rust-8fe936099a3a2ea236d40212a340fc4a326eb506.zip | |
separate definitions and `HIR` owners
fix a ui test use `into` fix clippy ui test fix a run-make-fulldeps test implement `IntoQueryParam<DefId>` for `OwnerId` use `OwnerId` for more queries change the type of `ParentOwnerIterator::Item` to `(OwnerId, OwnerNode)`
Diffstat (limited to 'src/librustdoc/scrape_examples.rs')
| -rw-r--r-- | src/librustdoc/scrape_examples.rs | 11 | 
1 files changed, 5 insertions, 6 deletions
| diff --git a/src/librustdoc/scrape_examples.rs b/src/librustdoc/scrape_examples.rs index ca86ac89e85..dfa6ba38b88 100644 --- a/src/librustdoc/scrape_examples.rs +++ b/src/librustdoc/scrape_examples.rs @@ -143,14 +143,14 @@ where // then we need to exit before calling typeck (which will panic). See // test/run-make/rustdoc-scrape-examples-invalid-expr for an example. let hir = tcx.hir(); - if hir.maybe_body_owned_by(ex.hir_id.owner).is_none() { + if hir.maybe_body_owned_by(ex.hir_id.owner.def_id).is_none() { return; } // Get type of function if expression is a function call let (ty, call_span, ident_span) = match ex.kind { hir::ExprKind::Call(f, _) => { - let types = tcx.typeck(ex.hir_id.owner); + let types = tcx.typeck(ex.hir_id.owner.def_id); if let Some(ty) = types.node_type_opt(f.hir_id) { (ty, ex.span, f.span) @@ -160,7 +160,7 @@ where } } hir::ExprKind::MethodCall(path, _, _, call_span) => { - let types = tcx.typeck(ex.hir_id.owner); + let types = tcx.typeck(ex.hir_id.owner.def_id); let Some(def_id) = types.type_dependent_def_id(ex.hir_id) else { trace!("type_dependent_def_id({}) = None", ex.hir_id); return; @@ -183,9 +183,8 @@ where // If the enclosing item has a span coming from a proc macro, then we also don't want to include // the example. - let enclosing_item_span = tcx - .hir() - .span_with_body(tcx.hir().local_def_id_to_hir_id(tcx.hir().get_parent_item(ex.hir_id))); + let enclosing_item_span = + tcx.hir().span_with_body(tcx.hir().get_parent_item(ex.hir_id).into()); if enclosing_item_span.from_expansion() { trace!("Rejecting expr ({call_span:?}) from macro item: {enclosing_item_span:?}"); return; | 
