about summary refs log tree commit diff
path: root/src/test/rustdoc
AgeCommit message (Collapse)AuthorLines
2018-01-13Adjust tests for removal of `impl Foo for .. {}`leonardo.yvens-12/+3
2018-01-10rustdoc: Populate external_traits with traits only seen in implsOliver Middleton-0/+40
This means default methods can always be found and "Important traits" will include all spotlight traits.
2018-01-09Rollup merge of #47263 - ollie27:rustdoc_private_macro_import, r=GuillaumeGomezkennytm-0/+20
rustdoc: Don't import macros from private imports Fixes #47038
2018-01-09Rollup merge of #47210 - ↵kennytm-0/+18
zackmdavis:the_3rd_of_2_hardest_problems_in_computer_science, r=QuietMisdreavus fix the doc-comment-decoration-trimming edge-case rustdoc ICE This `horizontal_trim` function strips the leading whitespace from doc-comments that have a left-asterisk-margin: ``` /** * You know what I mean— * * comments like this! */ ``` The index of the column of asterisks is `i`, and if trimming is deemed possible, we slice each line from `i+1` to the end of the line. But if, in particular, `i` was 0 _and_ there was an empty line (as in the example given in the reporting issue), we ended up panicking trying to slice an empty string from 0+1 (== 1). Let's tighten our check to say that we can't trim when `i` is even the same as the length of the line, not just when it's greater. (Any such cases would panic trying to slice `line` from `line.len()+1`.) Resolves #47197.
2018-01-08rustdoc: Don't import macros from private importsOliver Middleton-0/+20
2018-01-07Auto merge of #47039 - ollie27:rustdoc_trait_impl_src, r=GuillaumeGomezbors-0/+5
rustdoc: Add missing src links for generic impls on trait pages `implementor2item` would return `None` for generic impls so instead this clones the entire `clean::Item` into the `implementors` map which simplifies some code.
2018-01-06wherein careful doc-decoration arithmetic proves quite the ICE-breakerZack M. Davis-0/+18
This `horizontal_trim` function strips the leading whitespace from doc-comments that have a left-asterisk-margin: /** * You know what I mean— * * comments like this! */ The index of the column of asterisks is `i`, and if trimming is deemed possible, we slice each line from `i+1` to the end of the line. But if, in particular, `i` was 0 _and_ there was an empty line (as in the example given in the reporting issue), we ended up panicking trying to slice an empty string from 0+1 (== 1). Let's tighten our check to say that we can't trim when `i` is even the same as the length of the line, not just when it's greater. (Any such cases would panic trying to slice `line` from `line.len()+1`.) Resolves #47197.
2018-01-06Auto merge of #47083 - CAD97:issue-46976, r=nikomatsakisbors-0/+12
Issue 46976 ICE is due to an empty path segments, so I set the path to be the same as the in band ty params symbol. (I think this is how regular generics end up being handled?) Pinging @cramertj, this is your code I'm editing here.
2017-12-30Hard break for rust-lang/rust#46976Christopher Durham-0/+12
2017-12-30Add trailing newlines to files which have no trailing newlines.kennytm-1/+1
2017-12-28rustdoc: Don't try to generate links for modules in import pathsOliver Middleton-0/+34
The modules may be private or may even be enums so it would generate dead links.
2017-12-27rustdoc: Add missing src links for generic impls on trait pagesOliver Middleton-0/+5
`implementor2item` would return `None` for generic impls so instead this clones the entire `clean::Item` into the `implementors` map which simplifies some code.
2017-12-24Auto merge of #46894 - detrumi:fix-const-eval-trait, r=eddybbors-0/+34
Const-eval array lengths in rustdoc. Fixes #46727 r? @eddyb Big thanks to @eddyb for helping me figure this out.
2017-12-23Testcase for const-eval array lengthsWilco Kusee-0/+34
2017-12-22Rollup merge of #46858 - QuietMisdreavus:external-doc-error, r=estebankkennytm-0/+1
tweaks and fixes for doc(include) This PR makes a handful of changes around `#[doc(include="file.md")]` (https://github.com/rust-lang/rust/issues/44732): * Turns errors when loading files into full errors. This matches the original RFC text. * Makes the `missing_docs` lint check for `#[doc(include="file.md")]` as well as regular `#[doc="text"]` attributes. * Loads files included by `#[doc(include="file.md")]` into dep-info, mirroring the behavior of `include_str!()` and friends. * Adds or modifies tests to check for all of these.
2017-12-22Rollup merge of #46847 - GuillaumeGomez:more-sidebar-escape, r=QuietMisdreavuskennytm-0/+45
Escape more items in the sidebar when needed Fixes #46724. r? @QuietMisdreavus
2017-12-21Escape more items in the sidebar when neededGuillaume Gomez-0/+45
2017-12-20Rollup merge of #46787 - varkor:contrib-6, r=QuietMisdreavuskennytm-0/+23
Add an option to allow rustdoc to list modules by appearance The `--sort-modules-by-appearance` option will list modules in the order that they appear in the source, rather than sorting them alphabetically (as is the default). This resolves #8552.
2017-12-20Rollup merge of #46359 - GuillaumeGomez:remove-dead-linkage, r=QuietMisdreavuskennytm-0/+32
Do not display hidden types, fixes issue 23912 Fixes #23912. r? @QuietMisdreavus (It's the one I was talking about a few days ago, just close it if it's useless.)
2017-12-19test for missing_doc in the external_doc testQuietMisdreavus-0/+1
2017-12-19Add a test for `--sort-modules-by-appearance`varkor-0/+23
2017-12-18Add tests for hidden typesGuillaume Gomez-0/+32
2017-12-18Fix ?Sized where bound not being displayed at the correct placeGuillaume Gomez-0/+16
2017-12-03Auto merge of #46384 - ollie27:rustdoc_inline_assoc, r=QuietMisdreavusbors-0/+105
rustdoc: Fix issues with cross-crate inlined associated items * Visibility was missing from impl items. * Attributes and docs were missing from consts and types in impls. * Const default values were missing from traits. This unifies the code that handles associated items from impls and traits.
2017-12-02Auto merge of #46326 - GuillaumeGomez:sidebar-text, r=QuietMisdreavusbors-0/+23
Fix invalid HTML escape Fixes #46289. r? @QuietMisdreavus
2017-12-02Rollup merge of #46412 - chrisduerr:issue-46380, r=QuietMisdreavuskennytm-0/+34
Hide private trait type params and show hidden items with document-private As discussed in #46380, this PR removes the `strip-hidden` pass from `--document-private-items` which allows showing `#[doc(hidden)]` with rustdoc. The second commit removes the trait implementation from the docs if the trait's parameter is private.
2017-12-02Rollup merge of #46405 - alexcrichton:fix-rustdoc, r=estebankkennytm-0/+15
rustc: Filter out bogus extern crate warnings Rustdoc has for some time now used the "everybody loops" pass in the compiler to avoid typechecking and otherwise avoid looking at implementation details. In #46115 the placement of this pass was pushed back in the compiler to after macro expansion to ensure that it works with macro-expanded code as well. This in turn caused the regression in #46271. The bug here was that the resolver was producing `def_id` instances for "possibly unused extern crates" which would then later get processed during typeck to actually issue lint warnings. The problem was that *after* resolution these `def_id` nodes were actually removed from the AST by the "everybody loops" pass. This later, when we tried to take a look at `def_id`, caused the compiler to panic. The fix applied here is a bit of a heavy hammer which is to just, in this one case, ignore the `extern crate` lints if the `def_id` looks "bogus" in any way (basically if it looks like the node was removed after resolution). The real underlying bug here is probably that the "everybody loops" AST pass is being stressed to much beyond what it was originally intended to do, but this should at least fix the ICE for now... Closes #46271
2017-11-30Fix htmldocck namingChristian Duerr-2/+2
After renaming the structs and enums the htmldocck strings still contained the old names. This lead to test failure. These htmldocck tests have been updated to use the proper names of the rust structs and traits.
2017-11-30Hide trait impl with private trait type parameterChristian Duerr-0/+19
Trait's implementations with private type parameters were displayed in the implementing struct's documentation until now. With this change any trait implementation that uses a private type parameter is now hidden in the docs.
2017-11-30Show hidden items with rustdoc's document-privateChristian Duerr-0/+15
When using `#[doc(hidden)]` elements are hidden from docs even when the rustdoc flag `--document-private-items` is set. This behavior has been changed to display all hidden items when the flag is active.
2017-11-30rustc: Filter out bogus extern crate warningsAlex Crichton-0/+15
Rustdoc has for some time now used the "everybody loops" pass in the compiler to avoid typechecking and otherwise avoid looking at implementation details. In #46115 the placement of this pass was pushed back in the compiler to after macro expansion to ensure that it works with macro-expanded code as well. This in turn caused the regression in #46271. The bug here was that the resolver was producing `def_id` instances for "possibly unused extern crates" which would then later get processed during typeck to actually issue lint warnings. The problem was that *after* resolution these `def_id` nodes were actually removed from the AST by the "everybody loops" pass. This later, when we tried to take a look at `def_id`, caused the compiler to panic. The fix applied here is a bit of a heavy hammer which is to just, in this one case, ignore the `extern crate` lints if the `def_id` looks "bogus" in any way (basically if it looks like the node was removed after resolution). The real underlying bug here is probably that the "everybody loops" AST pass is being stressed to much beyond what it was originally intended to do, but this should at least fix the ICE for now... Closes #46271
2017-11-30Fix rustoc item summaries that are headersChristian Duerr-0/+13
Rustoc item summaries that are headers were not displayed at all because they started with whitespace. This PR fixes this and now removes the whitespace and then displays the block.
2017-11-29rustdoc: Fix issues with cross-crate inlined associated itemsOliver Middleton-0/+105
* Visibility was missing from impl items. * Attributes and docs were missing from consts and types in impls. * Const default values were missing from traits. This unifies the code that handles associated items from impls and traits.
2017-11-29Fix invalid HTML escapeGuillaume Gomez-0/+23
2017-11-25Auto merge of #46129 - kennytm:fix-46098-rustdoc-reexport-extern-type, ↵bors-0/+66
r=GuillaumeGomez Properly handle reexport of foreign items. Handles `pub use` of `extern { fn, static, type }`. Also plug in some more `match` arms where handling `extern type` is reasonable. Fixed #46098.
2017-11-22Auto merge of #44781 - QuietMisdreavus:doc-include, r=GuillaumeGomezbors-0/+82
rustdoc: include external files in documentation (RFC 1990) Part of https://github.com/rust-lang/rfcs/pull/1990 (needs work on the error reporting, which i'm deferring to after this initial PR) cc #44732 Also fixes #42760, because the prep work for the error reporting made it easy to fix that at the same time.
2017-11-21allow loading external files in documentationQuietMisdreavus-0/+82
Partial implementation of https://github.com/rust-lang/rfcs/pull/1990 (needs error reporting work) cc #44732
2017-11-22Rollup merge of #46134 - GuillaumeGomez:negative-traits, r=QuietMisdreavuskennytm-0/+19
Display negative traits implementation Fixes #45816. r? @QuietMisdreavus
2017-11-21Auto merge of #45039 - QuietMisdreavus:doc-spotlight, ↵bors-0/+46
r=GuillaumeGomez,QuietMisdreavus show in docs whether the return type of a function impls Iterator/Read/Write Closes #25928 This PR makes it so that when rustdoc documents a function, it checks the return type to see whether it implements a handful of specific traits. If so, it will print the impl and any associated types. Rather than doing this via a whitelist within rustdoc, i chose to do this by a new `#[doc]` attribute parameter, so things like `Future` could tap into this if desired. ### Known shortcomings ~~The printing of impls currently uses the `where` class over the whole thing to shrink the font size relative to the function definition itself. Naturally, when the impl has a where clause of its own, it gets shrunken even further:~~ (This is no longer a problem because the design changed and rendered this concern moot.) The lookup currently just looks at the top-level type, not looking inside things like Result or Option, which renders the spotlights on Read/Write a little less useful: <details><summary>`File::{open, create}` don't have spotlight info (pic of old design)</summary> ![image](https://user-images.githubusercontent.com/5217170/31209495-e59d027e-a950-11e7-9998-ceefceb71c07.png) </details> All three of the initially spotlighted traits are generically implemented on `&mut` references. Rustdoc currently treats a `&mut T` reference-to-a-generic as an impl on the reference primitive itself. `&mut Self` counts as a generic in the eyes of rustdoc. All this combines to create this lovely scene on `Iterator::by_ref`: <details><summary>`Iterator::by_ref` spotlights Iterator, Read, and Write (pic of old design)</summary> ![image](https://user-images.githubusercontent.com/5217170/31209554-50b271ca-a951-11e7-928b-4f83416c8681.png) </details>
2017-11-20Display negative traits implementationGuillaume Gomez-0/+19
2017-11-21Properly handle reexport of foreign items.kennytm-0/+66
Handles `pub use` of `extern { fn, static, type }`. Also plug in some more `match` arms where handling `extern type` is reasonable. Fixed #46098.
2017-11-20Make rustdoc not include self-by-value methods from Deref targetFlorian Hartwig-8/+8
2017-11-18Add tooltip for important traits displayGuillaume Gomez-4/+4
2017-11-18Auto merge of #46000 - kennytm:fix-45640-extern-type-ice-in-rustdoc, ↵bors-0/+28
r=QuietMisdreavus Support `extern type` in rustdoc. Fixes #45640. (cc #43467)
2017-11-17add doc_highlight feature flag and testsQuietMisdreavus-0/+46
2017-11-15Remove Fn trait + impl Trait rustdoc testsChristopher Vittal-5/+9
2017-11-15Add/Modify tests for argument position impl TraitChristopher Vittal-4/+0
2017-11-15Support `extern type` in rustdoc.kennytm-0/+28
Fixes #45640.
2017-11-14Rollup merge of #45815 - QuietMisdreavus:happy-little-notices, r=GuillaumeGomezGuillaume Gomez-2/+2
rustdoc: tweak notes on ignore/compile_fail examples Part of https://github.com/rust-lang/rust/issues/44927 This is a softening of these notices to mention *why* a given example has a given callout, rather then telling viewers to be careful with an example. It also changes the character used for these samples from a warning logo to a circle-i/information logo. ![image](https://user-images.githubusercontent.com/5217170/32464361-5fbb5d9e-c305-11e7-8482-ce71b97a54df.png)
2017-11-13update codeblock-title test with new notice textQuietMisdreavus-2/+2