summary refs log tree commit diff
path: root/src/test/rustdoc
AgeCommit message (Collapse)AuthorLines
2018-11-20Fix Rustdoc ICE when checking blanket implsAaron Hill-0/+31
Fixes #55001, #54744 Previously, SelectionContext would unconditionally cache the selection result for an obligation. This worked fine for most users of SelectionContext, but it caused an issue when used by Rustdoc's blanket impl finder. The issue occured when SelectionContext chose a ParamCandidate which contained inference variables. Since inference variables can change between calls to select(), it's not safe to cache the selection result - the chosen candidate might not be applicable for future results, leading to an ICE when we try to run confirmation. This commit prevents SelectionContext from caching any ParamCandidate that contains inference variables. This should always be completely safe, as trait selection should never depend on a particular result being cached. I've also added some extra debug!() statements, which I found helpful in tracking down this bug.
2018-11-19don't inline `pub use some_crate` unless directly asked toQuietMisdreavus-0/+64
2018-10-24This is a regression test for #54478.Felix S. Klock II-0/+42
I confirmed that it fails on: rustdoc 1.30.0-beta.12 (96a229824 2018-10-04) and passes on: rustdoc 1.31.0-nightly (f99911a4a 2018-10-23)
2018-10-15rustdoc: Use dyn keyword when rendering dynamic traitsOliver Middleton-4/+4
The dyn keyword has been stable for a while now so rustdoc should start using it.
2018-10-12Rollup merge of #54989 - Munksgaard:fix-htmldocck-typos, r=tmandrykennytm-3/+3
Fix spelling in the documentation to htmldocck.py I was reading through htmldocck.py, and decided to attempt to clean it up a little bit. Let me know if you disagree with my edits.
2018-10-11Include rustdoc tests that have been fixed by #33133Philip Munksgaard-3/+3
There was an issue (#33025) which caused these tests to not work. The issue has since been fixed in #33133, and so we can now include them.
2018-10-05Stabilize `min_const_fn`Oliver Schneider-5/+0
2018-09-29Rollup merge of #54577 - QuietMisdreavus:docs-for-procs, r=GuillaumeGomezkennytm-0/+126
rustdoc: give proc-macros their own pages related to https://github.com/rust-lang/rust/issues/49553 but i don't think it'll fix it Currently, rustdoc doesn't expose proc-macros all that well. In the source crate, only their definition function is exposed, but when re-exported, they're treated as a macro! This is an awkward situation in all accounts. This PR checks functions to see whether they have any of `#[proc_macro]`, `#[proc_macro_attribute]`, or `#[proc_macro_derive]`, and exposes them as macros instead. In addition, attributes and derives are exposed differently than other macros, getting their own item-type, CSS class, and module heading. ![image](https://user-images.githubusercontent.com/5217170/46044803-6df8da00-c0e1-11e8-8c3b-25d2c3beb55c.png) Function-like proc-macros are lumped in with `macro_rules!` macros, but they get a different declaration block (i'm open to tweaking this, it's just what i thought of given how function-proc-macros operate): ![image](https://user-images.githubusercontent.com/5217170/46044828-84069a80-c0e1-11e8-9cc4-127e5477c395.png) Proc-macro attributes and derives get their own pages, with a representative declaration block. Derive macros also show off their helper attributes: ![image](https://user-images.githubusercontent.com/5217170/46094583-ef9f4500-c17f-11e8-8f71-fa0a7895c9f6.png) ![image](https://user-images.githubusercontent.com/5217170/46101529-cab3cd80-c191-11e8-857a-946897750da1.png) There's one wrinkle which this PR doesn't address, which is why i didn't mark this as fixing the linked issue. Currently, proc-macros don't expose their attributes or source span across crates, so while rustdoc knows they exist, that's about all the information it gets. This leads to an "inlined" macro that has absolutely no docs on it, and no `[src]` link to show you where it was declared. The way i got around it was to keep proc-macro re-export disabled, since we do get enough information across crates to properly link to the source page: ![image](https://user-images.githubusercontent.com/5217170/46045074-2cb4fa00-c0e2-11e8-81bc-33a8205fbd03.png) Until we can get a proc-macro's docs (and ideally also its source span) across crates, i believe this is the best way forward.
2018-09-27check for proc-macros in "all items"QuietMisdreavus-0/+8
2018-09-26Auto merge of #54199 - nikomatsakis:predicate_may_hold-failure, r=eddybbors-0/+171
overlook overflows in rustdoc trait solving Context: The new rustdoc "auto trait" feature walks across impls and tries to run trait solving on them with a lot of unconstrained variables. This is prone to overflows. These overflows used to cause an ICE because of a caching bug (fixed in this PR). But even once that is fixed, it means that rustdoc causes an overflow rather than generating docs. This PR therefore adds a new helper that propagates the overflow error out. This requires rustdoc to then decide what to do when it encounters such an overflow: technically, an overflow represents neither "yes" nor "no", but rather a failure to make a decision. I've decided to opt on the side of treating this as "yes, implemented", since rustdoc already takes an optimistic view. This may prove to include too many items, but I *suspect* not. We could probably reduce the rate of overflows by unifying more of the parameters from the impl -- right now we only seem to consider the self type. Moreover, in the future, as we transition to Chalk, overflow errors are expected to just "go away" (in some cases, though, queries might return an ambiguous result). Fixes #52873 cc @QuietMisdreavus -- this is the stuff we were talking about earlier cc @GuillaumeGomez -- this supersedes #53687
2018-09-25add test for proc-macro re-exportQuietMisdreavus-0/+64
2018-09-25handle proc-macros as macros instead of functionsQuietMisdreavus-0/+54
2018-09-25add regression testNiko Matsakis-0/+171
2018-09-22Rollup merge of #54350 - Munksgaard:support-edition-in-doc-test, r=steveklabnikPietro Albini-0/+54
Support specifying edition in doc test Fixes #52623 r? @QuietMisdreavus
2018-09-20fix intra-links for trait implsQuietMisdreavus-0/+40
2018-09-20don't index trait impls if the trait isn't also documentedQuietMisdreavus-0/+23
2018-09-20add more tests for traits-in-non-module-scopeQuietMisdreavus-4/+62
2018-09-20don't check visibility when inlining local implsQuietMisdreavus-0/+28
those get handled properly in strip-hidden anyway
2018-09-20ignore rustdoc/doc-proc-macro on stage1QuietMisdreavus-0/+2
2018-09-20rustdoc: collect trait impls as an early passQuietMisdreavus-3/+15
2018-09-20Add test for doctest edition supportPhilip Munksgaard-0/+54
2018-09-18Rollup merge of #54097 - GuillaumeGomez:remove-keyword-namespace, ↵Guillaume Gomez-0/+1
r=QuietMisdreavus rustdoc: Remove namespace for keywords Fixes #54084. r? @QuietMisdreavus
2018-09-16Check the remaining nodesKazuyoshi Kato-0/+4
2018-09-14Add a test to prevent regressionKazuyoshi Kato-0/+26
The way it defines implementations is unrealistic though.
2018-09-12Auto merge of #53409 - GuillaumeGomez:associated-const-value, r=QuietMisdreavusbors-29/+4
Don't show associated const value anymore Part of #44348. Before: <img width="1440" alt="screen shot 2018-08-16 at 00 48 30" src="https://user-images.githubusercontent.com/3050060/44177414-20ef1480-a0ee-11e8-80d4-7caf082cf0de.png"> After: <img width="1440" alt="screen shot 2018-08-16 at 00 48 23" src="https://user-images.githubusercontent.com/3050060/44177417-251b3200-a0ee-11e8-956a-4229275e3342.png"> cc @nox r? @QuietMisdreavus
2018-09-10Remove namespace for keywordsGuillaume Gomez-0/+1
2018-09-09rustdoc: Remove generated blanket impls from trait pagesOliver Middleton-0/+37
2018-09-06Fix hover on implsGuillaume Gomez-2/+4
2018-09-01Auto merge of #53604 - oli-obk:min_const_fn, r=Centril,varkorbors-3/+3
Implement the `min_const_fn` feature gate cc @RalfJung @eddyb r? @Centril implements the feature gate for #53555 I added a hack so the `const_fn` feature gate also enables the `min_const_fn` feature gate. This ensures that nightly users of `const_fn` don't have to touch their code at all. The `min_const_fn` checks are run first, and if they succeeded, the `const_fn` checks are run additionally to ensure we didn't miss anything.
2018-08-31Auto merge of #51384 - QuietMisdreavus:extern-version, r=GuillaumeGomezbors-0/+18
rustdoc: add flag to control the html_root_url of dependencies The `--extern-html-root-url` flag in this PR allows one to override links to crates whose docs are not already available locally in the doc bundle. Docs.rs currently uses a version of this to make sure links to other crates go into that crate's docs.rs page. See the included test for intended use, but the idea is as follows: Calling rustdoc with `--extern-html-root-url crate=https://some-url.com` will cause rustdoc to override links that point to that crate to instead be replaced with a link rooted at `https://some-url.com/`. (e.g. for docs.rs this would be `https://docs.rs/crate/0.1.0` or the like.) Cheekily, rustup could use these options to redirect links to std/core/etc to instead point to locally-downloaded docs, if it so desired. Fixes https://github.com/rust-lang/rust/issues/19603
2018-08-31Restrict most uses of `const_fn` to `min_const_fn`Oliver Schneider-3/+3
2018-08-29Replace usages of 'bad_style' with 'nonstandard_style'.Corey Farwell-1/+1
`bad_style` is being deprecated in favor of `nonstandard_style`: - https://github.com/rust-lang/rust/issues/41646
2018-08-26Remove static and const initialization from documentationGuillaume Gomez-3/+3
2018-08-25Update testsGuillaume Gomez-26/+1
2018-08-22Rollup merge of #53541 - GuillaumeGomez:fix-impl-trait-ret-type, r=oli-obkGuillaume Gomez-0/+40
Fix missing impl trait display as ret type I need to convert a `TraitPredicate` into a `TraitBound` to get the returned impl trait. So far, didn't find how or even if it was the good way to do it. cc @eddyb @oli-obk (since you're the one behind the change apparently 😉)
2018-08-21Auto merge of #53439 - ↵bors-0/+18
GuillaumeGomez:generate-blanket-impls-for-reexported-items, r=QuietMisdreavus Generate blanket implementations for reexported items as well Fixes #53374. r? @QuietMisdreavus
2018-08-21Fix missing impl trait display as ret typeGuillaume Gomez-0/+40
2018-08-19Fix typos found by codespell.Matthias Krüger-1/+1
2018-08-17Auto merge of #50911 - petrochenkov:macuse, r=alexcrichtonbors-7/+0
Stabilize `use_extern_macros` Closes https://github.com/rust-lang/rust/issues/35896
2018-08-17Stabilize `use_extern_macros`Vadim Petrochenkov-7/+0
2018-08-16Generate blanket implementations for reexported items as wellGuillaume Gomez-0/+18
2018-08-16syntax: also warn about edition "umbrella" features being implied by --edition.Eduard-Mihai Burtescu-1/+1
2018-08-09set the syntax edition in the driver's phase 1QuietMisdreavus-0/+24
2018-08-06Auto merge of #52644 - varkor:lib-feature-gate-2, r=withoutboatsbors-3/+0
Add errors for unknown, stable and duplicate feature attributes - Adds an error for unknown (lang and lib) features. - Extends the lint for unnecessary feature attributes for stable features to libs features (this already exists for lang features). - Adds an error for duplicate (lang and lib) features. ```rust #![feature(fake_feature)] //~ ERROR unknown feature `fake_feature` #![feature(i128_type)] //~ WARNING the feature `i128_type` has been stable since 1.26.0 #![feature(non_exhaustive)] #![feature(non_exhaustive)] //~ ERROR duplicate `non_exhaustive` feature attribute ``` Fixes #52053, fixes #53032 and address some of the problems noted in #44232 (though not unused features). There are a few outstanding problems, that I haven't narrowed down yet: - [x] Stability attributes on macros do not seem to be taken into account. - [x] Stability attributes behind `cfg` attributes are not taken into account. - [x] There are failing incremental tests.
2018-08-06Auto merge of #52990 - Aaron1011:fix/rustdoc-auto-trait-static, r=eddybbors-0/+44
Fix ICE when rustdoc encounters certain usages of HRTBs Fixes #51236 Under certain circumstances, `AutoTraitFinder` could end up computing a `ParamEnv` involving two trait predicates that differed only in the region parameters involved. One of these parameters would be a HRTB, while the other would be a normal region parameter. When this `ParamEnv` was later passed to `SelectionContext`, an `Ambiguity` error would occur, since the erased versions of these predicates would be identical. To solve the issue, we de-duplicate our list of predicates as we build it up. Whenever we encounter two predicates that differ only in their assignment of region parameters (a HRTB vs a normal lifetime parameter), we pick the HRTB. This corresponds to selecting a 'stricter' bound to display in the generated documentation: we're requiring that a particular type works for all possible lifetime parameters if it's going to implement a particular auto trait.
2018-08-06Auto merge of #53002 - QuietMisdreavus:brother-may-i-have-some-loops, r=pnkfelixbors-0/+29
make `everybody_loops` preserve item declarations First half of https://github.com/rust-lang/rust/issues/52545. `everybody_loops` is used by rustdoc to ensure we don't contain erroneous references to platform APIs if one of its uses is pulled in by `#[doc(cfg)]`. However, you can also implement traits for public types inside of functions. This is used by Diesel (probably others, but they were the example that was reported) to get around a recent macro hygiene fix, which has caused their crate to fail to document. While this won't make the traits show up in documentation (that step comes later), it will at least allow files to be generated.
2018-08-05Fix rustdoc testvarkor-2/+0
2018-08-05Fix run-pass-fulldeps testsvarkor-1/+0
2018-08-04add tests for new intra-doc-link behaviorQuietMisdreavus-0/+50
2018-08-04Strengthen testsGuillaume Gomez-0/+1