diff options
| -rw-r--r-- | compiler/rustc_passes/src/check_attr.rs | 1 | ||||
| -rw-r--r-- | library/std/src/io/error.rs | 1 | ||||
| -rw-r--r-- | library/std/src/thread/mod.rs | 1 | ||||
| -rw-r--r-- | tests/rustdoc-js-std/unbox-type-result.js | 20 | ||||
| -rw-r--r-- | tests/rustdoc-js/generics-unbox.js | 6 | ||||
| -rw-r--r-- | tests/rustdoc-js/generics-unbox.rs | 12 |
6 files changed, 41 insertions, 0 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 9161b23428a..c5142507812 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -1109,6 +1109,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { ItemKind::Trait(_, _, _, generics, _, items) if generics.params.len() != 0 || items.iter().any(|item| matches!(item.kind, AssocItemKind::Type)) => {} + ItemKind::TyAlias(_, _, generics) if generics.params.len() != 0 => {} _ => { self.dcx().emit_err(errors::DocSearchUnboxInvalid { span: meta.span() }); } diff --git a/library/std/src/io/error.rs b/library/std/src/io/error.rs index 2498fb8d24f..cf3778bd290 100644 --- a/library/std/src/io/error.rs +++ b/library/std/src/io/error.rs @@ -48,6 +48,7 @@ use crate::{error, fmt, result, sys}; /// } /// ``` #[stable(feature = "rust1", since = "1.0.0")] +#[cfg_attr(not(bootstrap), doc(search_unbox))] pub type Result<T> = result::Result<T, Error>; /// The error type for I/O operations of the [`Read`], [`Write`], [`Seek`], and diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index 3f3ba02361c..2097f1e304c 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -1676,6 +1676,7 @@ impl fmt::Debug for Thread { /// [`Result`]: crate::result::Result /// [`std::panic::resume_unwind`]: crate::panic::resume_unwind #[stable(feature = "rust1", since = "1.0.0")] +#[cfg_attr(not(bootstrap), doc(search_unbox))] pub type Result<T> = crate::result::Result<T, Box<dyn Any + Send + 'static>>; // This packet is used to communicate the return value between the spawned diff --git a/tests/rustdoc-js-std/unbox-type-result.js b/tests/rustdoc-js-std/unbox-type-result.js new file mode 100644 index 00000000000..1f5cba58adf --- /dev/null +++ b/tests/rustdoc-js-std/unbox-type-result.js @@ -0,0 +1,20 @@ +// exact-check + +// Test case for https://github.com/rust-lang/rust/issues/139665 +// make sure that std::io::Result and std::thread::Result get unboxed + +const EXPECTED = [ + { + query: "File -> Metadata", + others: [ + { path: "std::fs::File", name: "metadata" }, + { path: "std::fs::File", name: "metadata_at" }, + ] + }, + { + query: "JoinHandle<T> -> T", + others: [ + { path: "std::thread::JoinHandle", name: "join" }, + ] + }, +]; diff --git a/tests/rustdoc-js/generics-unbox.js b/tests/rustdoc-js/generics-unbox.js index 6baf00c814b..a4f2ba8e3a6 100644 --- a/tests/rustdoc-js/generics-unbox.js +++ b/tests/rustdoc-js/generics-unbox.js @@ -31,4 +31,10 @@ const EXPECTED = [ { 'path': 'generics_unbox', 'name': 'beta' }, ], }, + { + 'query': '-> Sigma', + 'others': [ + { 'path': 'generics_unbox', 'name': 'delta' }, + ], + }, ]; diff --git a/tests/rustdoc-js/generics-unbox.rs b/tests/rustdoc-js/generics-unbox.rs index c2578575997..b16e35ee3d4 100644 --- a/tests/rustdoc-js/generics-unbox.rs +++ b/tests/rustdoc-js/generics-unbox.rs @@ -42,3 +42,15 @@ pub fn beta<T, U>(_: Inside<T>) -> Out<Out3<T, U>, Out4<U, T>> { pub fn gamma<T, U>(_: Inside<T>) -> Out<Out3<U, T>, Out4<T, U>> { loop {} } + +pub fn delta(_: i32) -> Epsilon<Sigma> { + loop {} +} + +#[doc(search_unbox)] +pub struct Theta<T>(T); + +#[doc(search_unbox)] +pub type Epsilon<T> = Theta<T>; + +pub struct Sigma; |
