diff options
| author | bors <bors@rust-lang.org> | 2023-01-20 12:58:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-01-20 12:58:13 +0000 |
| commit | 04a41f889f563b2384c63c990b5423d201d62ebd (patch) | |
| tree | 9d9e675e350653f151e0e956cc568d863ef6cd7d /compiler/rustc_middle/src | |
| parent | 56ee85274e5a3a4dda92f3bf73d1664c74ff9c15 (diff) | |
| parent | c42fad8ff3b912719e5cbedc6756c6d1f27f8db3 (diff) | |
| download | rust-04a41f889f563b2384c63c990b5423d201d62ebd.tar.gz rust-04a41f889f563b2384c63c990b5423d201d62ebd.zip | |
Auto merge of #107105 - matthiaskrgr:rollup-rkz9t7r, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #106783 (Recover labels written as identifiers) - #106973 (Don't treat closures from other crates as local) - #106979 (Document how to get the type of a default associated type) - #107053 (signal update string representation for haiku.) - #107058 (Recognise double-equals homoglyph) - #107067 (Custom MIR: Support storage statements) - #107076 (Added const-generic ui test case for issue #106419) - #107091 (Fix broken format strings in `infer.ftl`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/ty/assoc.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/assoc.rs b/compiler/rustc_middle/src/ty/assoc.rs index 859a58c8998..bb7fba3ee71 100644 --- a/compiler/rustc_middle/src/ty/assoc.rs +++ b/compiler/rustc_middle/src/ty/assoc.rs @@ -37,6 +37,11 @@ impl AssocItem { Ident::new(self.name, tcx.def_ident_span(self.def_id).unwrap()) } + /// Gets the defaultness of the associated item. + /// To get the default associated type, use the [`type_of`] query on the + /// [`DefId`] of the type. + /// + /// [`type_of`]: crate::ty::TyCtxt::type_of pub fn defaultness(&self, tcx: TyCtxt<'_>) -> hir::Defaultness { tcx.impl_defaultness(self.def_id) } |
