diff options
| author | bors <bors@rust-lang.org> | 2022-09-24 06:55:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-09-24 06:55:32 +0000 |
| commit | 199fe1d169b5aeeca0e527ded26542b7a05ebd79 (patch) | |
| tree | cbceca07ab554de81a565d98cc69b500d3aef4f3 /compiler | |
| parent | 06968954f7e11454d49377629bb57d13253384b9 (diff) | |
| parent | 4fc33e94430d5cab7310d2dc4269137a50e0b783 (diff) | |
Auto merge of #102223 - matthiaskrgr:rollup-wb1qdhk, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - #101780 (Add a platform support document for Android) - #102044 (Remove `RtlGenRandom` (take two)) - #102081 (Adding ignore fuchsia tests for execvp (pre_exec)) - #102082 (Adding ignore fuchsia non-applicable commands) - #102146 (rustdoc: CSS prevent sidebar width change jank) - #102152 (Calculate `ProjectionTy::trait_def_id` for return-position `impl Trait` in trait correctly) - #102175 (Also require other subtrees to always build successfully) - #102176 (Add `llvm-dis` to the set of tools in `ci-llvm`) - #102188 (Update doc after renaming `fn is_zero`) - #102199 (Improve rustdoc GUI tests) - #102218 (Document some missing command-line arguments) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_middle/src/ty/sty.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index e773b3032aa..258fb2e2f9f 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -1133,9 +1133,13 @@ pub struct ProjectionTy<'tcx> { impl<'tcx> ProjectionTy<'tcx> { pub fn trait_def_id(&self, tcx: TyCtxt<'tcx>) -> DefId { - let parent = tcx.parent(self.item_def_id); - assert_eq!(tcx.def_kind(parent), DefKind::Trait); - parent + match tcx.def_kind(self.item_def_id) { + DefKind::AssocTy | DefKind::AssocConst => tcx.parent(self.item_def_id), + DefKind::ImplTraitPlaceholder => { + tcx.parent(tcx.impl_trait_in_trait_parent(self.item_def_id)) + } + kind => bug!("unexpected DefKind in ProjectionTy: {kind:?}"), + } } /// Extracts the underlying trait reference and own substs from this projection. |
