Skip to content

Commit c353337

Browse files
committed
rustdoc-search: simplify rules for generics and type params
This commit is a response to feedback on the displayed type signatures results, by making generics act stricter. Generics are tightened by making order significant. This means `Vec<Allocator>` now matches only with a true vector of allocators, instead of matching the second type param. It also makes unboxing within generics stricter, so `Result<A, B>` only matches if `B` is in the error type and `A` is in the success type. The top level of the function search is unaffected. Find the discussion on: * <https://rust-lang.zulipchat.com/#narrow/stream/393423-t-rustdoc.2Fmeetings/topic/meeting.202024-07-08/near/449965149> * <rust-lang#124544 (comment)> * <https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/deciding.20on.20semantics.20of.20generics.20in.20rustdoc.20search/near/476841363>
1 parent 8c0bdb3 commit c353337

File tree

6 files changed

+6
-0
lines changed

6 files changed

+6
-0
lines changed

alloc/src/boxed.rs

+1
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ pub use thin::ThinBox;
225225
#[fundamental]
226226
#[stable(feature = "rust1", since = "1.0.0")]
227227
#[rustc_insignificant_dtor]
228+
#[cfg_attr(not(bootstrap), doc(search_unbox))]
228229
// The declaration of the `Box` struct must be kept in sync with the
229230
// compiler or ICEs will happen.
230231
pub struct Box<

alloc/src/rc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ fn rc_inner_layout_for_value_layout(layout: Layout) -> Layout {
307307
/// `value.get_mut()`. This avoids conflicts with methods of the inner type `T`.
308308
///
309309
/// [get_mut]: Rc::get_mut
310+
#[cfg_attr(not(bootstrap), doc(search_unbox))]
310311
#[cfg_attr(not(test), rustc_diagnostic_item = "Rc")]
311312
#[stable(feature = "rust1", since = "1.0.0")]
312313
#[rustc_insignificant_dtor]

alloc/src/sync.rs

+1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ macro_rules! acquire {
235235
/// counting in general.
236236
///
237237
/// [rc_examples]: crate::rc#examples
238+
#[cfg_attr(not(bootstrap), doc(search_unbox))]
238239
#[cfg_attr(not(test), rustc_diagnostic_item = "Arc")]
239240
#[stable(feature = "rust1", since = "1.0.0")]
240241
#[rustc_insignificant_dtor]

core/src/future/future.rs

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use crate::task::{Context, Poll};
2525
/// [`async`]: ../../std/keyword.async.html
2626
/// [`Waker`]: crate::task::Waker
2727
#[doc(notable_trait)]
28+
#[cfg_attr(not(bootstrap), doc(search_unbox))]
2829
#[must_use = "futures do nothing unless you `.await` or poll them"]
2930
#[stable(feature = "futures_api", since = "1.36.0")]
3031
#[lang = "future_trait"]

core/src/option.rs

+1
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ use crate::pin::Pin;
563563
use crate::{cmp, convert, hint, mem, slice};
564564

565565
/// The `Option` type. See [the module level documentation](self) for more.
566+
#[cfg_attr(not(bootstrap), doc(search_unbox))]
566567
#[derive(Copy, Eq, Debug, Hash)]
567568
#[rustc_diagnostic_item = "Option"]
568569
#[lang = "Option"]

core/src/result.rs

+1
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ use crate::{convert, fmt, hint};
520520
/// `Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]).
521521
///
522522
/// See the [module documentation](self) for details.
523+
#[cfg_attr(not(bootstrap), doc(search_unbox))]
523524
#[derive(Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
524525
#[must_use = "this `Result` may be an `Err` variant, which should be handled"]
525526
#[rustc_diagnostic_item = "Result"]

0 commit comments

Comments
 (0)