From 04cdad0fa587dea94bbde60a39dd55967f7ac7f0 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 10 Dec 2021 09:55:36 -0700 Subject: [PATCH] Add regression test for #78160 --- .../doc-notable_trait-mut_t_is_not_ref_t.rs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/test/rustdoc/doc-notable_trait-mut_t_is_not_ref_t.rs diff --git a/src/test/rustdoc/doc-notable_trait-mut_t_is_not_ref_t.rs b/src/test/rustdoc/doc-notable_trait-mut_t_is_not_ref_t.rs new file mode 100644 index 00000000000..b359dcea0ff --- /dev/null +++ b/src/test/rustdoc/doc-notable_trait-mut_t_is_not_ref_t.rs @@ -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 {} +}