diff options
| author | Michael Goulet <michael@errs.io> | 2024-01-05 23:41:42 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-05 23:41:42 -0500 |
| commit | 9585ebc269d5e59d2cb36d53ec685e9650459dcd (patch) | |
| tree | e3e2e4702823ed3fc99af434720821cd54ed9241 /compiler | |
| parent | 98ba299a48cdb6eb9cbfe62e11391e3202c60c03 (diff) | |
| parent | eeaea576008f53e259c0f86cdd37f28bed9034a1 (diff) | |
| download | rust-9585ebc269d5e59d2cb36d53ec685e9650459dcd.tar.gz rust-9585ebc269d5e59d2cb36d53ec685e9650459dcd.zip | |
Rollup merge of #119420 - cjgillot:issue-119295, r=compiler-errors
Handle ForeignItem as TAIT scope. Fixes #119295
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs b/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs index 5a73097b0f6..da7279967da 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs @@ -69,6 +69,7 @@ pub(super) fn find_opaque_ty_constraints_for_tait(tcx: TyCtxt<'_>, def_id: Local Node::Item(it) => locator.visit_item(it), Node::ImplItem(it) => locator.visit_impl_item(it), Node::TraitItem(it) => locator.visit_trait_item(it), + Node::ForeignItem(it) => locator.visit_foreign_item(it), other => bug!("{:?} is not a valid scope for an opaque type item", other), } } @@ -240,6 +241,12 @@ impl<'tcx> intravisit::Visitor<'tcx> for TaitConstraintLocator<'tcx> { self.check(it.owner_id.def_id); intravisit::walk_trait_item(self, it); } + fn visit_foreign_item(&mut self, it: &'tcx hir::ForeignItem<'tcx>) { + trace!(?it.owner_id); + assert_ne!(it.owner_id.def_id, self.def_id); + // No need to call `check`, as we do not run borrowck on foreign items. + intravisit::walk_foreign_item(self, it); + } } pub(super) fn find_opaque_ty_constraints_for_rpit<'tcx>( |
