Repository navigation
rustdoc: Methods from deref is missing methods #160236
Description
Activity
- addedT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.C-bugCategory: This is a bug.Category: This is a bug.
on Jul 30, 2026 - addedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Jul 30, 2026 - removedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Jul 30, 2026 This doesn't appear to be a (recent) regression, since the same issue occurs on 1.97.1 stable https://doc.rust-lang.org/stable/nightly-rustc/rustc_abi/struct.AbiAlign.html.
Gonna take a look in the next days.
So, associated functions (without
self) cannot be called throughDeref, so seems normaly that they're not listed. As for methods with&self, they work as expected. However forselfmethods, it's more tricky as they cannot be called fromDerefunless the type isCopy. So I'll take into account if theDerefed type implementsCopy, and if so, listsselfmethods in this case.However we shouldn't list associated consts either since they cannot be accessed either. Multiple weird things going on here.
Code I used to test:
#![feature(inherent_associated_types)] // Needed for `Y::TWO`. pub struct X { y: Y, } impl std::ops::Deref for X { type Target = Y; fn deref(&self) -> &Self::Target { &self.y } } #[derive(Clone, Copy)] pub struct Y; impl Y { pub const ONE: X = X { y: Y }; pub type TWO = u32; pub fn foo() {} pub fn bar(&self) {} pub fn babar(self) {} } fn main() { let x = Y::ONE; x.bar(); x.babar(); // Since `Y` is `Copy`, it compiles. // `X` doesn't have a `ONE` associated const, so fails to compile. // let y = X::ONE; // `X` doesn't have a `TWO` associated type, so fails to compile. // let y: X::TWO = 0; }
Now let's write the fix.
Yeah, it seems like the whole analysis is just busted right now.
- added 3 commits that reference this issue
on Oct 5, 2026 - added a commit that references this issue
on Oct 6, 2026
Methods from deref is only showing the associated constants, but not the methods, for https://doc.rust-lang.org/nightly/nightly-rustc/rustc_abi/struct.AbiAlign.html.
AbiAlign:

Align (the deref target):