about summary refs log tree commit diff
path: root/src/test/rustdoc
AgeCommit message (Collapse)AuthorLines
2019-08-29Rollup merge of #62734 - GuillaumeGomez:hide-default-methods, r=Mark-SimulacrumMazdak Farrokhzad-9/+9
Hide trait default methods Fixes #62499. However, the question remains: do we want to extend it to this point or not? r? @QuietMisdreavus
2019-08-29Auto merge of #62855 - Aaron1011:feature/rustdoc-reexport-final, r=petrochenkovbors-10/+20
Improve Rustdoc's handling of procedural macros Fixes #58700 Fixes #58696 Fixes #49553 Fixes #52210 This commit removes the special rustdoc handling for proc macros, as we can now retrieve their span and attributes just like any other item. A new command-line option is added to rustdoc: `--crate-type`. This takes the same options as rustc's `--crate-type` option. However, all values other than `proc-macro` are treated the same. This allows Rustdoc to enable 'proc macro mode' when handling a proc macro crate. In compiletest, a new 'rustdoc-flags' option is added. This allows us to pass in the '--proc-macro-crate' flag in the absence of Cargo. I've opened [an additional PR to Cargo](https://github.com/rust-lang/cargo/pull/7159) to support passing in this flag. These two PRS can be merged in any order - the Cargo changes will not take effect until the 'cargo' submodule is updated in this repository.
2019-08-25Auto merge of #61613 - sinkuu:impl_trait_inline, r=ollie27bors-0/+50
Support `impl Trait` in inlined documentation `impl Trait` in argument position was not properly rendered when inlined from other crates. ([a live example on docs.rs](https://docs.rs/libp2p/0.8.1/libp2p/floodsub/struct.Floodsub.html#method.unsubscribe)) ![old](https://user-images.githubusercontent.com/7091080/59089838-14ba9900-8946-11e9-830b-53b317bdecb4.png) ↓ ![new](https://user-images.githubusercontent.com/7091080/59089844-16845c80-8946-11e9-9fe3-8998af9d73ce.png)
2019-08-24Improve Rustdoc's handling of procedural macrosAaron Hill-10/+20
Fixes #58700 Fixes #58696 Fixes #49553 Fixes #52210 This commit removes the special rustdoc handling for proc macros, as we can now retrieve their span and attributes just like any other item. A new command-line option is added to rustdoc: `--crate-type`. This takes the same options as rustc's `--crate-type` option. However, all values other than `proc-macro` are treated the same. This allows Rustdoc to enable 'proc macro mode' when handling a proc macro crate. In compiletest, a new 'rustdoc-flags' option is added. This allows us to pass in the '--proc-macro-crate' flag in the absence of Cargo. I've opened [an additional PR to Cargo](https://github.com/rust-lang/cargo/pull/7159) to support passing in this flag. These two PRS can be merged in any order - the Cargo changes will not take effect until the 'cargo' submodule is updated in this repository.
2019-08-20Remove async_await gates from tests.Mazdak Farrokhzad-9/+2
2019-08-19Fix ICE with `impl Trait` in type boundsShotaro Yamada-0/+8
2019-08-19Fix tidyShotaro Yamada-2/+6
2019-08-19Support nested `impl Trait`Shotaro Yamada-0/+8
2019-08-19Associated type bound for inlined impl Trait docShotaro Yamada-0/+10
2019-08-19Support `impl Trait` in inlined documentationShotaro Yamada-0/+20
2019-08-06Rollup merge of #62821 - GuillaumeGomez:not-listed-methods, r=Mark-SimulacrumMazdak Farrokhzad-0/+29
Not listed methods Fixes #60326. cc @rust-lang/rustdoc r? @QuietMisdreavus
2019-08-06Add test for DerefMut methodsGuillaume Gomez-0/+29
2019-08-04Auto merge of #63048 - Aaron1011:feature/rustdoc-reexport-doc, r=GuillaumeGomezbors-0/+13
Use doc comments from 'pub use' statements Split off from #62855 Currently, rustdoc ignores any doc comments found on 'pub use' statements. As described in issue #58700, this makes it impossible to properly document procedural macros. Any doc comments must be written on the procedural macro definition, which must occur in a dedicated proc-macro crate. This means that any doc comments or doc tests cannot reference items defined in re-exporting crate, despite the fact that such items may be required to use the procedural macro. To solve this issue, this commit allows doc comments to be written on 'pub use' statements. For consistency, this applies to *all* 'pub use' statements, not just those importing procedural macros. When inlining documentation, documentation on 'pub use' statements will be prepended to the documentation of the inlined item. For example, the following items: ```rust mod other_mod { /// Doc comment from definition pub struct MyStruct; } /// Doc comment from 'pub use' /// pub use other_mod::MyStruct; ``` will caues the documentation for the re-export of 'MyStruct' to be rendered as: ``` Doc comment from 'pub use' Doc comment from definition ``` Note the empty line in the 'pub use' doc comments - because doc comments are concatenated as-is, this ensure that the doc comments on the definition start on a new line.
2019-08-01Rollup merge of #62971 - GuillaumeGomez:keyword-sidebar, r=nobodyPietro Albini-0/+1
Add keywords item into the sidebar Fixes #62939. cc @pravic screenshot of the result: ![Screenshot from 2019-07-25 14-29-48](https://user-images.githubusercontent.com/3050060/61874545-f9512080-aee8-11e9-8e8b-aa50216aec94.png) r? @QuietMisdreavus
2019-07-27Use doc comments from 'pub use' statementsAaron Hill-0/+13
Split off from #62855 Currently, rustdoc ignores any doc comments found on 'pub use' statements. As described in issue #58700, this makes it impossible to properly document procedural macros. Any doc comments must be written on the procedural macro definition, which must occur in a dedicated proc-macro crate. This means that any doc comments or doc tests cannot reference items defined in re-exporting crate, despite the fact that such items may be required to use the procedural macro. To solve this issue, this commit allows doc comments to be written on 'pub use' statements. For consistency, this applies to *all* 'pub use' statements, not just those importing procedural macros. When inlining documentation, documentation on 'pub use' statements will be prepended to the documentation of the inlined item. For example, the following items: ```rust mod other_mod { /// Doc comment from definition pub struct MyStruct; } /// Doc comment from 'pub use' /// pub use other_mod::MyStruct; ``` will caues the documentation for the re-export of 'MyStruct' to be rendered as: ``` Doc comment from 'pub use' Doc comment from definition ``` Note the empty line in the 'pub use' doc comments - because doc comments are concatenated as-is, this ensure that the doc comments on the definition start on a new line.
2019-07-26Introduce built-in macros through libcoreVadim Petrochenkov-0/+3
2019-07-25Add keywords item into the sidebarGuillaume Gomez-0/+1
2019-07-16Update testsGuillaume Gomez-9/+9
2019-07-11Remove `MacroKind::ProcMacroStub`Vadim Petrochenkov-1/+1
It's internal to resolve and always results in `Res::Err` outside of resolve. Instead put `DefKind::Fn`s themselves into the macro namespace, it's ok. Proc macro stubs are items placed into macro namespase for functions that define proc macros. https://github.com/rust-lang/rust/pull/52383 The rustdoc test is changed because the old test didn't actually reproduce the ICE it was supposed to reproduce.
2019-07-09Rollup merge of #62450 - nagisa:reclimit, r=pnkfelixMazdak Farrokhzad-0/+104
Raise the default recursion limit to 128 The previous limit of 64 is being (just) barely hit by genuine code out there, which is causing issues like https://github.com/rust-lang/rust/issues/62059 to rear their end. Ideally, we wouldn’t have such arbitrary limits at all, but while we do, it makes a lot of sense to just raise this limit whenever genuine use-cases end up hitting it. r? @pnkfelix Fixes https://github.com/rust-lang/rust/issues/62059
2019-07-06rustdoc: set cfg(doctest) when collecting doctestsQuietMisdreavus-0/+8
2019-07-07Raise the default recursion limit to 128Simonas Kazlauskas-0/+104
2019-07-04Permit use of mem::uninitialized via allow(deprecated)Mark Rousskov-0/+1
2019-07-01Revert "implicit `Option`-returning doctests"Guillaume Gomez-12/+0
This reverts commit 6bb6c001be34d0932a014df981ee18f165c43374.
2019-06-20rustdoc: generate implementors for all auto traitsSimonas Kazlauskas-3/+15
Previously we would only generate a list of synthetic implementations for two well known traits – Send and Sync. With this patch all the auto traits known to rustc are considered. This includes such traits like Unpin and user’s own traits. Sadly the implementation still iterates through the list of crate items and checks them against the traits, which for non-std crates containing their own auto-traits will still not include types defined in std/core. It is an improvement nontheless.
2019-06-07Fix slice const generic length displayGuillaume Gomez-0/+12
2019-06-01Rollup merge of #61263 - GuillaumeGomez:valid-html, r=ManishearthMazdak Farrokhzad-3/+3
Don't generate div inside header (h4/h3/h...) elements Fixes #60865. According to the HTML spec, we're not supposed to put `div` elements inside heading elements (h4/h3/h...). It doesn't change the display as far as I could tell. r? @QuietMisdreavus
2019-05-30Rollup merge of #61279 - llogiq:implicit-option-main-doctests, r=GuillaumeGomezMazdak Farrokhzad-0/+12
implicit `Option`-returning doctests This distinguishes `Option` and `Result`-returning doctests with implicit `main` method, where the former tests must end with `Some(())`. Open question: Does this need a feature gate? r? @GuillaumeGomez
2019-05-30Rollup merge of #60802 - euclio:pulldown-cmark-panic, r=GuillaumeGomezMazdak Farrokhzad-0/+9
upgrade rustdoc's `pulldown-cmark` to 0.5.2 Fixes #60482.
2019-05-29upgrade rustdoc's `pulldown-cmark` to 0.5.2Andy Russell-0/+9
Fixes #60482.
2019-05-29Don't generate div inside header (h4/h3/h...) elementsGuillaume Gomez-3/+3
2019-05-28Add a regression test for unevaluated const in rustdocvarkor-0/+21
2019-05-28Add a const-generics folder to rustdoc testsvarkor-2/+3
2019-05-28implicit `Option`-returning doctestsAndre Bogus-0/+12
This distinguishes `Option` and `Result`-returning doctests with implicit `main` method, where the former tests must end with `Some(())`.
2019-05-22Rollup merge of #60773 - Aaron1011:fix/rustdoc-project-all, r=eddybMazdak Farrokhzad-0/+35
Always try to project predicates when finding auto traits in rustdoc Fixes #60726 Previous, AutoTraitFinder would only try to project predicates when the predicate type contained an inference variable. When finding auto traits, we only project to try to unify inference variables - we don't otherwise learn any new information about the required bounds. However, this lead to failing to properly generate a negative auto trait impl (indicating that a type never implements a certain auto trait) in the following unusual scenario: In almost all cases, a type has an (implicit) negative impl of an auto trait due some other type having an explicit *negative* impl of that auto trait. For example: struct MyType<T> { field: *const T } has an implicit 'impl<T> !Send for MyType<T>', due to the explicit negative impl (in libcore) 'impl<T: ?Sized> !Send for *const T'. However, as exposed by the 'abi_stable' crate, this isn't always the case. This minimzed example shows how a type can never implement 'Send', due to a projection error: ``` pub struct True; pub struct False; pub trait MyTrait { type Project; } pub struct MyStruct<T> { field: T } impl MyTrait for u8 { type Project = False; } unsafe impl<T> Send for MyStruct<T> where T: MyTrait<Project=True> {} pub struct Wrapper { inner: MyStruct<u8> } ``` In this example, `<u8 as MyTrait>::Project == True' must hold for 'MyStruct<u8>: Send' to hold. However, '<u8 as MyTrait>::Project == False' holds instead To properly account for this unusual case, we need to call 'poly_project_and_unify' on *all* predicates, not just those with inference variables. This ensures that we catch the projection error that occurs above, and don't incorrectly determine that 'Wrapper: Send' holds.
2019-05-20Rollup merge of #60511 - taiki-e:libstd-intra-doc, r=Dylan-DPCMazdak Farrokhzad-0/+3
Fix intra-doc link resolution failure on re-exporting libstd Currently, re-exporting libstd items as below will [occur a lot of failures](https://gist.github.com/taiki-e/e33e0e8631ef47f65a74a3b69f456366). ```rust pub use std::*; ``` Until the underlying issue (#56922) fixed, we can fix that so they don't propagate to downstream crates. Related: https://github.com/rust-lang/rust/pull/56941 (That PR fixed failures that occur when re-exporting from libcore to libstd.) r? @QuietMisdreavus
2019-05-19Auto merge of #60065 - QuietMisdreavus:async-move-doctests, r=ollie27bors-4/+18
rustdoc: set the default edition when pre-parsing a doctest Fixes https://github.com/rust-lang/rust/issues/59313 (possibly more? i think we've had issues with parsing edition-specific syntax in doctests at some point) When handling a doctest, rustdoc needs to parse it beforehand, so that it can see whether it declares a `fn main` or `extern crate my_crate` explicitly. However, while doing this, rustdoc doesn't set the "default edition" used by the parser like the regular compilation runs do. This caused a problem when parsing a doctest with an `async move` block in it, since it was expecting the `move` keyword to start a closure, not a block. This PR changes the `rustdoc::test::make_test` function to set the parser's default edition while looking for a main function and `extern crate` statement. However, to do this, `make_test` needs to know what edition to set. Since this is also used during the HTML rendering process (to make playground URLs), now the HTML renderer needs to know about the default edition. Upshot: rendering standalone markdown files can now accept a "default edition" for their doctests with the `--edition` flag! (I'm pretty sure i waffled around how to set that a long time ago when we first added the `--edition` flag... `>_>`) I'm posting this before i stop for the night so that i can write this description while it's still in my head, but before this merges i want to make sure that (1) the `rustdoc-ui/failed-doctest-output` test still works (i expect it doesn't), and (2) i add a test with the sample from the linked issue.
2019-05-19Auto merge of #60760 - GuillaumeGomez:generic-display, r=varkor,badboybors-0/+30
Fix display of const generics in rustdoc <img width="745" alt="Screenshot 2019-05-18 at 15 45 22" src="https://user-images.githubusercontent.com/3050060/57970638-04854e80-7984-11e9-9f04-da6b51ec8bc7.png"> Part of #60737. cc @varkor r? @badboy
2019-05-18Auto merge of #60093 - GuillaumeGomez:fix-attrs-pos, r=Manishearthbors-2/+2
Fix attrs pos Fixes #60042. Screenshot: <img width="438" alt="Screenshot 2019-05-12 at 15 02 25" src="https://user-images.githubusercontent.com/3050060/57582606-1455ec00-74c7-11e9-9d4e-5ec4da4de7dd.png"> r? @rust-lang/rustdoc
2019-05-18Fix display of const generics in rustdocGuillaume Gomez-0/+30
2019-05-13Always try to project predicates when finding auto traits in rustdocAaron Hill-0/+35
Fixes #60726 Previous, AutoTraitFinder would only try to project predicates when the predicate type contained an inference variable. When finding auto traits, we only project to try to unify inference variables - we don't otherwise learn any new information about the required bounds. However, this lead to failing to properly generate a negative auto trait impl (indicating that a type never implements a certain auto trait) in the following unusual scenario: In almost all cases, a type has an (implicit) negative impl of an auto trait due some other type having an explicit *negative* impl of that auto trait. For example: struct MyType<T> { field: *const T } has an implicit 'impl<T> !Send for MyType<T>', due to the explicit negative impl (in libcore) 'impl<T: ?Sized> !Send for *const T'. However, as exposed by the 'abi_stable' crate, this isn't always the case. This minimzed example shows how a type can never implement 'Send', due to a projection error: ``` pub struct True; pub struct False; pub trait MyTrait { type Project; } pub struct MyStruct<T> { field: T } impl MyTrait for u8 { type Project = False; } unsafe impl<T> Send for MyStruct<T> where T: MyTrait<Project=True> {} pub struct Wrapper { inner: MyStruct<u8> } ``` In this example, `<u8 as MyTrait>::Project == True' must hold for 'MyStruct<u8>: Send' to hold. However, '<u8 as MyTrait>::Project == False' holds instead To properly account for this unusual case, we need to call 'poly_project_and_unify' on *all* predicates, not just those with inference variables. This ensures that we catch the projection error that occurs above, and don't incorrectly determine that 'Wrapper: Send' holds.
2019-05-06add test for `async move` in a doctestQuietMisdreavus-0/+14
2019-05-06update playground url tests with new edition behaviorQuietMisdreavus-4/+4
2019-05-04Fix intra-doc link resolution failure on re-exporting libstdTaiki Endo-0/+3
2019-05-03use span instead of div for since versionAndy Russell-3/+2
2019-04-30rustdoc: remove def_ctor hack.Eduard-Mihai Burtescu-3/+2
2019-04-26Make "Implementations on Foreign Types" items in sidebar link to specific implsDmitry Murzin-0/+16
2019-04-26Rollup merge of #60134 - GuillaumeGomez:fix-index-page, r=ManishearthMazdak Farrokhzad-0/+3
Fix index-page generation Fixes #60096. The minifier was minifying crates name in `searchIndex` key position, which was a bit problematic for multiple reasons. r? @rust-lang/rustdoc
2019-04-24Remove useless code and update index page testGuillaume Gomez-0/+3
2019-04-23Stabilize futures_apiTaylor Cramer-1/+1