Skip to content

rustdoc: Add regression test for Iterator as notable trait on &T #91750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add regression test for #78160
notriddle committed Dec 10, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 04cdad0fa587dea94bbde60a39dd55967f7ac7f0
21 changes: 21 additions & 0 deletions src/test/rustdoc/doc-notable_trait-mut_t_is_not_ref_t.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//! Test case for [#78160].
//!
//! A SomeTrait that is implemented for `&mut T` should not be marked as
//! "notable" for return values that are `&T`.
//!
//! [#78160]: https://github.com/rust-lang/rust/issues/78160
#![feature(rustdoc_internals)]

#[doc(primitive = "reference")]
/// Some useless docs, wouhou!
///
/// We need to put this in here, because notable traits
/// that are implemented on foreign types don't show up.
mod reference {}

// @has doc_notable_trait_mut_t_is_not_ref_t/fn.fn_no_matches.html
// @!has - '//code[@class="content"]' "impl<'_, I> Iterator for &'_ mut I"
pub fn fn_no_matches<'a, T: Iterator + 'a>() -> &'a T {
loop {}
}