From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/rustdoc/auxiliary/all-item-types.rs | 22 +++ src/test/rustdoc/auxiliary/auto-traits.rs | 3 + .../cross-crate-hidden-assoc-trait-items.rs | 19 ++ .../auxiliary/cross-crate-hidden-impl-parameter.rs | 5 + src/test/rustdoc/auxiliary/elided-lifetime.rs | 11 ++ src/test/rustdoc/auxiliary/empty.rs | 1 + src/test/rustdoc/auxiliary/enum-primitive.rs | 207 +++++++++++++++++++++ src/test/rustdoc/auxiliary/extern-impl-trait.rs | 27 +++ src/test/rustdoc/auxiliary/extern-links.rs | 1 + src/test/rustdoc/auxiliary/external-cross-doc.md | 4 + src/test/rustdoc/auxiliary/external-cross.rs | 3 + src/test/rustdoc/auxiliary/external-doc.md | 3 + src/test/rustdoc/auxiliary/external-macro-src.rs | 15 ++ src/test/rustdoc/auxiliary/html_root.rs | 2 + .../rustdoc/auxiliary/inline-default-methods.rs | 6 + src/test/rustdoc/auxiliary/issue-100204-aux.rs | 13 ++ src/test/rustdoc/auxiliary/issue-13698.rs | 8 + src/test/rustdoc/auxiliary/issue-15318.rs | 16 ++ src/test/rustdoc/auxiliary/issue-17476.rs | 7 + src/test/rustdoc/auxiliary/issue-19190-3.rs | 23 +++ src/test/rustdoc/auxiliary/issue-20646.rs | 7 + src/test/rustdoc/auxiliary/issue-20727.rs | 30 +++ src/test/rustdoc/auxiliary/issue-21092.rs | 12 ++ src/test/rustdoc/auxiliary/issue-21801.rs | 9 + src/test/rustdoc/auxiliary/issue-22025.rs | 10 + src/test/rustdoc/auxiliary/issue-23207-1.rs | 3 + src/test/rustdoc/auxiliary/issue-23207-2.rs | 5 + src/test/rustdoc/auxiliary/issue-26606-macro.rs | 4 + src/test/rustdoc/auxiliary/issue-27362-aux.rs | 10 + src/test/rustdoc/auxiliary/issue-28927-1.rs | 4 + src/test/rustdoc/auxiliary/issue-28927-2.rs | 1 + src/test/rustdoc/auxiliary/issue-29584.rs | 10 + src/test/rustdoc/auxiliary/issue-30109-1.rs | 1 + src/test/rustdoc/auxiliary/issue-34274.rs | 3 + src/test/rustdoc/auxiliary/issue-36031.rs | 9 + src/test/rustdoc/auxiliary/issue-40936.rs | 5 + src/test/rustdoc/auxiliary/issue-46727.rs | 7 + src/test/rustdoc/auxiliary/issue-48414.rs | 5 + src/test/rustdoc/auxiliary/issue-53689.rs | 1 + src/test/rustdoc/auxiliary/issue-57180.rs | 16 ++ src/test/rustdoc/auxiliary/issue-61592.rs | 4 + src/test/rustdoc/auxiliary/issue-73061.rs | 17 ++ src/test/rustdoc/auxiliary/issue-85454.rs | 17 ++ src/test/rustdoc/auxiliary/issue-86620-1.rs | 11 ++ ...issue-98697-reexport-with-anonymous-lifetime.rs | 17 ++ src/test/rustdoc/auxiliary/issue-99221-aux.rs | 20 ++ src/test/rustdoc/auxiliary/issue-99734-aux.rs | 11 ++ src/test/rustdoc/auxiliary/macro_pub_in_module.rs | 13 ++ src/test/rustdoc/auxiliary/masked.rs | 10 + src/test/rustdoc/auxiliary/mod-stackoverflow.rs | 11 ++ src/test/rustdoc/auxiliary/no_html_root.rs | 1 + src/test/rustdoc/auxiliary/normalize-assoc-item.rs | 12 ++ src/test/rustdoc/auxiliary/primitive-doc.rs | 9 + src/test/rustdoc/auxiliary/primitive-reexport.rs | 8 + src/test/rustdoc/auxiliary/pub-extern-crate.rs | 2 + .../rustdoc/auxiliary/pub-use-extern-macros.rs | 21 +++ src/test/rustdoc/auxiliary/real_gimli.rs | 13 ++ src/test/rustdoc/auxiliary/realcore.rs | 15 ++ src/test/rustdoc/auxiliary/reexp-stripped.rs | 11 ++ src/test/rustdoc/auxiliary/reexport-check.rs | 2 + src/test/rustdoc/auxiliary/reexports.rs | 66 +++++++ src/test/rustdoc/auxiliary/rustdoc-default-impl.rs | 23 +++ .../auxiliary/rustdoc-extern-default-method.rs | 11 ++ .../rustdoc/auxiliary/rustdoc-extern-method.rs | 7 + src/test/rustdoc/auxiliary/rustdoc-ffi.rs | 6 + .../auxiliary/rustdoc-impl-parts-crosscrate.rs | 3 + src/test/rustdoc/auxiliary/source-code-bar.rs | 17 ++ src/test/rustdoc/auxiliary/source_code.rs | 1 + src/test/rustdoc/auxiliary/src-links-external.rs | 1 + src/test/rustdoc/auxiliary/trait-alias-mention.rs | 3 + src/test/rustdoc/auxiliary/trait-visibility.rs | 3 + src/test/rustdoc/auxiliary/unit-return.rs | 3 + src/test/rustdoc/auxiliary/unstable-trait.rs | 26 +++ src/test/rustdoc/auxiliary/variant-struct.rs | 5 + 74 files changed, 948 insertions(+) create mode 100644 src/test/rustdoc/auxiliary/all-item-types.rs create mode 100644 src/test/rustdoc/auxiliary/auto-traits.rs create mode 100644 src/test/rustdoc/auxiliary/cross-crate-hidden-assoc-trait-items.rs create mode 100644 src/test/rustdoc/auxiliary/cross-crate-hidden-impl-parameter.rs create mode 100644 src/test/rustdoc/auxiliary/elided-lifetime.rs create mode 100644 src/test/rustdoc/auxiliary/empty.rs create mode 100644 src/test/rustdoc/auxiliary/enum-primitive.rs create mode 100644 src/test/rustdoc/auxiliary/extern-impl-trait.rs create mode 100644 src/test/rustdoc/auxiliary/extern-links.rs create mode 100644 src/test/rustdoc/auxiliary/external-cross-doc.md create mode 100644 src/test/rustdoc/auxiliary/external-cross.rs create mode 100644 src/test/rustdoc/auxiliary/external-doc.md create mode 100644 src/test/rustdoc/auxiliary/external-macro-src.rs create mode 100644 src/test/rustdoc/auxiliary/html_root.rs create mode 100644 src/test/rustdoc/auxiliary/inline-default-methods.rs create mode 100644 src/test/rustdoc/auxiliary/issue-100204-aux.rs create mode 100644 src/test/rustdoc/auxiliary/issue-13698.rs create mode 100644 src/test/rustdoc/auxiliary/issue-15318.rs create mode 100644 src/test/rustdoc/auxiliary/issue-17476.rs create mode 100644 src/test/rustdoc/auxiliary/issue-19190-3.rs create mode 100644 src/test/rustdoc/auxiliary/issue-20646.rs create mode 100644 src/test/rustdoc/auxiliary/issue-20727.rs create mode 100644 src/test/rustdoc/auxiliary/issue-21092.rs create mode 100644 src/test/rustdoc/auxiliary/issue-21801.rs create mode 100644 src/test/rustdoc/auxiliary/issue-22025.rs create mode 100644 src/test/rustdoc/auxiliary/issue-23207-1.rs create mode 100644 src/test/rustdoc/auxiliary/issue-23207-2.rs create mode 100644 src/test/rustdoc/auxiliary/issue-26606-macro.rs create mode 100644 src/test/rustdoc/auxiliary/issue-27362-aux.rs create mode 100644 src/test/rustdoc/auxiliary/issue-28927-1.rs create mode 100644 src/test/rustdoc/auxiliary/issue-28927-2.rs create mode 100644 src/test/rustdoc/auxiliary/issue-29584.rs create mode 100644 src/test/rustdoc/auxiliary/issue-30109-1.rs create mode 100644 src/test/rustdoc/auxiliary/issue-34274.rs create mode 100644 src/test/rustdoc/auxiliary/issue-36031.rs create mode 100644 src/test/rustdoc/auxiliary/issue-40936.rs create mode 100644 src/test/rustdoc/auxiliary/issue-46727.rs create mode 100644 src/test/rustdoc/auxiliary/issue-48414.rs create mode 100644 src/test/rustdoc/auxiliary/issue-53689.rs create mode 100644 src/test/rustdoc/auxiliary/issue-57180.rs create mode 100644 src/test/rustdoc/auxiliary/issue-61592.rs create mode 100644 src/test/rustdoc/auxiliary/issue-73061.rs create mode 100644 src/test/rustdoc/auxiliary/issue-85454.rs create mode 100644 src/test/rustdoc/auxiliary/issue-86620-1.rs create mode 100644 src/test/rustdoc/auxiliary/issue-98697-reexport-with-anonymous-lifetime.rs create mode 100644 src/test/rustdoc/auxiliary/issue-99221-aux.rs create mode 100644 src/test/rustdoc/auxiliary/issue-99734-aux.rs create mode 100644 src/test/rustdoc/auxiliary/macro_pub_in_module.rs create mode 100644 src/test/rustdoc/auxiliary/masked.rs create mode 100644 src/test/rustdoc/auxiliary/mod-stackoverflow.rs create mode 100644 src/test/rustdoc/auxiliary/no_html_root.rs create mode 100644 src/test/rustdoc/auxiliary/normalize-assoc-item.rs create mode 100644 src/test/rustdoc/auxiliary/primitive-doc.rs create mode 100644 src/test/rustdoc/auxiliary/primitive-reexport.rs create mode 100644 src/test/rustdoc/auxiliary/pub-extern-crate.rs create mode 100644 src/test/rustdoc/auxiliary/pub-use-extern-macros.rs create mode 100644 src/test/rustdoc/auxiliary/real_gimli.rs create mode 100644 src/test/rustdoc/auxiliary/realcore.rs create mode 100644 src/test/rustdoc/auxiliary/reexp-stripped.rs create mode 100644 src/test/rustdoc/auxiliary/reexport-check.rs create mode 100644 src/test/rustdoc/auxiliary/reexports.rs create mode 100644 src/test/rustdoc/auxiliary/rustdoc-default-impl.rs create mode 100644 src/test/rustdoc/auxiliary/rustdoc-extern-default-method.rs create mode 100644 src/test/rustdoc/auxiliary/rustdoc-extern-method.rs create mode 100644 src/test/rustdoc/auxiliary/rustdoc-ffi.rs create mode 100644 src/test/rustdoc/auxiliary/rustdoc-impl-parts-crosscrate.rs create mode 100644 src/test/rustdoc/auxiliary/source-code-bar.rs create mode 100644 src/test/rustdoc/auxiliary/source_code.rs create mode 100644 src/test/rustdoc/auxiliary/src-links-external.rs create mode 100644 src/test/rustdoc/auxiliary/trait-alias-mention.rs create mode 100644 src/test/rustdoc/auxiliary/trait-visibility.rs create mode 100644 src/test/rustdoc/auxiliary/unit-return.rs create mode 100644 src/test/rustdoc/auxiliary/unstable-trait.rs create mode 100644 src/test/rustdoc/auxiliary/variant-struct.rs (limited to 'src/test/rustdoc/auxiliary') diff --git a/src/test/rustdoc/auxiliary/all-item-types.rs b/src/test/rustdoc/auxiliary/all-item-types.rs new file mode 100644 index 000000000..f94bd9987 --- /dev/null +++ b/src/test/rustdoc/auxiliary/all-item-types.rs @@ -0,0 +1,22 @@ +#![feature(extern_types)] + +pub mod foo_mod {} +extern "C" { + pub fn foo_ffn(); + pub static FOO_FSTATIC: FooStruct; + pub type FooFType; +} +pub fn foo_fn() {} +pub trait FooTrait {} +pub struct FooStruct; +pub enum FooEnum {} +pub union FooUnion { + x: (), +} +pub type FooType = FooStruct; +pub static FOO_STATIC: FooStruct = FooStruct; +pub const FOO_CONSTANT: FooStruct = FooStruct; +#[macro_export] +macro_rules! foo_macro { + () => (); +} diff --git a/src/test/rustdoc/auxiliary/auto-traits.rs b/src/test/rustdoc/auxiliary/auto-traits.rs new file mode 100644 index 000000000..84976c73b --- /dev/null +++ b/src/test/rustdoc/auxiliary/auto-traits.rs @@ -0,0 +1,3 @@ +#![feature(auto_traits)] + +pub unsafe auto trait Bar {} diff --git a/src/test/rustdoc/auxiliary/cross-crate-hidden-assoc-trait-items.rs b/src/test/rustdoc/auxiliary/cross-crate-hidden-assoc-trait-items.rs new file mode 100644 index 000000000..3baf8a6c0 --- /dev/null +++ b/src/test/rustdoc/auxiliary/cross-crate-hidden-assoc-trait-items.rs @@ -0,0 +1,19 @@ +pub trait Tr { + type VisibleAssoc; + #[doc(hidden)] + type HiddenAssoc; + + const VISIBLE_ASSOC: (); + #[doc(hidden)] + const HIDDEN_ASSOC: (); +} + +pub struct Ty; + +impl Tr for Ty { + type VisibleAssoc = (); + type HiddenAssoc = (); + + const VISIBLE_ASSOC: () = (); + const HIDDEN_ASSOC: () = (); +} diff --git a/src/test/rustdoc/auxiliary/cross-crate-hidden-impl-parameter.rs b/src/test/rustdoc/auxiliary/cross-crate-hidden-impl-parameter.rs new file mode 100644 index 000000000..159531222 --- /dev/null +++ b/src/test/rustdoc/auxiliary/cross-crate-hidden-impl-parameter.rs @@ -0,0 +1,5 @@ +#[doc(hidden)] +pub enum HiddenType {} + +#[doc(hidden)] +pub trait HiddenTrait {} diff --git a/src/test/rustdoc/auxiliary/elided-lifetime.rs b/src/test/rustdoc/auxiliary/elided-lifetime.rs new file mode 100644 index 000000000..4f2c93379 --- /dev/null +++ b/src/test/rustdoc/auxiliary/elided-lifetime.rs @@ -0,0 +1,11 @@ +#![crate_name = "bar"] + +pub struct Ref<'a>(&'a u32); + +pub fn test5(a: &u32) -> Ref { + Ref(a) +} + +pub fn test6(a: &u32) -> Ref<'_> { + Ref(a) +} diff --git a/src/test/rustdoc/auxiliary/empty.rs b/src/test/rustdoc/auxiliary/empty.rs new file mode 100644 index 000000000..d11c69f81 --- /dev/null +++ b/src/test/rustdoc/auxiliary/empty.rs @@ -0,0 +1 @@ +// intentionally empty diff --git a/src/test/rustdoc/auxiliary/enum-primitive.rs b/src/test/rustdoc/auxiliary/enum-primitive.rs new file mode 100644 index 000000000..ed1da253a --- /dev/null +++ b/src/test/rustdoc/auxiliary/enum-primitive.rs @@ -0,0 +1,207 @@ +// Copyright (c) 2015 Anders Kaseorg + +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// “Software”), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: + +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +//! This crate exports a macro `enum_from_primitive!` that wraps an +//! `enum` declaration and automatically adds an implementation of +//! `num::FromPrimitive` (reexported here), to allow conversion from +//! primitive integers to the enum. It therefore provides an +//! alternative to the built-in `#[derive(FromPrimitive)]`, which +//! requires the unstable `std::num::FromPrimitive` and is disabled in +//! Rust 1.0. +//! +//! # Example +//! +//! ``` +//! #[macro_use] extern crate enum_primitive; +//! extern crate num_traits; +//! use num_traits::FromPrimitive; +//! +//! enum_from_primitive! { +//! #[derive(Debug, PartialEq)] +//! enum FooBar { +//! Foo = 17, +//! Bar = 42, +//! Baz, +//! } +//! } +//! +//! fn main() { +//! assert_eq!(FooBar::from_i32(17), Some(FooBar::Foo)); +//! assert_eq!(FooBar::from_i32(42), Some(FooBar::Bar)); +//! assert_eq!(FooBar::from_i32(43), Some(FooBar::Baz)); +//! assert_eq!(FooBar::from_i32(91), None); +//! } +//! ``` + +pub mod num_traits { + pub trait FromPrimitive: Sized { + fn from_i64(n: i64) -> Option; + fn from_u64(n: u64) -> Option; + } +} + +pub use std::option::Option; +pub use num_traits::FromPrimitive; + +/// Helper macro for internal use by `enum_from_primitive!`. +#[macro_export] +macro_rules! enum_from_primitive_impl_ty { + ($meth:ident, $ty:ty, $name:ident, $( $variant:ident )*) => { + #[allow(non_upper_case_globals, unused)] + fn $meth(n: $ty) -> $crate::Option { + $( if n == $name::$variant as $ty { + $crate::Option::Some($name::$variant) + } else )* { + $crate::Option::None + } + } + }; +} + +/// Helper macro for internal use by `enum_from_primitive!`. +#[macro_export] +#[macro_use(enum_from_primitive_impl_ty)] +macro_rules! enum_from_primitive_impl { + ($name:ident, $( $variant:ident )*) => { + impl $crate::FromPrimitive for $name { + enum_from_primitive_impl_ty! { from_i64, i64, $name, $( $variant )* } + enum_from_primitive_impl_ty! { from_u64, u64, $name, $( $variant )* } + } + }; +} + +/// Wrap this macro around an `enum` declaration to get an +/// automatically generated implementation of `num::FromPrimitive`. +#[macro_export] +#[macro_use(enum_from_primitive_impl)] +macro_rules! enum_from_primitive { + ( + $( #[$enum_attr:meta] )* + enum $name:ident { + $( $( #[$variant_attr:meta] )* $variant:ident ),+ + $( = $discriminator:expr, $( $( #[$variant_two_attr:meta] )* $variant_two:ident ),+ )* + } + ) => { + $( #[$enum_attr] )* + enum $name { + $( $( #[$variant_attr] )* $variant ),+ + $( = $discriminator, $( $( #[$variant_two_attr] )* $variant_two ),+ )* + } + enum_from_primitive_impl! { $name, $( $variant )+ $( $( $variant_two )+ )* } + }; + + ( + $( #[$enum_attr:meta] )* + enum $name:ident { + $( $( $( #[$variant_attr:meta] )* $variant:ident ),+ = $discriminator:expr ),* + } + ) => { + $( #[$enum_attr] )* + enum $name { + $( $( $( #[$variant_attr] )* $variant ),+ = $discriminator ),* + } + enum_from_primitive_impl! { $name, $( $( $variant )+ )* } + }; + + ( + $( #[$enum_attr:meta] )* + enum $name:ident { + $( $( #[$variant_attr:meta] )* $variant:ident ),+ + $( = $discriminator:expr, $( $( #[$variant_two_attr:meta] )* $variant_two:ident ),+ )*, + } + ) => { + $( #[$enum_attr] )* + enum $name { + $( $( #[$variant_attr] )* $variant ),+ + $( = $discriminator, $( $( #[$variant_two_attr] )* $variant_two ),+ )*, + } + enum_from_primitive_impl! { $name, $( $variant )+ $( $( $variant_two )+ )* } + }; + + ( + $( #[$enum_attr:meta] )* + enum $name:ident { + $( $( $( #[$variant_attr:meta] )* $variant:ident ),+ = $discriminator:expr ),+, + } + ) => { + $( #[$enum_attr] )* + enum $name { + $( $( $( #[$variant_attr] )* $variant ),+ = $discriminator ),+, + } + enum_from_primitive_impl! { $name, $( $( $variant )+ )+ } + }; + + ( + $( #[$enum_attr:meta] )* + pub enum $name:ident { + $( $( #[$variant_attr:meta] )* $variant:ident ),+ + $( = $discriminator:expr, $( $( #[$variant_two_attr:meta] )* $variant_two:ident ),+ )* + } + ) => { + $( #[$enum_attr] )* + pub enum $name { + $( $( #[$variant_attr] )* $variant ),+ + $( = $discriminator, $( $( #[$variant_two_attr] )* $variant_two ),+ )* + } + enum_from_primitive_impl! { $name, $( $variant )+ $( $( $variant_two )+ )* } + }; + + ( + $( #[$enum_attr:meta] )* + pub enum $name:ident { + $( $( $( #[$variant_attr:meta] )* $variant:ident ),+ = $discriminator:expr ),* + } + ) => { + $( #[$enum_attr] )* + pub enum $name { + $( $( $( #[$variant_attr] )* $variant ),+ = $discriminator ),* + } + enum_from_primitive_impl! { $name, $( $( $variant )+ )* } + }; + + ( + $( #[$enum_attr:meta] )* + pub enum $name:ident { + $( $( #[$variant_attr:meta] )* $variant:ident ),+ + $( = $discriminator:expr, $( $( #[$variant_two_attr:meta] )* $variant_two:ident ),+ )*, + } + ) => { + $( #[$enum_attr] )* + pub enum $name { + $( $( #[$variant_attr] )* $variant ),+ + $( = $discriminator, $( $( #[$variant_two_attr] )* $variant_two ),+ )*, + } + enum_from_primitive_impl! { $name, $( $variant )+ $( $( $variant_two )+ )* } + }; + + ( + $( #[$enum_attr:meta] )* + pub enum $name:ident { + $( $( $( #[$variant_attr:meta] )* $variant:ident ),+ = $discriminator:expr ),+, + } + ) => { + $( #[$enum_attr] )* + pub enum $name { + $( $( $( #[$variant_attr] )* $variant ),+ = $discriminator ),+, + } + enum_from_primitive_impl! { $name, $( $( $variant )+ )+ } + }; +} diff --git a/src/test/rustdoc/auxiliary/extern-impl-trait.rs b/src/test/rustdoc/auxiliary/extern-impl-trait.rs new file mode 100644 index 000000000..dbd543930 --- /dev/null +++ b/src/test/rustdoc/auxiliary/extern-impl-trait.rs @@ -0,0 +1,27 @@ +pub trait Foo { + type Associated; +} + +pub struct X; +pub struct Y; + + +impl Foo for X { + type Associated = (); +} + +impl Foo for Y { + type Associated = (); +} + +impl X { + pub fn returns_sized<'a>(&'a self) -> impl Foo + 'a { + X + } +} + +impl Y { + pub fn returns_unsized<'a>(&'a self) -> Box + 'a> { + Box::new(X) + } +} diff --git a/src/test/rustdoc/auxiliary/extern-links.rs b/src/test/rustdoc/auxiliary/extern-links.rs new file mode 100644 index 000000000..4a835673a --- /dev/null +++ b/src/test/rustdoc/auxiliary/extern-links.rs @@ -0,0 +1 @@ +pub struct Foo; diff --git a/src/test/rustdoc/auxiliary/external-cross-doc.md b/src/test/rustdoc/auxiliary/external-cross-doc.md new file mode 100644 index 000000000..d3c853265 --- /dev/null +++ b/src/test/rustdoc/auxiliary/external-cross-doc.md @@ -0,0 +1,4 @@ +# Cross-crate imported docs + +This file is to make sure `#[doc = include_str!("file.md")]` works when you re-export an item with included +docs. diff --git a/src/test/rustdoc/auxiliary/external-cross.rs b/src/test/rustdoc/auxiliary/external-cross.rs new file mode 100644 index 000000000..5de63cdab --- /dev/null +++ b/src/test/rustdoc/auxiliary/external-cross.rs @@ -0,0 +1,3 @@ +#[deny(missing_docs)] +#[doc = include_str!("external-cross-doc.md")] +pub struct NeedMoreDocs; diff --git a/src/test/rustdoc/auxiliary/external-doc.md b/src/test/rustdoc/auxiliary/external-doc.md new file mode 100644 index 000000000..babde0a05 --- /dev/null +++ b/src/test/rustdoc/auxiliary/external-doc.md @@ -0,0 +1,3 @@ +# External Docs + +This file is here to test the `#[doc = include_str!("file")]` attribute. diff --git a/src/test/rustdoc/auxiliary/external-macro-src.rs b/src/test/rustdoc/auxiliary/external-macro-src.rs new file mode 100644 index 000000000..ce20ca5c9 --- /dev/null +++ b/src/test/rustdoc/auxiliary/external-macro-src.rs @@ -0,0 +1,15 @@ +// compile-flags:--remap-path-prefix={{src-base}}=/does-not-exist + +#![doc(html_root_url = "https://example.com/")] + +#[macro_export] +macro_rules! make_foo { + () => { + pub struct Foo; + impl Foo { + pub fn new() -> Foo { + Foo + } + } + } +} diff --git a/src/test/rustdoc/auxiliary/html_root.rs b/src/test/rustdoc/auxiliary/html_root.rs new file mode 100644 index 000000000..4eb0b700f --- /dev/null +++ b/src/test/rustdoc/auxiliary/html_root.rs @@ -0,0 +1,2 @@ +#![doc(html_root_url="https://example.com/html_root")] +pub fn foo() {} diff --git a/src/test/rustdoc/auxiliary/inline-default-methods.rs b/src/test/rustdoc/auxiliary/inline-default-methods.rs new file mode 100644 index 000000000..8a636f449 --- /dev/null +++ b/src/test/rustdoc/auxiliary/inline-default-methods.rs @@ -0,0 +1,6 @@ +// compile-flags: -Cmetadata=aux + +pub trait Foo { + fn bar(&self); + fn foo(&mut self) {} +} diff --git a/src/test/rustdoc/auxiliary/issue-100204-aux.rs b/src/test/rustdoc/auxiliary/issue-100204-aux.rs new file mode 100644 index 000000000..df1b59069 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-100204-aux.rs @@ -0,0 +1,13 @@ +#![crate_name="first"] + +pub mod prelude { + pub use crate::Bot; +} + +pub struct Bot; + +impl Bot { + pub fn new() -> Bot { + Bot + } +} diff --git a/src/test/rustdoc/auxiliary/issue-13698.rs b/src/test/rustdoc/auxiliary/issue-13698.rs new file mode 100644 index 000000000..a65ebfe36 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-13698.rs @@ -0,0 +1,8 @@ +// compile-flags: -Cmetadata=aux + +pub trait Foo { + #[doc(hidden)] + fn foo(&self) {} +} + +impl Foo for i32 {} diff --git a/src/test/rustdoc/auxiliary/issue-15318.rs b/src/test/rustdoc/auxiliary/issue-15318.rs new file mode 100644 index 000000000..695fa58ef --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-15318.rs @@ -0,0 +1,16 @@ +// no-prefer-dynamic +// compile-flags: -Cmetadata=aux +#![crate_type = "rlib"] +#![doc(html_root_url = "http://example.com/")] +#![feature(lang_items)] +#![no_std] + +#[lang = "eh_personality"] +fn foo() {} + +#[panic_handler] +fn bar(_: &core::panic::PanicInfo) -> ! { loop {} } + +/// dox +#[doc(primitive = "pointer")] +pub mod ptr {} diff --git a/src/test/rustdoc/auxiliary/issue-17476.rs b/src/test/rustdoc/auxiliary/issue-17476.rs new file mode 100644 index 000000000..80c915eb7 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-17476.rs @@ -0,0 +1,7 @@ +// compile-flags: -Cmetadata=aux + +#![doc(html_root_url = "http://example.com")] + +pub trait Foo { + fn foo(&self) {} +} diff --git a/src/test/rustdoc/auxiliary/issue-19190-3.rs b/src/test/rustdoc/auxiliary/issue-19190-3.rs new file mode 100644 index 000000000..8c526a89a --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-19190-3.rs @@ -0,0 +1,23 @@ +// compile-flags: -Cmetadata=aux + +use std::ops::Deref; + +pub struct Foo; + +impl Deref for Foo { + type Target = String; + fn deref(&self) -> &String { loop {} } +} + +pub struct Bar; +pub struct Baz; + +impl Baz { + pub fn baz(&self) {} + pub fn static_baz() {} +} + +impl Deref for Bar { + type Target = Baz; + fn deref(&self) -> &Baz { loop {} } +} diff --git a/src/test/rustdoc/auxiliary/issue-20646.rs b/src/test/rustdoc/auxiliary/issue-20646.rs new file mode 100644 index 000000000..8e16f2de0 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-20646.rs @@ -0,0 +1,7 @@ +// compile-flags: -Cmetadata=aux + +pub trait Trait { + type Output; +} + +pub fn fun(_: T) where T: Trait {} diff --git a/src/test/rustdoc/auxiliary/issue-20727.rs b/src/test/rustdoc/auxiliary/issue-20727.rs new file mode 100644 index 000000000..7ffc1985b --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-20727.rs @@ -0,0 +1,30 @@ +// compile-flags: -Cmetadata=aux + +pub trait Deref { + type Target: ?Sized; + + fn deref<'a>(&'a self) -> &'a Self::Target; +} + +pub trait Add { + type Output; + + fn add(self, rhs: RHS) -> Self::Output; +} + + +pub trait Bar {} +pub trait Deref2 { + type Target: Bar; + + fn deref(&self) -> Self::Target; +} + +pub trait Index { + type Output: ?Sized; + fn index(&self, index: Idx) -> &Self::Output; +} + +pub trait IndexMut: Index { + fn index_mut(&mut self, index: Idx) -> &mut Self::Output; +} diff --git a/src/test/rustdoc/auxiliary/issue-21092.rs b/src/test/rustdoc/auxiliary/issue-21092.rs new file mode 100644 index 000000000..51ab7de1c --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-21092.rs @@ -0,0 +1,12 @@ +// compile-flags: -Cmetadata=aux + +pub trait Foo { + type Bar; + fn foo(&self) {} +} + +pub struct Bar; + +impl Foo for Bar { + type Bar = i32; +} diff --git a/src/test/rustdoc/auxiliary/issue-21801.rs b/src/test/rustdoc/auxiliary/issue-21801.rs new file mode 100644 index 000000000..732612ff0 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-21801.rs @@ -0,0 +1,9 @@ +// compile-flags: -Cmetadata=aux + +pub struct Foo; + +impl Foo { + pub fn new(f: F) -> Foo where F: FnMut() -> i32 { + loop {} + } +} diff --git a/src/test/rustdoc/auxiliary/issue-22025.rs b/src/test/rustdoc/auxiliary/issue-22025.rs new file mode 100644 index 000000000..5346c0e92 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-22025.rs @@ -0,0 +1,10 @@ +// compile-flags: -Cmetadata=aux + +pub mod foo { + + pub trait Foo {} + pub struct Bar; + + impl Foo for Bar {} + +} diff --git a/src/test/rustdoc/auxiliary/issue-23207-1.rs b/src/test/rustdoc/auxiliary/issue-23207-1.rs new file mode 100644 index 000000000..8531d5f1a --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-23207-1.rs @@ -0,0 +1,3 @@ +pub mod fmt { + pub struct Error; +} diff --git a/src/test/rustdoc/auxiliary/issue-23207-2.rs b/src/test/rustdoc/auxiliary/issue-23207-2.rs new file mode 100644 index 000000000..b92b16653 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-23207-2.rs @@ -0,0 +1,5 @@ +extern crate issue_23207_1; + +pub mod fmt { + pub use issue_23207_1::fmt::Error; +} diff --git a/src/test/rustdoc/auxiliary/issue-26606-macro.rs b/src/test/rustdoc/auxiliary/issue-26606-macro.rs new file mode 100644 index 000000000..d60d32526 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-26606-macro.rs @@ -0,0 +1,4 @@ +#[macro_export] +macro_rules! make_item ( + ($name: ident) => (pub const $name: usize = 42;) +); diff --git a/src/test/rustdoc/auxiliary/issue-27362-aux.rs b/src/test/rustdoc/auxiliary/issue-27362-aux.rs new file mode 100644 index 000000000..077bdc33e --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-27362-aux.rs @@ -0,0 +1,10 @@ +// compile-flags: -Cmetadata=aux + +pub const fn foo() {} +pub const unsafe fn bar() {} + +pub struct Foo; + +impl Foo { + pub const unsafe fn baz() {} +} diff --git a/src/test/rustdoc/auxiliary/issue-28927-1.rs b/src/test/rustdoc/auxiliary/issue-28927-1.rs new file mode 100644 index 000000000..688c73428 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-28927-1.rs @@ -0,0 +1,4 @@ +mod detail { + pub extern crate issue_28927_2 as inner2; +} +pub use detail::inner2 as bar; diff --git a/src/test/rustdoc/auxiliary/issue-28927-2.rs b/src/test/rustdoc/auxiliary/issue-28927-2.rs new file mode 100644 index 000000000..7c0937fce --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-28927-2.rs @@ -0,0 +1 @@ +pub struct Baz; diff --git a/src/test/rustdoc/auxiliary/issue-29584.rs b/src/test/rustdoc/auxiliary/issue-29584.rs new file mode 100644 index 000000000..a9b8796c0 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-29584.rs @@ -0,0 +1,10 @@ +// compile-flags: -Cmetadata=aux + +pub struct Foo; + +#[doc(hidden)] +mod bar { + trait Bar {} + + impl Bar for ::Foo {} +} diff --git a/src/test/rustdoc/auxiliary/issue-30109-1.rs b/src/test/rustdoc/auxiliary/issue-30109-1.rs new file mode 100644 index 000000000..ca05a6a90 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-30109-1.rs @@ -0,0 +1 @@ +pub struct Bar; diff --git a/src/test/rustdoc/auxiliary/issue-34274.rs b/src/test/rustdoc/auxiliary/issue-34274.rs new file mode 100644 index 000000000..c46660579 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-34274.rs @@ -0,0 +1,3 @@ +extern "C" { + pub fn extern_c_fn(); +} diff --git a/src/test/rustdoc/auxiliary/issue-36031.rs b/src/test/rustdoc/auxiliary/issue-36031.rs new file mode 100644 index 000000000..da688139e --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-36031.rs @@ -0,0 +1,9 @@ +pub trait Foo { + const FOO: usize; +} + +pub struct Bar; + +impl Bar { + pub const BAR: usize = 3; +} diff --git a/src/test/rustdoc/auxiliary/issue-40936.rs b/src/test/rustdoc/auxiliary/issue-40936.rs new file mode 100644 index 000000000..b921e5201 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-40936.rs @@ -0,0 +1,5 @@ +pub mod outermod { + pub mod innermod { + pub use super::*; + } +} diff --git a/src/test/rustdoc/auxiliary/issue-46727.rs b/src/test/rustdoc/auxiliary/issue-46727.rs new file mode 100644 index 000000000..30dccfa77 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-46727.rs @@ -0,0 +1,7 @@ +// compile-flags: -Cmetadata=aux + +pub trait Foo {} + +pub struct Bar { x: T } + +impl Foo for Bar<[T; 1 + 1 + 1]> {} diff --git a/src/test/rustdoc/auxiliary/issue-48414.rs b/src/test/rustdoc/auxiliary/issue-48414.rs new file mode 100644 index 000000000..f442ac722 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-48414.rs @@ -0,0 +1,5 @@ +/// Woah, this trait links to [OtherTrait](OtherTrait)! +pub trait SomeTrait {} + +/// Woah, this trait links to [SomeTrait](SomeTrait)! +pub trait OtherTrait {} diff --git a/src/test/rustdoc/auxiliary/issue-53689.rs b/src/test/rustdoc/auxiliary/issue-53689.rs new file mode 100644 index 000000000..5003c2c00 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-53689.rs @@ -0,0 +1 @@ +pub struct MyStruct; diff --git a/src/test/rustdoc/auxiliary/issue-57180.rs b/src/test/rustdoc/auxiliary/issue-57180.rs new file mode 100644 index 000000000..4e2f4b87c --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-57180.rs @@ -0,0 +1,16 @@ +// compile-flags: -Cmetadata=aux + +pub trait Trait { +} + +pub struct Struct +{ + _p: ::std::marker::PhantomData, +} + +impl u32> +Trait for Struct + where + F: Fn() -> u32, +{ +} diff --git a/src/test/rustdoc/auxiliary/issue-61592.rs b/src/test/rustdoc/auxiliary/issue-61592.rs new file mode 100644 index 000000000..6e16a4caf --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-61592.rs @@ -0,0 +1,4 @@ +#![crate_name = "foo"] + +pub trait FooTrait {} +pub struct FooStruct; diff --git a/src/test/rustdoc/auxiliary/issue-73061.rs b/src/test/rustdoc/auxiliary/issue-73061.rs new file mode 100644 index 000000000..e05a3bc6d --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-73061.rs @@ -0,0 +1,17 @@ +//edition:2018 + +#![feature(type_alias_impl_trait)] + +pub trait Foo { + type X: std::future::Future; + fn x(&self) -> Self::X; +} + +pub struct F; + +impl Foo for F { + type X = impl std::future::Future; + fn x(&self) -> Self::X { + async {} + } +} diff --git a/src/test/rustdoc/auxiliary/issue-85454.rs b/src/test/rustdoc/auxiliary/issue-85454.rs new file mode 100644 index 000000000..45664dfc3 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-85454.rs @@ -0,0 +1,17 @@ +// @has issue_85454/trait.FromResidual.html +// @has - '//pre[@class="rust trait"]' 'pub trait FromResidual::Residual> { fn from_residual(residual: R) -> Self; }' +pub trait FromResidual::Residual> { + fn from_residual(residual: R) -> Self; +} + +pub trait Try: FromResidual { + type Output; + type Residual; + fn from_output(output: Self::Output) -> Self; + fn branch(self) -> ControlFlow; +} + +pub enum ControlFlow { + Continue(C), + Break(B), +} diff --git a/src/test/rustdoc/auxiliary/issue-86620-1.rs b/src/test/rustdoc/auxiliary/issue-86620-1.rs new file mode 100644 index 000000000..f6debf6fb --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-86620-1.rs @@ -0,0 +1,11 @@ +#![crate_name = "issue_86620_1"] + +pub trait VZip { + fn vzip() -> usize; +} + +impl VZip for T { + fn vzip() -> usize { + 0 + } +} diff --git a/src/test/rustdoc/auxiliary/issue-98697-reexport-with-anonymous-lifetime.rs b/src/test/rustdoc/auxiliary/issue-98697-reexport-with-anonymous-lifetime.rs new file mode 100644 index 000000000..4e55e7ed5 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-98697-reexport-with-anonymous-lifetime.rs @@ -0,0 +1,17 @@ +/// When reexporting this function, make sure the anonymous lifetimes are not rendered. +/// +/// https://github.com/rust-lang/rust/issues/98697 +pub fn repro() +where + F: Fn(&str), +{ + unimplemented!() +} + +pub struct Extra; + +pub trait MyTrait { + fn run() {} +} + +impl MyTrait<&Extra> for Extra {} diff --git a/src/test/rustdoc/auxiliary/issue-99221-aux.rs b/src/test/rustdoc/auxiliary/issue-99221-aux.rs new file mode 100644 index 000000000..e061e42b2 --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-99221-aux.rs @@ -0,0 +1,20 @@ +pub struct Option; +impl Option { + pub fn unwrap(self) {} +} + +mod macros { + use crate::Option; + /// [`Option::unwrap`] + #[macro_export] + macro_rules! print { + () => () + } +} + +mod structs { + use crate::Option; + /// [`Option::unwrap`] + pub struct Print; +} +pub use structs::Print; diff --git a/src/test/rustdoc/auxiliary/issue-99734-aux.rs b/src/test/rustdoc/auxiliary/issue-99734-aux.rs new file mode 100644 index 000000000..234d55efb --- /dev/null +++ b/src/test/rustdoc/auxiliary/issue-99734-aux.rs @@ -0,0 +1,11 @@ +pub struct Option; +impl Option { + pub fn unwrap(self) {} +} + +/// [`Option::unwrap`] +pub mod task {} + +extern "C" { + pub fn main() -> std::ffi::c_int; +} diff --git a/src/test/rustdoc/auxiliary/macro_pub_in_module.rs b/src/test/rustdoc/auxiliary/macro_pub_in_module.rs new file mode 100644 index 000000000..137b12386 --- /dev/null +++ b/src/test/rustdoc/auxiliary/macro_pub_in_module.rs @@ -0,0 +1,13 @@ +// edition:2018 + +#![feature(decl_macro)] +#![crate_name = "external_crate"] + +pub mod some_module { + /* == Make sure the logic is not affected by a re-export == */ + mod private { + pub macro external_macro() {} + } + + pub use private::external_macro; +} diff --git a/src/test/rustdoc/auxiliary/masked.rs b/src/test/rustdoc/auxiliary/masked.rs new file mode 100644 index 000000000..f289359e5 --- /dev/null +++ b/src/test/rustdoc/auxiliary/masked.rs @@ -0,0 +1,10 @@ +#[derive(Clone)] +pub struct MaskedStruct; + +pub trait MaskedTrait { + fn masked_method(); +} + +impl MaskedTrait for String { + fn masked_method() {} +} diff --git a/src/test/rustdoc/auxiliary/mod-stackoverflow.rs b/src/test/rustdoc/auxiliary/mod-stackoverflow.rs new file mode 100644 index 000000000..e0b90f180 --- /dev/null +++ b/src/test/rustdoc/auxiliary/mod-stackoverflow.rs @@ -0,0 +1,11 @@ +// compile-flags: -Cmetadata=aux + +pub mod tree { + pub use tree; +} + +pub mod tree2 { + pub mod prelude { + pub use tree2; + } +} diff --git a/src/test/rustdoc/auxiliary/no_html_root.rs b/src/test/rustdoc/auxiliary/no_html_root.rs new file mode 100644 index 000000000..c5c0bc606 --- /dev/null +++ b/src/test/rustdoc/auxiliary/no_html_root.rs @@ -0,0 +1 @@ +pub fn bar() {} diff --git a/src/test/rustdoc/auxiliary/normalize-assoc-item.rs b/src/test/rustdoc/auxiliary/normalize-assoc-item.rs new file mode 100644 index 000000000..fbd111c30 --- /dev/null +++ b/src/test/rustdoc/auxiliary/normalize-assoc-item.rs @@ -0,0 +1,12 @@ +#![crate_name = "inner"] +pub trait MyTrait { + type Y; +} + +impl MyTrait for u32 { + type Y = i32; +} + +pub fn foo() -> ::Y { + 0 +} diff --git a/src/test/rustdoc/auxiliary/primitive-doc.rs b/src/test/rustdoc/auxiliary/primitive-doc.rs new file mode 100644 index 000000000..e8da852a5 --- /dev/null +++ b/src/test/rustdoc/auxiliary/primitive-doc.rs @@ -0,0 +1,9 @@ +// compile-flags: --crate-type lib --edition 2018 + +#![feature(no_core)] +#![no_core] + +#[doc(primitive = "usize")] +/// This is the built-in type `usize`. +mod usize { +} diff --git a/src/test/rustdoc/auxiliary/primitive-reexport.rs b/src/test/rustdoc/auxiliary/primitive-reexport.rs new file mode 100644 index 000000000..b2e9fa43b --- /dev/null +++ b/src/test/rustdoc/auxiliary/primitive-reexport.rs @@ -0,0 +1,8 @@ +// compile-flags: --emit metadata --crate-type lib --edition 2018 + +#![crate_name = "foo"] + +pub mod bar { + pub use bool; + pub use char as my_char; +} diff --git a/src/test/rustdoc/auxiliary/pub-extern-crate.rs b/src/test/rustdoc/auxiliary/pub-extern-crate.rs new file mode 100644 index 000000000..8c89c8d6c --- /dev/null +++ b/src/test/rustdoc/auxiliary/pub-extern-crate.rs @@ -0,0 +1,2 @@ +#![crate_name = "inner"] +pub struct SomeStruct; diff --git a/src/test/rustdoc/auxiliary/pub-use-extern-macros.rs b/src/test/rustdoc/auxiliary/pub-use-extern-macros.rs new file mode 100644 index 000000000..7934e0733 --- /dev/null +++ b/src/test/rustdoc/auxiliary/pub-use-extern-macros.rs @@ -0,0 +1,21 @@ +#![crate_name="macros"] + +#[macro_export] +macro_rules! foo { + () => {}; +} + +#[macro_export] +macro_rules! bar { + () => {}; +} + +#[macro_export] +macro_rules! baz { + () => {}; +} + +#[macro_export] +macro_rules! quux { + () => {}; +} diff --git a/src/test/rustdoc/auxiliary/real_gimli.rs b/src/test/rustdoc/auxiliary/real_gimli.rs new file mode 100644 index 000000000..80d5c4ba8 --- /dev/null +++ b/src/test/rustdoc/auxiliary/real_gimli.rs @@ -0,0 +1,13 @@ +// aux-build:realcore.rs + +#![crate_name = "real_gimli"] +#![feature(staged_api, extremely_unstable)] +#![unstable(feature = "rustc_private", issue = "none")] + +extern crate realcore; + +#[unstable(feature = "rustc_private", issue = "none")] +pub struct EndianSlice; + +#[unstable(feature = "rustc_private", issue = "none")] +impl realcore::Deref for EndianSlice {} diff --git a/src/test/rustdoc/auxiliary/realcore.rs b/src/test/rustdoc/auxiliary/realcore.rs new file mode 100644 index 000000000..e0a906df0 --- /dev/null +++ b/src/test/rustdoc/auxiliary/realcore.rs @@ -0,0 +1,15 @@ +#![crate_name = "realcore"] +#![feature(staged_api)] +#![unstable(feature = "extremely_unstable", issue = "none")] + +#[unstable(feature = "extremely_unstable_foo", issue = "none")] +pub struct Foo {} + +#[unstable(feature = "extremely_unstable_foo", issue = "none")] +pub trait Join {} + +#[unstable(feature = "extremely_unstable_foo", issue = "none")] +impl Join for Foo {} + +#[stable(feature = "faked_deref", since = "1.47.0")] +pub trait Deref {} diff --git a/src/test/rustdoc/auxiliary/reexp-stripped.rs b/src/test/rustdoc/auxiliary/reexp-stripped.rs new file mode 100644 index 000000000..ccc3dc11f --- /dev/null +++ b/src/test/rustdoc/auxiliary/reexp-stripped.rs @@ -0,0 +1,11 @@ +pub use private::Quz; +pub use hidden::Bar; + +mod private { + pub struct Quz; +} + +#[doc(hidden)] +pub mod hidden { + pub struct Bar; +} diff --git a/src/test/rustdoc/auxiliary/reexport-check.rs b/src/test/rustdoc/auxiliary/reexport-check.rs new file mode 100644 index 000000000..672ccb1cf --- /dev/null +++ b/src/test/rustdoc/auxiliary/reexport-check.rs @@ -0,0 +1,2 @@ +/// Docs in original +pub struct S; diff --git a/src/test/rustdoc/auxiliary/reexports.rs b/src/test/rustdoc/auxiliary/reexports.rs new file mode 100644 index 000000000..4336993a3 --- /dev/null +++ b/src/test/rustdoc/auxiliary/reexports.rs @@ -0,0 +1,66 @@ +#![feature(decl_macro)] + +pub macro addr_of($place:expr) { + &raw const $place +} + +pub macro addr_of_crate($place:expr) { + &raw const $place +} + +pub macro addr_of_super($place:expr) { + &raw const $place +} + +pub macro addr_of_self($place:expr) { + &raw const $place +} + +pub macro addr_of_local($place:expr) { + &raw const $place +} + +pub struct Foo; +pub struct FooCrate; +pub struct FooSuper; +pub struct FooSelf; +pub struct FooLocal; + +pub enum Bar { Foo, } +pub enum BarCrate { Foo, } +pub enum BarSuper { Foo, } +pub enum BarSelf { Foo, } +pub enum BarLocal { Foo, } + +pub fn foo() {} +pub fn foo_crate() {} +pub fn foo_super() {} +pub fn foo_self() {} +pub fn foo_local() {} + +pub type Type = i32; +pub type TypeCrate = i32; +pub type TypeSuper = i32; +pub type TypeSelf = i32; +pub type TypeLocal = i32; + +pub union Union { + a: i8, + b: i8, +} +pub union UnionCrate { + a: i8, + b: i8, +} +pub union UnionSuper { + a: i8, + b: i8, +} +pub union UnionSelf { + a: i8, + b: i8, +} +pub union UnionLocal { + a: i8, + b: i8, +} diff --git a/src/test/rustdoc/auxiliary/rustdoc-default-impl.rs b/src/test/rustdoc/auxiliary/rustdoc-default-impl.rs new file mode 100644 index 000000000..032db3b25 --- /dev/null +++ b/src/test/rustdoc/auxiliary/rustdoc-default-impl.rs @@ -0,0 +1,23 @@ +#![feature(auto_traits)] + +pub mod bar { + use std::marker; + + pub auto trait Bar {} + + pub trait Foo { + fn foo(&self) {} + } + + impl Foo { + pub fn test(&self) {} + } + + pub struct TypeId; + + impl TypeId { + pub fn of() -> TypeId { + panic!() + } + } +} diff --git a/src/test/rustdoc/auxiliary/rustdoc-extern-default-method.rs b/src/test/rustdoc/auxiliary/rustdoc-extern-default-method.rs new file mode 100644 index 000000000..12934238a --- /dev/null +++ b/src/test/rustdoc/auxiliary/rustdoc-extern-default-method.rs @@ -0,0 +1,11 @@ +#![crate_type="lib"] + +pub trait Trait { + fn provided(&self) {} +} + +pub struct Struct; + +impl Trait for Struct { + fn provided(&self) {} +} diff --git a/src/test/rustdoc/auxiliary/rustdoc-extern-method.rs b/src/test/rustdoc/auxiliary/rustdoc-extern-method.rs new file mode 100644 index 000000000..e493048d9 --- /dev/null +++ b/src/test/rustdoc/auxiliary/rustdoc-extern-method.rs @@ -0,0 +1,7 @@ +#![crate_type="lib"] +#![feature(unboxed_closures)] + +pub trait Foo { + extern "rust-call" fn foo(&self, _: ()) -> i32; + extern "rust-call" fn foo_(&self, _: ()) -> i32 { 0 } +} diff --git a/src/test/rustdoc/auxiliary/rustdoc-ffi.rs b/src/test/rustdoc/auxiliary/rustdoc-ffi.rs new file mode 100644 index 000000000..b74d190b5 --- /dev/null +++ b/src/test/rustdoc/auxiliary/rustdoc-ffi.rs @@ -0,0 +1,6 @@ +#![crate_type="lib"] + +extern "C" { + // @has lib/fn.foreigner.html //pre 'pub unsafe fn foreigner(cold_as_ice: u32)' + pub fn foreigner(cold_as_ice: u32); +} diff --git a/src/test/rustdoc/auxiliary/rustdoc-impl-parts-crosscrate.rs b/src/test/rustdoc/auxiliary/rustdoc-impl-parts-crosscrate.rs new file mode 100644 index 000000000..135987fc0 --- /dev/null +++ b/src/test/rustdoc/auxiliary/rustdoc-impl-parts-crosscrate.rs @@ -0,0 +1,3 @@ +#![feature(auto_traits)] + +pub auto trait AnAutoTrait {} diff --git a/src/test/rustdoc/auxiliary/source-code-bar.rs b/src/test/rustdoc/auxiliary/source-code-bar.rs new file mode 100644 index 000000000..8700d688e --- /dev/null +++ b/src/test/rustdoc/auxiliary/source-code-bar.rs @@ -0,0 +1,17 @@ +//! just some other file. :) + +use crate::Foo; + +pub struct Bar { + field: Foo, +} + +pub struct Bar2 { + field: crate::Foo, +} + +pub mod sub { + pub trait Trait { + fn tadam() {} + } +} diff --git a/src/test/rustdoc/auxiliary/source_code.rs b/src/test/rustdoc/auxiliary/source_code.rs new file mode 100644 index 000000000..72a5c1a0a --- /dev/null +++ b/src/test/rustdoc/auxiliary/source_code.rs @@ -0,0 +1 @@ +pub struct SourceCode; diff --git a/src/test/rustdoc/auxiliary/src-links-external.rs b/src/test/rustdoc/auxiliary/src-links-external.rs new file mode 100644 index 000000000..4a835673a --- /dev/null +++ b/src/test/rustdoc/auxiliary/src-links-external.rs @@ -0,0 +1 @@ +pub struct Foo; diff --git a/src/test/rustdoc/auxiliary/trait-alias-mention.rs b/src/test/rustdoc/auxiliary/trait-alias-mention.rs new file mode 100644 index 000000000..6df06c87a --- /dev/null +++ b/src/test/rustdoc/auxiliary/trait-alias-mention.rs @@ -0,0 +1,3 @@ +#![feature(trait_alias)] + +pub trait SomeAlias = std::fmt::Debug + std::marker::Copy; diff --git a/src/test/rustdoc/auxiliary/trait-visibility.rs b/src/test/rustdoc/auxiliary/trait-visibility.rs new file mode 100644 index 000000000..1e8d0b8e0 --- /dev/null +++ b/src/test/rustdoc/auxiliary/trait-visibility.rs @@ -0,0 +1,3 @@ +pub trait Bar { + fn foo(); +} diff --git a/src/test/rustdoc/auxiliary/unit-return.rs b/src/test/rustdoc/auxiliary/unit-return.rs new file mode 100644 index 000000000..7b9986162 --- /dev/null +++ b/src/test/rustdoc/auxiliary/unit-return.rs @@ -0,0 +1,3 @@ +pub fn f2(f: F) {} + +pub fn f3 () + Clone>(f: F) {} diff --git a/src/test/rustdoc/auxiliary/unstable-trait.rs b/src/test/rustdoc/auxiliary/unstable-trait.rs new file mode 100644 index 000000000..6f06a6e26 --- /dev/null +++ b/src/test/rustdoc/auxiliary/unstable-trait.rs @@ -0,0 +1,26 @@ +#![feature(staged_api)] +#![stable(feature = "private_general", since = "1.0.0")] + +#[unstable(feature = "private_trait", issue = "none")] +pub trait Bar {} + +#[stable(feature = "private_general", since = "1.0.0")] +pub struct Foo { + // nothing +} + +impl Foo { + #[stable(feature = "private_general", since = "1.0.0")] + pub fn stable_impl() {} +} + +impl Foo { + #[unstable(feature = "private_trait", issue = "none")] + pub fn bar() {} + + #[stable(feature = "private_general", since = "1.0.0")] + pub fn bar2() {} +} + +#[stable(feature = "private_general", since = "1.0.0")] +impl Bar for Foo {} diff --git a/src/test/rustdoc/auxiliary/variant-struct.rs b/src/test/rustdoc/auxiliary/variant-struct.rs new file mode 100644 index 000000000..0f3d2e5f1 --- /dev/null +++ b/src/test/rustdoc/auxiliary/variant-struct.rs @@ -0,0 +1,5 @@ +pub enum Foo { + Bar { + qux: (), + } +} -- cgit v1.2.3