Skip to content

Commit 6c66d34

Browse files
authored
Rollup merge of #91750 - notriddle:notriddle/doc-notable_trait-mut_t_is_not_ref_t, r=Mark-Simulacrum
rustdoc: Add regression test for Iterator as notable trait on &T Closes #78160 This regression test is different from the one in #91748, because while neither of these function should have Iterator marked as a notable trait, the reasons are different. * In this PR, it returns `&T where T: Iterator`. The `mut` is what's missing. * In #91748, it returns `&mut T`. The trait bounds are what's missing.
2 parents 90eb610 + 04cdad0 commit 6c66d34

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//! Test case for [#78160].
2+
//!
3+
//! A SomeTrait that is implemented for `&mut T` should not be marked as
4+
//! "notable" for return values that are `&T`.
5+
//!
6+
//! [#78160]: https://github.com/rust-lang/rust/issues/78160
7+
8+
#![feature(rustdoc_internals)]
9+
10+
#[doc(primitive = "reference")]
11+
/// Some useless docs, wouhou!
12+
///
13+
/// We need to put this in here, because notable traits
14+
/// that are implemented on foreign types don't show up.
15+
mod reference {}
16+
17+
// @has doc_notable_trait_mut_t_is_not_ref_t/fn.fn_no_matches.html
18+
// @!has - '//code[@class="content"]' "impl<'_, I> Iterator for &'_ mut I"
19+
pub fn fn_no_matches<'a, T: Iterator + 'a>() -> &'a T {
20+
loop {}
21+
}

0 commit comments

Comments
 (0)