Commit Graph

910 Commits

Author SHA1 Message Date
David Tolnay
90adafbc9e
Distinguish between private items and hidden items in rustdoc
I believe rustdoc should not be conflating private items (visibility
lower than `pub`) and hidden items (attribute `doc(hidden)`). This
matters now that Cargo is passing --document-private-items by default
for bin crates. In bin crates that rely on macros, intentionally hidden
implementation details of the macros can overwhelm the actual useful
internal API that one would want to document.

This PR restores the strip-hidden pass when documenting private items,
and introduces a separate unstable --document-hidden-items option to
skip the strip-hidden pass. The two options are orthogonal to one
another.
2020-01-04 11:28:53 -08:00
Oliver Middleton
efb876f557 rustdoc: Avoid panic when parsing codeblocks for playground links
`make_test` is also called when parsing codeblocks for the playground links so it should handle unwinds from the parser internally.
2020-01-04 18:42:06 +00:00
Ohad Ravid
811bdeee00 Show value for consts in the documentation 2019-12-24 10:10:36 +01:00
Mazdak Farrokhzad
67c0f4e2c9
Rollup merge of #67507 - Mark-Simulacrum:purge-uninit, r=Centril
Remove mem::uninitalized from tests

This purges uses of uninitialized where possible from test cases. Some
are merely moved over to the equally bad pattern of
MaybeUninit::uninit().assume_init() but with an annotation that this is
"the best we can do".

Fixes #62397
2019-12-23 15:16:24 +01:00
Mark Rousskov
c205f6a06a Remove mem::uninitalized from tests
This purges uses of uninitialized where possible from test cases. Some
are merely moved over to the equally bad pattern of
MaybeUninit::uninit().assume_init() but with an annotation that this is
"the best we can do".
2019-12-22 21:58:12 -05:00
Mark Rousskov
0f24ccd21d Change bound order in rustfmt test
It is unclear why this changed, but since it seems like a harmless
change, we're going to move forward with reformatting.
2019-12-22 21:46:51 -05:00
Ross MacArthur
f7256d28d1
Require issue = "none" over issue = "0" in unstable attributes 2019-12-21 13:16:18 +02:00
Oliver Scherer
395a789def Fix rustdoc test 2019-12-13 11:27:02 +01:00
Oliver Scherer
d75c7530f3 Reuse the staged_api feature for rustc_const_unstable 2019-12-13 11:27:01 +01:00
Mazdak Farrokhzad
4c3e95e84b
Rollup merge of #67074 - ehuss:extern-options, r=petrochenkov
Add options to --extern flag.

This changes the `--extern` flag so that it can take a series of options that changes its behavior. The general syntax is `[opts ':'] name ['=' path]` where `opts` is a comma separated list of options. Two options are supported, `priv` which replaces `--extern-private` and `noprelude` which avoids adding the crate to the extern prelude.

```text
--extern priv:mylib=/path/to/libmylib.rlib
--extern noprelude:alloc=/path/to/liballoc.rlib
```

`noprelude` is to be used by Cargo's build-std feature in order to use `--extern` to reference standard library crates.

This also includes a second commit which adds the `aux-crate` directive to compiletest. I can split this off into a separate PR if desired, but it helps with defining these kinds of tests. It is based on #54020, and can be used in the future to replace and simplify some of the Makefile tests.
2019-12-11 10:10:44 +01:00
Eric Huss
60d4e20ff0 compiletest: add aux-crate directive 2019-12-09 08:08:27 -08:00
Guillaume Gomez
a8ec6200df Remove potential cfgs duplicates 2019-12-04 11:53:33 +01:00
Tyler Mandry
999fd561ba
Rollup merge of #66798 - bwignall:typo, r=varkor
Fix spelling typos

Should be non-semantic.

Uses https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines to find likely typos.
2019-11-27 15:28:53 -06:00
Guillaume Gomez
4ab8aa3700 Add support for intra-doc link fields of enum variant 2019-11-27 13:13:16 +01:00
bors
b5f265eeed Auto merge of #66675 - GuillaumeGomez:support-anchors-intra-doc-links, r=kinnison
Support anchors intra doc links

Fixes #62833
Part of #43466.

cc @ollie27
r? @kinnison
2019-11-27 04:51:31 +00:00
Brian Wignall
16fabd8efd Fix spelling typos 2019-11-26 22:19:54 -05:00
Guillaume Gomez
433f2b030b Add test for anchors 2019-11-23 18:46:07 +01:00
Oliver Middleton
4fcb3384ad rustdoc: Mark --extern-private as unstable
It's not even stable in rustc so it shouldn't be stable in rustdoc.
2019-11-23 00:15:39 +00:00
bors
d67ca28354 Auto merge of #66238 - ehuss:stabilize-rustdoc-edition, r=GuillaumeGomez
rustdoc: Stabilize `edition` annotation.

The rustdoc `edition` annotation is currently ignored on stable. This means that the tests will be ignored, unless there is a `rust` annotation, then it will use the global edition. I suspect this was just an oversight during the edition stabilization, but I don't know. Example:

```rust
/// ```edition2018
/// // This code block was ignored on stable.
/// ```

/// ```rust,edition2018
/// // This code block would use whatever edition is passed on the command line.
/// ```
```

AFAIK, it is not possible to write a test that verifies stable behavior, as all tests appear to set RUSTC_BOOTSTRAP which forces all tests to run as "nightly", even on a stable release.

Closes #65980
2019-11-18 03:06:42 +00:00
bors
3f07f1cd78 Auto merge of #66211 - kinnison:kinnison/fix-66159, r=GuillaumeGomez
Fix ICE when documentation includes intra-doc-link

When collecting intra-doc-links we could trigger the loading of extra crates into the crate store due to name resolution finding crates referred to in documentation but not in code.  This might be due to
configuration differences or simply referring to something else.

This would cause an ICE because the newly loaded crate metadata existed in a crate store associated with the rustdoc global context, but the resolver had its own crate store cloned just before the documentation processing began and as such it could try and look up crates in a store which lacked them.

In this PR, I add support for `--extern-private` to the `rustdoc` tool so that it is supported for `compiletest` to then pass the crates in; and then I fix the issue by forcing the resolver to look over all the crates before we then lower the input ready for processing into documentation.

The first commit (the `--extern-private`) could be replaced with a commit which adds support for `--extern` to `compiletest` if preferred, though I think that adding `--extern-private` to `rustdoc` is more useful anyway since it makes the CLI a little more like `rustc`'s which might help reduce surprise for someone running it by hand or in their own test code.

The PR is meant to fix #66159 though it may also fix #65840.

cc @GuillaumeGomez
2019-11-13 23:22:03 +00:00
Eric Huss
1907589fbb rustdoc: Stabilize edition annotation. 2019-11-08 16:15:17 -08:00
Daniel Silverstone
33ded3ec7f
rustdoc: Deliberately load extern crates before processing docs
In order that we can successfully later resolve paths in crates
which weren't loaded as a result of merely parsing the crate
we're documenting, we force the resolution of the path to each
crate before cloning the resolver to use later.  Closes #66159

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-11-08 07:41:40 +00:00
Eric Huss
e0058ce994 Add more --extern tests. 2019-11-07 05:51:17 -08:00
Tyler Mandry
48a9f59ae7
Rollup merge of #65857 - kinnison:kinnison/issue-55364, r=Manisheart,GuillaumeGomez
rustdoc: Resolve module-level doc references more locally

Module level docs should resolve intra-doc links as locally as
possible.  As such, this commit alters the heuristic for finding
intra-doc links such that we attempt to resolve names mentioned
in *inner* documentation comments within the (sub-)module rather
that from the context of its parent.

I'm hoping that this fixes #55364 though right now I'm not sure it's the right fix.

r? @GuillaumeGomez
2019-11-01 11:20:12 -07:00
Daniel Silverstone
c24a099e8b
rustdoc: Resolve module-level doc references more locally
Module level docs should resolve intra-doc links as locally as
possible.  As such, this commit alters the heuristic for finding
intra-doc links such that we attempt to resolve names mentioned
in *inner* documentation comments within the (sub-)module rather
that from the context of its parent.

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-10-31 07:49:54 +00:00
Guillaume Gomez
a212960a4b stabilize cfg(doctest) 2019-10-29 13:42:55 +01:00
varkor
9f788f3a2b Fix rustdoc const generics test 2019-10-22 12:26:32 +01:00
Mazdak Farrokhzad
194d1935d3
Rollup merge of #65314 - tmiasko:rustdoc-z, r=ollie27
rustdoc: forward -Z options to rustc

Currently rustdoc does not forward `-Z` options to rustc when building
test executables. This makes impossible to use rustdoc to run test
samples when crate under test is instrumented with one of sanitizers
`-Zsanitizer=...`, since the final linking step will not include
sanitizer runtime library.

Forward `-Z` options to rustc to solve the issue.

Helps with #43031.
2019-10-21 01:39:11 +02:00
Vadim Petrochenkov
25cc99fca0 privacy: Avoid one more unwrap causing an ICE in rustdoc
The issue is rustdoc-specific because its root cause if the `everybody_loops` pass makes some def-ids to not have local hir-ids
2019-10-19 00:23:57 +03:00
Tomasz Miąsko
5db17335a1 rustdoc: forward -Z options to rustc
Currently rustdoc does not forward `-Z` options to rustc when building
test executables. This makes impossible to use rustdoc to run test
samples when crate under test is instrumented with one of sanitizers
`-Zsanitizer=...`, since the final linking step will not include
sanitizer runtime library.

Forward `-Z` options to rustc to solve the issue.

Helps with #43031.
2019-10-11 22:29:11 +02:00
Eduard-Mihai Burtescu
a88d181a02 rustc: rely on c_variadic == true instead of CVarArgs in HIR/Ty fn signatures. 2019-09-28 17:39:00 +03:00
bors
a37fe2de69 Auto merge of #63937 - Nashenas88:rustdoc_57180, r=GuillaumeGomez
Fix ICE in rustdoc when merging generic and where bounds of an Fn with an output

Fixes #57180
2019-09-27 13:51:25 +00:00
Mazdak Farrokhzad
34067ee961
Rollup merge of #64599 - csmoe:doc_async_reexport, r=nikomatsakis
Rustdoc render async function re-export

Closes #63710
r? @nikomatsakis
2019-09-25 03:48:27 +02:00
csmoe
726fe3b255 add rustdoc test for async fn reexport 2019-09-21 08:34:51 +00:00
Aaron Hill
3daa8bd2e4
Generate proc macro harness in AST order.
This ensures that we match the order used by proc macro metadata
serialization.

Fixes #64251
2019-09-17 19:10:10 -04:00
Mazdak Farrokhzad
d855bde457
Rollup merge of #63930 - estebank:rustdoc-ice, r=GuillaumeGomez
Account for doc comments coming from proc macros without spans

Fix https://github.com/rust-lang/rust/issues/63821.
2019-09-05 12:11:07 +02:00
Mazdak Farrokhzad
1ea8fc587c
Rollup merge of #62734 - GuillaumeGomez:hide-default-methods, r=Mark-Simulacrum
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-29 17:13:57 +02:00
bors
347654324d Auto merge of #62855 - Aaron1011:feature/rustdoc-reexport-final, r=petrochenkov
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-29 01:22:11 +00:00
Paul Daniel Faria
143b83a3c1 Add regression test for issue, apply suggestion to convert to assert_eq 2019-08-28 00:21:30 -04:00
Esteban Küber
7ed542da78 add regression test 2019-08-26 21:35:22 -07:00
bors
521d784074 Auto merge of #61613 - sinkuu:impl_trait_inline, r=ollie27
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-25 19:20:20 +00:00
Aaron Hill
1498608135
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-24 13:11:57 -04:00
Mazdak Farrokhzad
228015acd2 Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
Shotaro Yamada
1fe6160c7e Fix ICE with impl Trait in type bounds 2019-08-19 17:49:54 +09:00
Shotaro Yamada
cc6dbb4f23 Fix tidy 2019-08-19 17:49:54 +09:00
Shotaro Yamada
5f9e26382f Support nested impl Trait 2019-08-19 17:49:54 +09:00
Shotaro Yamada
9beff38382 Associated type bound for inlined impl Trait doc 2019-08-19 17:49:54 +09:00
Shotaro Yamada
b78367d8e8 Support impl Trait in inlined documentation 2019-08-19 17:49:54 +09:00
Mazdak Farrokhzad
e6994714d9
Rollup merge of #62821 - GuillaumeGomez:not-listed-methods, r=Mark-Simulacrum
Not listed methods

Fixes #60326.

cc @rust-lang/rustdoc
r? @QuietMisdreavus
2019-08-06 15:36:28 +02:00
Guillaume Gomez
4fb29f9fd2 Add test for DerefMut methods 2019-08-06 00:41:52 +02:00
bors
460072ebee Auto merge of #63048 - Aaron1011:feature/rustdoc-reexport-doc, r=GuillaumeGomez
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-04 11:30:12 +00:00
Pietro Albini
e2934bab3e
Rollup merge of #62971 - GuillaumeGomez:keyword-sidebar, r=nobody
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-08-01 16:00:25 +02:00
Aaron Hill
7ee9b7a410
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-07-27 14:35:14 -04:00
Vadim Petrochenkov
8eaf17bca2 Introduce built-in macros through libcore 2019-07-26 13:09:54 +03:00
Guillaume Gomez
08a8de8181 Add keywords item into the sidebar 2019-07-25 14:29:05 +02:00
Guillaume Gomez
f7656b6576 Update tests 2019-07-16 23:24:26 +02:00
Vadim Petrochenkov
48635226d8 Remove MacroKind::ProcMacroStub
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-11 00:12:07 +03:00
Mazdak Farrokhzad
9c144335bf
Rollup merge of #62450 - nagisa:reclimit, r=pnkfelix
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-09 21:01:49 +02:00
QuietMisdreavus
bed54cf854 rustdoc: set cfg(doctest) when collecting doctests 2019-07-06 21:37:17 -05:00
Simonas Kazlauskas
7e40df3f13 Raise the default recursion limit to 128 2019-07-07 00:12:35 +03:00
Mark Rousskov
007d87f171 Permit use of mem::uninitialized via allow(deprecated) 2019-07-04 21:01:35 -04:00
Guillaume Gomez
a683bb1754 Revert "implicit Option-returning doctests"
This reverts commit 6bb6c001be.
2019-07-01 16:41:37 +02:00
Simonas Kazlauskas
4c8d00a3ec rustdoc: generate implementors for all auto traits
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-20 17:36:43 +03:00
Guillaume Gomez
8f3753703c Fix slice const generic length display 2019-06-07 15:54:16 +02:00
Mazdak Farrokhzad
525d7deb6d
Rollup merge of #61263 - GuillaumeGomez:valid-html, r=Manishearth
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-06-01 06:50:02 +02:00
Mazdak Farrokhzad
07d0b578c1
Rollup merge of #61279 - llogiq:implicit-option-main-doctests, r=GuillaumeGomez
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-30 10:52:56 +02:00
Mazdak Farrokhzad
040af62a5a
Rollup merge of #60802 - euclio:pulldown-cmark-panic, r=GuillaumeGomez
upgrade rustdoc's `pulldown-cmark` to 0.5.2

Fixes #60482.
2019-05-30 10:52:48 +02:00
Andy Russell
ed8a4d5bc1
upgrade rustdoc's pulldown-cmark to 0.5.2
Fixes #60482.
2019-05-29 10:59:59 -04:00
Guillaume Gomez
35091620e6 Don't generate div inside header (h4/h3/h...) elements 2019-05-29 16:51:48 +02:00
varkor
9c9b7b4eac Add a regression test for unevaluated const in rustdoc 2019-05-28 22:53:48 +01:00
varkor
7f9dc73a31 Add a const-generics folder to rustdoc tests 2019-05-28 22:53:36 +01:00
Andre Bogus
6bb6c001be implicit Option-returning doctests
This distinguishes `Option` and `Result`-returning doctests with
implicit `main` method, where the former tests must end with
`Some(())`.
2019-05-28 19:10:39 +02:00
Mazdak Farrokhzad
90788159d7
Rollup merge of #60773 - Aaron1011:fix/rustdoc-project-all, r=eddyb
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-22 18:08:14 +02:00
Mazdak Farrokhzad
a34dae3587
Rollup merge of #60511 - taiki-e:libstd-intra-doc, r=Dylan-DPC
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-20 23:02:59 +02:00
bors
6afcb56285 Auto merge of #60065 - QuietMisdreavus:async-move-doctests, r=ollie27
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-19 16:48:12 +00:00
bors
e0d2f7462b Auto merge of #60760 - GuillaumeGomez:generic-display, r=varkor,badboy
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-19 06:06:12 +00:00
bors
963184bbb6 Auto merge of #60093 - GuillaumeGomez:fix-attrs-pos, r=Manishearth
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-18 20:49:22 +00:00
Guillaume Gomez
2caeaf54a1 Fix display of const generics in rustdoc 2019-05-18 15:44:19 +02:00
Aaron Hill
476ea9ef1c
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-13 01:52:04 -04:00
QuietMisdreavus
a6d26eb053 add test for async move in a doctest 2019-05-06 15:20:18 -05:00
QuietMisdreavus
e66e1c7186 update playground url tests with new edition behavior 2019-05-06 15:20:18 -05:00
Taiki Endo
ccb9dac5ed Fix intra-doc link resolution failure on re-exporting libstd 2019-05-04 23:48:57 +09:00
Andy Russell
8fc6e420d1
use span instead of div for since version 2019-05-03 12:55:31 -04:00
Eduard-Mihai Burtescu
c835607907 rustdoc: remove def_ctor hack. 2019-04-30 12:55:38 +03:00
Dmitry Murzin
d2b4f4d452 Make "Implementations on Foreign Types" items in sidebar link to specific impls 2019-04-26 22:39:00 +03:00
Mazdak Farrokhzad
878a7d6ea5
Rollup merge of #60134 - GuillaumeGomez:fix-index-page, r=Manishearth
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-26 03:50:14 +02:00
Guillaume Gomez
f199627e69 Remove useless code and update index page test 2019-04-24 23:45:18 +02:00
Taylor Cramer
3f966dcd53 Stabilize futures_api 2019-04-23 16:13:53 -07:00
varkor
62838975d0 Remove unnecessary ignore-tidy-linelength 2019-04-23 11:42:14 +01:00
varkor
7f0f0e31ec Remove double trailing newlines 2019-04-22 16:57:01 +01:00
Guillaume Gomez
f20d586c6f Update test 2019-04-19 10:20:18 +02:00
Mazdak Farrokhzad
426e747b7e
Rollup merge of #59992 - QuietMisdreavus:static-settings-path, r=GuillaumeGomez
rustdoc: use --static-root-path for settings.js

At the time i was writing https://github.com/rust-lang/docs.rs/pull/332, i noticed that the `settings.js` file that was being loaded was not being loaded from the `--static-root-path`. This PR fixes that so that users on docs.rs can effectively cache this file.
2019-04-16 05:14:24 +02:00
QuietMisdreavus
1c0e1c10d5 use --static-root-path for settings.js 2019-04-15 11:20:08 -05:00
Oliver Middleton
1db76c1bff rustdoc: Remove default keyword from re-exported trait methods 2019-04-14 23:55:14 +01:00
bors
ee1474acc4 Auto merge of #58972 - QuietMisdreavus:intra-doc-link-imports, r=GuillaumeGomez
rustdoc: don't process `Crate::external_traits` when collecting intra-doc links

Part of https://github.com/rust-lang/rust/issues/58745, closes https://github.com/rust-lang/rust/pull/58917

The `collect-intra-doc-links` pass keeps track of the modules it recurses through as it processes items. This is used to know what module to give the resolver when looking up links. When looking through the regular items of the crate, this works fine, but the `DocFolder` trait as written doesn't just process the main crate hierarchy - it also processes the trait items in the `external_traits` map. This is useful for other passes (so they can strip out `#[doc(hidden)]` items, for example), but here it creates a situation where we're processing items "outside" the regular module hierarchy. Since everything in `external_traits` is defined outside the current crate, we can't fall back to finding its module scope like we do with local items.

Skipping this collection saves us from emitting some spurious warnings. We don't even lose anything by skipping it, either - the docs loaded from here are only ever rendered through `html::render::document_short` which strips any links out, so the fact that the links haven't been loaded doesn't matter. Hopefully this removes most of the remaining spurious resolution warnings from intra-doc links.

r? @GuillaumeGomez
2019-04-11 08:48:26 +00:00
Guillaume Gomez
c966c45897 Add test from #59033 2019-04-03 22:18:41 +02:00
Guillaume Gomez
f6eb09bf63 Fix explicit_predicates_of 2019-04-03 22:13:12 +02:00
Guillaume Gomez
ddd034aa6f Fix invalid bounds string generation in rustdoc 2019-03-31 15:32:25 +02:00
bors
48e354d224 Auto merge of #58927 - GuillaumeGomez:default-keyword, r=QuietMisdreavus
Add default keyword handling in rustdoc

Fixes #58898.

r? @QuietMisdreavus
2019-03-21 08:55:50 +00:00
Andy Russell
33442b133c
overhaul intra-doc-link ambiguity warning
- Makes the warning part of the `intra_doc_link_resolution_failure`
lint.
- Tightens the span to just the ambiguous link.
- Reports ambiguities across all three namespaces.
- Uses structured suggestions for disambiguation.
- Adds a test for the warnings.
2019-03-15 14:15:06 -04:00
Guillaume Gomez
541ad45a83 Add default keyword handling in rustdoc 2019-03-14 13:18:36 +01:00
Alexander Regueiro
fe30743c79 Moved issue tests to subdirs and normalised names. 2019-03-14 01:00:49 +00:00
QuietMisdreavus
49cde40412 add test for spurious intra-doc link warning 2019-03-06 10:57:38 -06:00
Dan Robertson
58147d486b
Support defining C compatible variadic functions
Add support for defining C compatible variadic functions in unsafe rust
with extern "C".
2019-02-27 10:21:35 -05:00
Trevor Spiteri
bde4d1945c rustdoc: support methods on primitives in intra-doc links 2019-02-23 18:01:26 +01:00
kennytm
8d1e4323b3
Rollup merge of #58409 - euclio:impl-trait-wrapping, r=QuietMisdreavus
rustdoc: respect alternate flag when formatting impl trait

Fixes #58226.

Before:
<img width="963" alt="screen shot 2019-02-12 at 3 23 30 pm" src="https://user-images.githubusercontent.com/1372438/52665732-4496ea00-2eda-11e9-9e29-efffe43b2abf.png">

After:
<img width="964" alt="screen shot 2019-02-12 at 3 23 51 pm" src="https://user-images.githubusercontent.com/1372438/52665733-452f8080-2eda-11e9-999a-dd1fb28dee16.png">
2019-02-20 11:58:31 +08:00
kennytm
5a06eab1f5
Rollup merge of #56470 - llogiq:process-termination-doctest, r=GuillaumeGomez
Modify doctest's auto-`fn main()` to allow `Result`s

This lets the default `fn main()` ~~return `impl Termination`~~ unwrap Results, which allows the use of `?` in most tests without adding it manually. This fixes #56260

~~Blocked on `std::process::Termination` stabilization.~~

Using `Termination` would have been cleaner, but this should work OK.
2019-02-20 01:13:12 +08:00
Andre Bogus
dad211ef9f Modify doctest's auto-fn main() to allow Results
This lets the default `fn main()` unwrap any `Result`s, which
allows the use of `?` in most tests without adding it manually.
2019-02-17 16:42:49 +01:00
kennytm
f8ccdeb0d4
Rollup merge of #57929 - GuillaumeGomez:rustodc-remove-old-style-files, r=ollie27
Rustdoc remove old style files

Reopening of #56577 (which I can't seem to reopen...).

I made the flag unstable so with this change, what was blocking the PR is now gone I assume.
2019-02-17 14:52:21 +08:00
Mazdak Farrokhzad
193c3773c2
Rollup merge of #58202 - varkor:deprecated-future-external, r=GuillaumeGomez
Ignore future deprecations in #[deprecated]

The future deprecation warnings should only apply to `#[rustc_deprecated]` as they take into account rustc's version. Fixes #57952.

I've also slightly modified rustdoc's display of future deprecation notices to make it more consistent, so I'm assigning a rustdoc team member for review to make sure this is okay.

r? @GuillaumeGomez
2019-02-13 18:12:30 +01:00
Mazdak Farrokhzad
856e41142c
Rollup merge of #58166 - euclio:deprecation-shorthand, r=petrochenkov
allow shorthand syntax for deprecation reason

Fixes #48271.

Created based on discussion in #56896.
2019-02-13 04:37:02 +01:00
bors
b244f61b77 Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnik
Cosmetic improvements to doc comments

This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase).

r? @steveklabnik

Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-12 19:09:24 +00:00
Andy Russell
e827c9ab3c
respect alternate flag when formatting impl trait 2019-02-12 13:45:36 -05:00
varkor
c8752415dc Add rustdoc index page test for future deprecation attributes 2019-02-11 11:17:35 +00:00
varkor
01df8fe8ff Add a rustdoc test for future rustc_deprecated attributes 2019-02-11 11:17:35 +00:00
varkor
3dc660f1f5 Update existing rustdoc test 2019-02-11 11:17:35 +00:00
Alexander Regueiro
b87363e763 tests: doc comments 2019-02-10 23:42:32 +00:00
Guillaume Gomez
adf516b94e
Rollup merge of #58243 - GuillaumeGomez:trait-alias-docs, r=Manishearth
Add trait alias support in rustdoc

Fixes #57595.

r? @QuietMisdreavus
2019-02-10 21:45:13 +01:00
Guillaume Gomez
cdbd07cc40
Rollup merge of #58203 - euclio:rustdoc-async, r=GuillaumeGomez
rustdoc: display sugared return types for async functions

Fixes #58027.
2019-02-10 21:45:12 +01:00
Guillaume Gomez
b1d82ac6ed Remove spotlight for trait aliases and fix nits 2019-02-10 16:56:21 +01:00
Guillaume Gomez
74e97f3381 Add trait alias support in rustdoc 2019-02-10 14:49:20 +01:00
Guillaume Gomez
d26475505b put back macro redirect 2019-02-09 14:29:03 +01:00
Guillaume Gomez
f61a4f86db
Rollup merge of #58033 - euclio:rustdoc-tags, r=QuietMisdreavus
rustdoc: wrap stability tags in colored spans

A cosmetic change to make the stability tags stand out a bit against the docs. Opening for discussion.

Before:

![screen shot 2019-01-31 at 3 29 36 pm](https://user-images.githubusercontent.com/1372438/52083406-54730d80-256d-11e9-8e61-b8caff569434.png)
![screen shot 2019-01-31 at 3 31 32 pm](https://user-images.githubusercontent.com/1372438/52083408-54730d80-256d-11e9-97b7-43e808448f65.png)

After:
![screen shot 2019-01-31 at 3 29 18 pm](https://user-images.githubusercontent.com/1372438/52083405-54730d80-256d-11e9-9983-19d9519b2ed8.png)
![screen shot 2019-01-31 at 3 29 46 pm](https://user-images.githubusercontent.com/1372438/52083407-54730d80-256d-11e9-8c32-11a1ad7d3f34.png)

r? @QuietMisdreavus
2019-02-07 14:28:34 +01:00
Guillaume Gomez
1a99a32bd7
Rollup merge of #58028 - GuillaumeGomez:fix-settings-image-link, r=QuietMisdreavus
Fix image link in the settings menu

Fixes #57892.

r? @QuietMisdreavus
2019-02-07 14:28:33 +01:00
Guillaume Gomez
bb9d66d3ba
Rollup merge of #57954 - euclio:rustdoc-stability, r=QuietMisdreavus
rustdoc: remove blank unstable spans

Rustdoc generates blank unstable spans for unstable struct fields: ![screen shot 2019-01-28 at 1 05 04 pm](https://user-images.githubusercontent.com/1372438/51856295-5e8ed500-22fd-11e9-8074-025eddb4ef65.png)

This PR removes them:
![screen shot 2019-01-28 at 1 07 22 pm](https://user-images.githubusercontent.com/1372438/51856424-aada1500-22fd-11e9-86f0-34e2aa78b8b1.png)

r? @QuietMisdreavus
2019-02-07 14:28:32 +01:00
Andy Russell
4deb5959a3
display sugared return types for async functions 2019-02-06 09:24:03 -05:00
Andy Russell
113b7f7be1
allow shorthand syntax for deprecation reason 2019-02-05 15:26:26 -05:00
QuietMisdreavus
c955f172b2 don't try to get a DefId for a Def that doesn't have one 2019-02-01 11:17:33 -06:00
Guillaume Gomez
5cf20ca3c5 Fix image link in the settings menu 2019-02-01 11:27:59 +01:00
Andy Russell
ea2b1b035b
rustdoc: wrap stability tags in colored spans 2019-01-31 15:15:59 -05:00
Andy Russell
30b1c35f03
rustdoc: remove blank unstable spans 2019-01-28 13:04:05 -05:00
Guillaume Gomez
65440a3f4f Make 'generate-redirect-pages' option unstable 2019-01-27 12:46:18 +01:00
Guillaume Gomez
270151bffb Add generate-old-style-files option to rustdoc 2019-01-27 12:46:18 +01:00
Guillaume Gomez
1ac727772b Remove rustdoc old style files generation 2019-01-27 00:34:05 +01:00
QuietMisdreavus
b876694734 add intra-doc link test to proc-macro test 2019-01-22 15:44:19 -06:00
bors
846ea58cd5 Auto merge of #56884 - euclio:codeblock-diagnostics, r=QuietMisdreavus
rustdoc: overhaul code block lexing errors

Fixes #53919.

This PR moves the reporting of code block lexing errors from rendering time to an early pass, so we can use the compiler's error reporting mechanisms. This dramatically improves the diagnostics in this situation: we now de-emphasize the lexing errors as a note under a warning that has a span and suggestion instead of just emitting errors at the top level.

Additionally, this PR generalizes the markdown -> source span calculation function, which should allow other rustdoc warnings to use better spans in the future.

Last, the PR makes sure that the code block is always emitted in the docs, even if it fails to highlight correctly.

Of note:
- The new pass unfortunately adds another pass over the docs to gather the doc blocks for syntax-checking. I wonder if this could be combined with the pass that looks for testable blocks? I'm not familiar with that code, so I don't know how feasible that is.
- `pulldown_cmark` doesn't make it easy to find the spans of the code blocks, so the code that calculates the spans is a little nasty. It works for all the test cases I threw at it, but I wouldn't be surprised if an edge case would break it. Should have a thorough review.
- This PR worsens the state of #56885, since those certain fatal lexing errors are now emitted before docs get generated at all.
2019-01-20 19:01:38 +00:00
bors
af73e64423 Auto merge of #56722 - Aaron1011:fix/blanket-eval-overflow, r=nikomatsakis
Fix stack overflow when finding blanket impls

Currently, SelectionContext tries to prevent stack overflow by keeping
track of the current recursion depth. However, this depth tracking is
only used when performing normal section (which includes confirmation).
No such tracking is performed for evaluate_obligation_recursively, which
can allow a stack overflow to occur.

To fix this, this commit tracks the current predicate evaluation depth.
This is done separately from the existing obligation depth tracking:
an obligation overflow can occur across multiple calls to 'select' (e.g.
when fulfilling a trait), while a predicate evaluation overflow can only
happen as a result of a deep recursive call stack.

Fixes #56701

I've re-used `tcx.sess.recursion_limit` when checking for predication evaluation overflows. This is such a weird corner case that I don't believe it's necessary to have a separate setting controlling the maximum depth.
2019-01-19 05:05:48 +00:00
bors
6599946272 Auto merge of #57520 - alexreg:tidy-copyright-lint, r=Mark-Simulacrum
Add lint for copyright headers to 'tidy' tool

r? @Mark-Simulacrum

CC @centril
2019-01-17 07:36:37 +00:00
Andy Russell
8c93798e9f
rustdoc: check code block syntax in early pass 2019-01-14 21:21:21 -05:00
Mazdak Farrokhzad
6d00124b85
Rollup merge of #56874 - JohnHeitmann:docs-spacing, r=GuillaumeGomez
Simplify foreign type rendering.

Simplified foreign type rendering by switching from tables to flexbox. Also, removed some seemingly extraneous elements like “ghost” spans.

Reduces element count on the `std::iter::Iterator` page by 30%. On my laptop it drops Iterator page load time from ~15s to ~10s. Frame times during scrolling are a hair lower too.

Known visual changes (happy to tweak based on feedback):
* The main `impl ...` headers are now getting the default, larger, h3 font size. This was an accident, but I liked how it turned out so I didn't fix it.
* There's a hair less vertical spacing between the end of a where block and the start of the next fn. Now, all spacing is consistent. I think this looks a bit worse. I may tweak vertical spacing more here or in a follow-up that cleans up vertical spacing more broadly.
* "[src]" links are all sized at 17px. A few were 19px in the original.

I haven't yet done heavy cross-browser or cross-crate testing. I was hoping to get a quick thumbs up or thumbs down here at this first draft, then if this is on the right track I'll spend some time on that testing.

TODO:

- [x] Test on Chrome
- [x] Test on Firefox
- [ ] ~~Test on UC Android~~
- [x] Test on Edge
- [x] Test on iOS safari
- [x] Test on desktop safari
- [x] Update automated tests
- [x] Increase vertical margin
- [x] Fix "Important traits for" hover overlap
- [x] Wait for #55798 to land & merge it
2019-01-13 21:18:09 +01:00
Alexander Regueiro
2e30a3c4d8 Removed more copyright notices. 2019-01-13 19:47:02 +00:00
Alexander Regueiro
88336ea4c3 Cosmetic improvements 2019-01-13 19:47:02 +00:00
DebugSteven
ca47808479 add test for pub extern crate 2019-01-10 21:18:46 -05:00
Pietro Albini
14fb35fa4f
Rollup merge of #57358 - euclio:docck-unicode, r=QuietMisdreavus
use utf-8 throughout htmldocck

This commit improves compatibility with Python 3, which already uses
Unicode throughout.

It also fixes a subtle incompatibility stemming from the use of
`entitydefs`, which contains replacement text _encoded in latin-1_ for
HTML entities. When using Python 3, this would cause `0xa0` to be
incorrectly added to the element tree.

This meant that there was a rustdoc test that would pass under Python 2
but fail under Python 3, due to an incorrect regex match against the
non-breaking space character. This commit triggers that failure in both
versions, and also fixes it.
2019-01-07 16:25:36 +01:00
Andy Russell
6fefcee73a
use utf-8 throughout htmldocck
This commit improves compatibility with Python 3, which already uses
Unicode throughout.

It also fixes a subtle incompatibility stemming from the use of
`entitydefs`, which contains replacement text _encoded in latin-1_ for
HTML entities. When using Python 3, this would cause `0xa0` to be
incorrectly added to the element tree.

This meant that there was a rustdoc test that would pass under Python 2
but fail under Python 3, due to an incorrect regex match against the
non-breaking space character. This commit triggers that failure in both
versions, and also fixes it.
2019-01-06 01:27:33 -05:00
QuietMisdreavus
0b55c79072 force binary filename for compiled doctests 2019-01-04 09:57:17 -06:00
Aaron Hill
6d54672acf
Fix stack overflow when finding blanket impls
Currently, SelectionContext tries to prevent stack overflow by keeping
track of the current recursion depth. However, this depth tracking is
only used when performing normal section (which includes confirmation).
No such tracking is performed for evaluate_obligation_recursively, which
can allow a stack overflow to occur.

To fix this, this commit tracks the current predicate evaluation depth.
This is done separately from the existing obligation depth tracking:
an obligation overflow can occur across multiple calls to 'select' (e.g.
when fulfilling a trait), while a predicate evaluation overflow can only
happen as a result of a deep recursive call stack.

Fixes #56701
2019-01-03 21:56:52 -05:00
bors
0432798fdb Auto merge of #57194 - matthiaskrgr:copyright_headers, r=Centril
remove more copyright headers

r? @Mark-Simulacrum
2019-01-01 06:34:11 +00:00
bors
43d26b1f35 Auto merge of #57006 - GuillaumeGomez:no-crate-filter, r=QuietMisdreavus
Add no-crate filter option on rustdoc

@onur asked me about it so here it is!

r? @QuietMisdreavus
2018-12-29 01:22:04 +00:00
Matthias Krüger
68860989eb remove remaining copyright headers 2018-12-28 21:50:33 +01:00
John Heitmann
34bd2b845b Simplify foreign type rendering.
Simplified foreign type rendering by switching from tables to flexbox. Also, removed some seemingly extraneous elements like “ghost” spans.

Reduces element count on std::iter::Iterator by 30%.
2018-12-27 21:22:27 -08:00
bors
f2b92174e3 Auto merge of #56838 - Aaron1011:fix/rustdoc-infer-unify, r=nikomatsakis
Call poly_project_and_unify_type on types that contain inference types

Commit f57247c48c (Ensure that Rusdoc discovers all necessary auto
trait bounds) added a check to ensure that we only attempt to unify a
projection predicatre with inference variables. However, the check it
added was too strict - instead of checking that a type *contains* an
inference variable (e.g. '&_', 'MyType<_>'), it required the type to
*be* an inference variable (i.e. only '_' would match).

This commit relaxes the check to use 'ty.has_infer_types', ensuring that
we perform unification wherever possible.

Fixes #56822
2018-12-27 14:35:58 +00:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Guillaume Gomez
dbcf68951c Add no-crate filter option on rustdoc 2018-12-24 18:19:36 +01:00
Mazdak Farrokhzad
b42a3acaec stabilize min_const_unsafe_fn in 1.33. 2018-12-23 10:29:38 +01:00
kennytm
4446c65d9b
Rollup merge of #57011 - QuietMisdreavus:static-root-path, r=GuillaumeGomez
rustdoc: add new CLI flag to load static files from a different location

This PR adds a new CLI flag to rustdoc, `--static-root-path`, which controls how rustdoc links pages to the CSS/JS/font static files bundled with the output. By default, these files are linked with a series of `../` which is calculated per-page to link it to the documentation root - i.e. a relative link to the directory given by `-o`. This is causing problems for docs.rs, because even though docs.rs has saved one copy of these files and is dispatching them dynamically, browsers have no way of knowing that these are the same files and can cache them. This can allow it to link these files as, for example, `/rustdoc.css` instead of `../../rustdoc.css`, creating a single location that the files are loaded from.

I made sure to only change links for the *static* files, those that don't change between crates. Files like the search index, aliases, the source files listing, etc, are still linked with relative links.

r? @GuillaumeGomez

cc @onur
2018-12-23 02:12:16 +08:00
bors
24667aa19d Auto merge of #56824 - euclio:internal-apis, r=QuietMisdreavus
rustdoc: display rustc_private APIs as "Internal"

This PR updates the display of `rustc_private` APIs to be "Internal" instead of "Experimental", and changes the colors appropriately. It also updates the copy of the `rustc_private` feature to sound more informative and less like a compiler suggestion.

The PR additionally contains a significant refactor of the `short_stability` function to remove duplication and fix a few rendering bugs due to extra or missing spaces.

Before:

![screen shot 2018-12-14 at 11 45 28 am](https://user-images.githubusercontent.com/1372438/50015926-c9768d80-ff95-11e8-9649-5df29df6909b.png)

After:

![screen shot 2018-12-14 at 11 45 11 am](https://user-images.githubusercontent.com/1372438/50015934-cf6c6e80-ff95-11e8-912b-74b893f55425.png)
2018-12-22 04:21:30 +00:00
bors
6d34ec18c7 Auto merge of #55798 - GuillaumeGomez:version-display-associated-const, r=QuietMisdreavus
Add version display for associated consts

Fixes #54030.

<img width="1440" alt="screenshot 2018-11-08 at 23 57 29" src="https://user-images.githubusercontent.com/3050060/48232648-99decf00-e3b2-11e8-9f41-6bd12a161c7d.png">

r? @QuietMisdreavus
2018-12-21 01:58:16 +00:00
bors
09d6ab90e5 Auto merge of #56845 - GuillaumeGomez:const-docs, r=oli-obk
Don't render const keyword on stable

Fixes #55246.

Continuation of #55327.

r? @oli-obk
2018-12-20 19:26:12 +00:00
Andy Russell
8d393bf797
display rustc_private APIs as "Internal" 2018-12-20 13:47:39 -05:00
QuietMisdreavus
8dc8d7ac51 split extra_scripts to handle root_path shenanigans 2018-12-20 10:57:03 -06:00
QuietMisdreavus
0b0a00cc05 new --static-root-path flag for controlling static file locations 2018-12-20 10:18:45 -06:00
Guillaume Gomez
ca04c63930 Add test for associated const version display 2018-12-20 10:39:25 +01:00
Guillaume Gomez
a6943d9d66 Set constness correctly 2018-12-19 09:57:29 +01:00
Guillaume Gomez
170f068103 Don't render const keyword on stable 2018-12-18 20:36:15 +01:00
Guillaume Gomez
2968a5a398 Fix DOM errors 2018-12-18 01:04:23 +01:00
Mazdak Farrokhzad
32a6a95f41
Rollup merge of #56793 - QuietMisdreavus:better-doctests, r=GuillaumeGomez
rustdoc: look for comments when scraping attributes/crates from doctests

Fixes https://github.com/rust-lang/rust/issues/56727

When scraping out crate-level attributes and `extern crate` statements, we wouldn't look for comments, so any presence of comments would shunt it and everything after it into "everything else". This could cause parsing issues when looking for `fn main` and `extern crate my_crate` later on, which would in turn cause rustdoc to incorrectly wrap a test with `fn main` when it already had one declared.

I took the opportunity to clean up the logic a little bit, but it would still benefit from a libsyntax-based loop like the `fn main` detection.
2018-12-16 14:08:30 +01:00
Aaron Hill
a375410e1f
Call poly_project_and_unify_type on types that contain inference types
Commit f57247c48c (Ensure that Rusdoc discovers all necessary auto
trait bounds) added a check to ensure that we only attempt to unify a
projection predicatre with inference variables. However, the check it
added was too strict - instead of checking that a type *contains* an
inference variable (e.g. '&_', 'MyType<_>'), it required the type to
*be* an inference variable (i.e. only '_' would match).

This commit relaxes the check to use 'ty.has_infer_types', ensuring that
we perform unification wherever possible.

Fixes #56822
2018-12-14 21:33:25 -05:00
Andy Russell
5f3431691d
simplify deprecation and stability rendering 2018-12-14 11:15:25 -05:00
QuietMisdreavus
8faaef66c9 add test for parsing comments in doctest headers 2018-12-14 09:17:11 -06:00
Oliver Middleton
0bb075f5a5 rustdoc: Fix local reexports of proc macros
Filter out `ProcMacroStub`s to avoid an ICE during cleaning.

Also add proc macros to `cache().paths` so it can generate links.
2018-12-08 18:33:09 +00:00
bors
5182cc1ca6 Auto merge of #55318 - Aaron1011:fix/final-auto-trait-resolve, r=nikomatsakis
Ensure that Rustdoc discovers all necessary auto trait bounds

Fixes #50159

This commit makes several improvements to AutoTraitFinder:

* Call infcx.resolve_type_vars_if_possible before processing new
predicates. This ensures that we eliminate inference variables wherever
possible.
* Process all nested obligations we get from a vtable, not just ones
with depth=1.
  * The 'depth=1' check was a hack to work around issues processing
certain predicates. The other changes in this commit allow us to
properly process all predicates that we encounter, so the check is no
longer necessary,
* Ensure that we only display predicates *without* inference variables
to the user, and only attempt to unify predicates that *have* an
inference variable as their type.

Additionally, the internal helper method is_of_param now operates
directly on a type, rather than taking a Substs. This allows us to use
the 'self_ty' method, rather than directly dealing with Substs.
2018-12-06 22:23:24 +00:00
Pietro Albini
3073c7af5f
Rollup merge of #56315 - weiznich:rustdoc_inline_macro_reexport, r=QuietMisdreavus
Rustdoc inline macro reexport

Fixes #56173

I assume this needs to have tests? Any pointers where these need to be added?
2018-12-06 07:48:48 +01:00
Georg Semmler
956b03f7db
Add a test case for inlining the docs of a macro reexport 2018-12-04 10:24:17 +01:00
bors
596e10fd32 Auto merge of #55707 - GuillaumeGomez:file-sidebar, r=QuietMisdreavus
Add source file sidebar

This is just a start currently but that gives a good overview of what it'll look like:

<img width="1440" alt="screenshot 2018-11-06 at 01 39 15" src="https://user-images.githubusercontent.com/3050060/48035592-05336180-e165-11e8-82e1-5ead0c345eb9.png">

r? @QuietMisdreavus
2018-12-04 07:00:19 +00:00
bors
91d5d56c00 Auto merge of #55682 - GuillaumeGomez:primitive-sidebar-link-gen, r=QuietMisdreavus
Fixes primitive sidebar link generation

Fixes #50746.
Fixes #55656.

r? @QuietMisdreavus
2018-12-04 03:34:32 +00:00
Eduard-Mihai Burtescu
3369929ddb tests: use force-host and no-prefer-dynamic in all proc_macro tests. 2018-11-30 06:15:20 +02:00
Eduard-Mihai Burtescu
d3ab4a74ef tests: remove ignore-stage1 where possible in proc_macro tests. 2018-11-30 06:15:20 +02:00
Aaron Hill
9139374181
Fix Tidy error 2018-11-28 21:39:20 -05:00
Aaron Hill
5045e12bd7
Filter out self-referential projection predicates
If we end up with a projection predicate that equates a type with
itself (e.g. <T as MyType>::Value == <T as MyType>::Value), we can
run into issues if we try to add it to our ParamEnv.
2018-11-28 21:15:06 -05:00
Aaron Hill
f57247c48c
Ensure that Rusdoc discovers all necessary auto trait bounds
Fixes #50159

This commit makes several improvements to AutoTraitFinder:

* Call infcx.resolve_type_vars_if_possible before processing new
predicates. This ensures that we eliminate inference variables wherever
possible.
* Process all nested obligations we get from a vtable, not just ones
with depth=1.
  * The 'depth=1' check was a hack to work around issues processing
certain predicates. The other changes in this commit allow us to
properly process all predicates that we encounter, so the check is no
longer necessary,
* Ensure that we only display predicates *without* inference variables
to the user, and only attempt to unify predicates that *have* an
inference variable as their type.

Additionally, the internal helper method is_of_param now operates
directly on a type, rather than taking a Substs. This allows us to use
the 'self_ty' method, rather than directly dealing with Substs.
2018-11-28 12:27:11 -05:00
Guillaume Gomez
1b432a612f Add test for source files feature 2018-11-24 14:24:54 +01:00
Guillaume Gomez
c746ecfa01 Add test for sidebar link generation 2018-11-21 23:21:50 +01:00
bors
f1d61837d1 Auto merge of #55912 - kennytm:rollup, r=kennytm
Rollup of 20 pull requests

Successful merges:

 - #55136 (Remove short doc where it starts with a codeblock)
 - #55711 (Format BtreeMap::range_mut example)
 - #55722 (impl_stable_hash_for: support enums and tuple structs with generic parameters)
 - #55754 (Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err)
 - #55804 (rustdoc: don't inline `pub use some_crate` unless directly asked to)
 - #55805 (Move `static_assert!` into librustc_data_structures)
 - #55837 (Make PhantomData #[structural_match])
 - #55840 (Fix TLS errors when downloading stage0)
 - #55843 (add FromIterator<A> to Box<[A]>)
 - #55858 (Small fixes on code blocks in rustdoc)
 - #55863 (Fix a typo in std::panic)
 - #55870 (Fix typos.)
 - #55874 (string: Add documentation for `From` impls)
 - #55879 (save-analysis: Don't panic for macro-generated use globs)
 - #55882 (Reference count `crate_inherent_impls`s return value.)
 - #55888 (miri: for uniformity, also move memory_deallocated to AllocationExtra)
 - #55889 (global allocators: add a few comments)
 - #55896 (Document optimizations enabled by FusedIterator)
 - #55905 (Change `Lit::short_name` to `Lit::literal_name`.)
 - #55908 (Fix their/there grammar nit)
2018-11-13 22:17:46 +00:00
bors
9fefb67669 Auto merge of #55356 - Aaron1011:fix/rustdoc-negative-auto, r=nikomatsakis
Check for negative impls when finding auto traits

Fixes #55321

When AutoTraitFinder begins examining a type, it checks for an explicit
negative impl. However, it wasn't checking for negative impls found when
calling 'select' on predicates found from nested obligations.

This commit makes AutoTraitFinder check for negative impls whenever it
makes a call to 'select'. If a negative impl is found, it immediately
bails out.

Normal users of SelectioContext don't need to worry about this, since
they stop as soon as an Unimplemented error is encountered. However, we
add predicates to our ParamEnv when we encounter this error, so we need
to handle negative impls specially (so that we don't try adding them to
our ParamEnv).
2018-11-13 19:16:18 +00:00
kennytm
2173681647
Rollup merge of #55136 - GuillaumeGomez:short-doc, r=QuietMisdreavus
Remove short doc where it starts with a codeblock

Fixes #54975.
2018-11-13 19:21:09 +08:00
Guillaume Gomez
3030cbea95 Remove short doc where it starts with a codeblock 2018-11-10 19:03:58 +01:00
QuietMisdreavus
401cb6bb53 don't inline pub use some_crate unless directly asked to 2018-11-09 09:07:57 -06:00
kennytm
88f214cfd5
Rollup merge of #55453 - Aaron1011:fix/rustdoc-lifetime, r=pnkfelix
Choose predicates without inference variables over those with them

Fixes #54705

When constructing synthetic auto trait impls, we may come across
multiple predicates involving the same type, trait, and substitutions.
Since we can only display one of these, we pick the one with the 'most
strict' lifetime paramters. This ensures that the impl we render the
user is actually valid (that is, a struct matching that impl will
actually implement the auto trait in question).

This commit exapnds the definition of 'more strict' to take into account
inference variables. We always choose a predicate without inference
variables over a predicate with inference variables.
2018-11-07 18:01:48 +08:00
Guillaume Gomez
c674335ba3
Rollup merge of #55568 - durka:rustdoc-big-enum, r=nikomatsakis
test that rustdoc doesn't overflow on a big enum

Adds a test to close #25295. The test case depended on `enum_primitive` so I just basically pulled its source into an auxiliary file, is that the right way to do it?
2018-11-03 13:40:37 +01:00
Guillaume Gomez
336b02347f
Rollup merge of #54162 - GuillaumeGomez:hide-default-impls-items, r=QuietMisdreavus
Hide default impls items

Follow up of #51885.
Fixes #54025.

cc @Mark-Simulacrum

r? @QuietMisdreavus

And screenshots of course:

<img width="1440" alt="screen shot 2018-09-12 at 23 30 35" src="https://user-images.githubusercontent.com/3050060/45454424-1ff8d500-b6e4-11e8-9257-030322495d58.png">

<img width="1440" alt="screen shot 2018-09-12 at 23 30 42" src="https://user-images.githubusercontent.com/3050060/45454431-2424f280-b6e4-11e8-8d65-db0d85ac18f0.png">
2018-11-03 13:40:32 +01:00
Guillaume Gomez
ca65b4304e Don't show associated const items by default 2018-11-02 23:10:27 +01:00
bors
e53a5ffd6b Auto merge of #54543 - GuillaumeGomez:top-level-index, r=QuietMisdreavus
Add index page argument

@Mark-Simulacrum: I might need some help from you: in bootstrap, I want to add an argument (a new flag added into `rustdoc`) in order to generate the current index directly when `rustdoc` is documenting the `std` lib. However, my change in `bootstrap` didn't do it and I assume it must be moved inside the `Std` struct. But there, I don't see how to pass it to `rustdoc` through `cargo`. Did I miss anything?

r? @QuietMisdreavus
2018-11-02 15:39:25 +00:00
Guillaume Gomez
7f7d8fbb2f Add test for index-page 2018-11-02 00:01:53 +01:00
Alex Burka
273930e59f test that rustdoc doesn't overflow on a big enum 2018-11-01 04:02:43 +00:00
Aaron Hill
20aa751383
Choose predicates without inference variables over those with them
Fixes #54705

When constructing synthetic auto trait impls, we may come across
multiple predicates involving the same type, trait, and substitutions.
Since we can only display one of these, we pick the one with the 'most
strict' lifetime paramters. This ensures that the impl we render the
user is actually valid (that is, a struct matching that impl will
actually implement the auto trait in question).

This commit exapnds the definition of 'more strict' to take into account
inference variables. We always choose a predicate without inference
variables over a predicate with inference variables.
2018-10-28 15:33:27 -04:00
bors
3e6f30ec3e Auto merge of #55382 - kennytm:rollup, r=kennytm
Rollup of 21 pull requests

Successful merges:

 - #54816 (Don't try to promote already promoted out temporaries)
 - #54824 (Cleanup rustdoc tests with `@!has` and `@!matches`)
 - #54921 (Add line numbers option to rustdoc)
 - #55167 (Add a "cheap" mode for `compute_missing_ctors`.)
 - #55258 (Fix Rustdoc ICE when checking blanket impls)
 - #55264 (Compile the libstd we distribute with -Ccodegen-unit=1)
 - #55271 (Unimplement ExactSizeIterator for MIR traversing iterators)
 - #55292 (Macro diagnostics tweaks)
 - #55298 (Point at macro definition when no rules expect token)
 - #55301 (List allowed tokens after macro fragments)
 - #55302 (Extend the impl_stable_hash_for! macro for miri.)
 - #55325 (Fix link to macros chapter)
 - #55343 (rustbuild: fix remap-debuginfo when building a release)
 - #55346 (Shrink `Statement`.)
 - #55358 (Remove redundant clone (2))
 - #55370 (Update mailmap for estebank)
 - #55375 (Typo fixes in configure_cmake comments)
 - #55378 (rustbuild: use configured linker to build boostrap)
 - #55379 (validity: assert that unions are non-empty)
 - #55383 (Use `SmallVec` for the queue in `coerce_unsized`.)
 - #55391 (bootstrap: clean up a few clippy findings)
2018-10-26 17:26:56 +00:00
bors
694cf75298 Auto merge of #53821 - oli-obk:sanity_query, r=RalfJung
Report const eval error inside the query

Functional changes: We no longer warn about bad constants embedded in unused types. This relied on being able to report just a warning, not a hard error on that case, which we cannot do any more now that error reporting is consistently centralized.

r? @RalfJung

fixes #53561
2018-10-26 11:05:00 +00:00
kennytm
46f504543d
Rollup merge of #55258 - Aaron1011:fix/rustdoc-blanket, r=GuillaumeGomez
Fix Rustdoc ICE when checking blanket impls

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-10-26 18:24:59 +08:00
kennytm
a57ce63a91
Rollup merge of #54824 - Munksgaard:fix-49713, r=QuietMisdreavus
Cleanup rustdoc tests with `@!has` and `@!matches`

Fixes #49713

Here's a _long_ list of all the places that include `@!has`. I have marked the ones I have looked at so far.

 - [x] search-index.rs:        fn priv_method() {} // @!has - priv_method
 - [x] search-index.rs:        fn trait_method(&self) {} // @!has - priv_method
 - [x] search-index.rs:    // @!has search-index.js Target
 - [x] short-dockblock.rs:// @!has foo/index.html '//*[@class="docblock-short"]/p/h1' 'fooo'
 - [x] short-dockblock.rs:// @!has foo/index.html '//*[@class="docblock-short"]/p/h2' 'mooood'
 - [x] keyword.rs:// @!has foo/index.html '//a/@href' 'foo/index.html'
 - [x] keyword.rs:// @!has foo/foo/index.html
 - [x] keyword.rs:// @!has-dir foo/foo
 - [x] issue-46380-2.rs:// @!has - '//*[@class="impl"]' 'impl PublicTrait<PrivateStruct> for PublicStruct'
 - [x] escape-rust-expr.rs:// @!has escape_rust_expr/constant.CONST_S.html '//pre[@class="rust const"]' '"<script>"'
 - [x] issue-33069.rs:// @!has - '//code' 'impl Bar for Foo'
 - [x] playground-empty.rs:// @!has foo/index.html '//a[@class="test-arrow"]' "Run"
 - [x] issue-34473.rs:// @!has - SomeTypeWithLongName
 - [x] issue-34473.rs:// @!has - SomeTypeWithLongName
 - [x] issue-34473.rs:// @!has foo/struct.SomeTypeWithLongName.html
 - [x] issue-29584.rs:// @!has - 'impl Bar for'
 - [x] hidden-line.rs:// @!has hidden_line/fn.foo.html invisible
 - [x] manual_impl.rs:// @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
 - [x] manual_impl.rs:// @!has - '//*[@class="docblock"]' 'There is another line'
 - [x] manual_impl.rs:// @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
 - [x] manual_impl.rs:// @!has - '//*[@class="docblock"]' 'Docs associated with the trait c_method definition.'
 - [x] issue-19190-2.rs:// @!has - '//*[@id="method.new"]' 'fn new() -> String'
 - [x] unneeded-trait-implementations-title.rs:// @!has foo/struct.Bar.html '//*[@id="implementations"]'
 - [x] masked.rs:// @!has 'search-index.js' 'masked_method'
 - [x] masked.rs:// @!has 'foo/struct.String.html' 'MaskedTrait'
 - [x] masked.rs:// @!has 'foo/struct.String.html' 'masked_method'
 - [x] masked.rs:// @!has 'foo/trait.Clone.html' 'MaskedStruct'
 - [x] masked.rs:// @!has 'foo/struct.MyStruct.html' 'MaskedTrait'
 - [x] masked.rs:// @!has 'foo/struct.MyStruct.html' 'masked_method'
 - [x] masked.rs:// @!has 'foo/trait.MyTrait.html' 'MaskedStruct'
 - [x] redirect.rs:// @!has - '//code/a' 'Qux'
 - [x] issue-43701.rs:// @!has implementors/core/clone/trait.Clone.js
 - [x] union.rs:    // @!has - //pre "b: u16"
 - [x] prim-title.rs:// @!has - '//head/title' 'foo'
 - [x] empty-section.rs:// @!has - '//*[@class="synthetic-implementations"]' 'Auto Trait Implementations'
 - [x] traits-in-bodies-private.rs:// @!has - '//code' 'impl HiddenTrait for SomeStruct'
 - [x] playground-none.rs:// @!has foo/index.html '//a[@class="test-arrow"]' "Run"
 - [x] issue-34025.rs:// @!has 'foo/sys/index.html'
 - [x] issue-34025.rs:// @!has 'foo/sys/sidebar-items.js'
 - [x] issue-34025.rs:        // @!has 'foo/sys/fn.foo.html'
 - [x] issue-23812.rs:// @!has - '/// Outer comment'
 - [x] issue-23812.rs:// @!has - '//! Inner comment'
 - [x] issue-23812.rs:// @!has - '/** Outer block comment */'
 - [x] issue-23812.rs:// @!has - '/*! Inner block comment */'
 - [x] pub-use-extern-macros.rs:// @!has pub_use_extern_macros/index.html '//code' 'pub use macros::bar;'
 - [x] pub-use-extern-macros.rs:// @!has pub_use_extern_macros/index.html '//code' 'pub use macros::baz;'
 - [x] pub-use-extern-macros.rs:// @!has pub_use_extern_macros/macro.quux.html
 - [x] pub-use-extern-macros.rs:// @!has pub_use_extern_macros/index.html '//code' 'pub use macros::quux;'
 - [x] issue-26606.rs:// @!has - '//a/@href' '../src/'
 - [x] foreigntype-reexport.rs:// @!has foreigntype_reexport/foreigntype.X4.html
 - [x] foreigntype-reexport.rs:// @!has foreigntype_reexport/index.html '//a[@class="foreigntype"]' 'X4'
 - [x] issue-31899.rs:// @!has - 'rust rust-example-rendered'
 - [x] issue-31899.rs:// @!has - 'use ndarray::arr2'
 - [x] issue-31899.rs:// @!has - 'prohibited'
 - [x] hidden-trait-struct-impls.rs:// @!has foo/struct.Bar.html '//*[@id="impl-Foo"]' 'impl Foo for Bar'
 - [x] hidden-trait-struct-impls.rs:// @!has foo/struct.Bar.html '//*[@id="impl-Dark"]' 'impl Dark for Bar'
 - [x] hidden-trait-struct-impls.rs:// @!has foo/trait.Bam.html '//*[@id="implementors-list"]' 'impl Bam for Hidden'
 - [x] hidden-impls.rs:// @!has - 'Foo'
 - [x] hidden-impls.rs:// @!has - 'Foo'
 - [x] module-impls.rs:// @!has foo/index.html 'Implementations'
 - [x] issue-35169.rs:// @!has - '//*[@id="by_mut_ref.v"]' 'fn by_mut_ref(&mut self)'
 - [x] issue-35169.rs:// @!has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)'
 - [x] issue-35169.rs:// @!has - '//*[@id="by_explicit_mut_ref.v"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
 - [x] issue-35169.rs:// @!has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
 - [x] issue-35169.rs:// @!has - '//*[@id="by_explicit_box.v"]' 'fn by_explicit_box(self: Box<Foo>)'
 - [x] issue-35169.rs:// @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
 - [x] issue-35169.rs:// @!has - '//*[@id="by_explicit_self_box.v"]' 'fn by_explicit_self_box(self: Box<Self>)'
 - [x] issue-35169.rs:// @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<Self>)'
 - [x] issue-35169.rs:// @!has - '//*[@id="static_foo.v"]' 'fn static_foo()'
 - [x] issue-35169.rs:// @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'
 - [x] extern-links.rs:// @!has foo/index.html '//a' 'extern_links'
 - [x] extern-links.rs:// @!has foo/index.html '//a' 'Foo'
 - [x] extern-links.rs:    // @!has foo/hidden/extern_links/index.html
 - [x] extern-links.rs:    // @!has foo/hidden/extern_links/struct.Foo.html
 - [x] issue-33178-1.rs:// @!has - //a/@title empty
 - [x] issue-33178-1.rs:// @!has - //a/@title variant_struct
 - [x] issue-47038.rs:// @!has - '//*[@id="macros"]' 'Macros'
 - [x] issue-47038.rs:// @!has - '//a/@href' 'macro.vec.html'
 - [x] issue-47038.rs:// @!has 'foo/macro.vec.html'
 - [x] issue-46766.rs:// @!has foo/index.html '//a/@href' './Enum/index.html'
 - [x] issue-32395.rs:// @!has - 'pub qux'
 - [x] issue-32395.rs:// @!has - 'pub Bar'
 - [x] issue-32395.rs:// @!has - 'pub qux'
 - [x] issue-32395.rs:// @!has - 'pub Bar'
 - [x] hidden-methods.rs:// @!has - 'Methods'
 - [x] hidden-methods.rs:// @!has - 'impl Foo'
 - [x] hidden-methods.rs:// @!has - 'this_should_be_hidden'
 - [x] hidden-methods.rs:// @!has - 'Methods'
 - [x] hidden-methods.rs:// @!has - 'impl Bar'
 - [x] hidden-methods.rs:// @!has - 'this_should_be_hidden'
 - [x] structfields.rs:    // @!has - //pre "b: ()"
 - [x] structfields.rs:    // @!has - //pre "c: usize"
 - [x] structfields.rs:    // @!has - //pre "// some fields omitted"
 - [x] structfields.rs:        // @!has - //pre "b: ()"
 - [x] issue-46767.rs:// @!has foo/index.html '//a/@href' './private/index.html'
 - [x] assoc-consts.rs:    // @!has - FOO_HIDDEN
 - [x] assoc-consts.rs:    // @!has - FOO_HIDDEN
 - [x] assoc-consts.rs:    // @!has assoc_consts/struct.Bar.html 'BAR_PRIVATE'
 - [x] assoc-consts.rs:    // @!has assoc_consts/struct.Bar.html 'BAR_HIDDEN'
 - [x] issue-53689.rs:// @!has - 'MyStruct'
 - [x] search-index-summaries.rs:// @!has - 'www.example.com'
 - [x] search-index-summaries.rs:// @!has - 'More Foo.'
 - [x] impl-everywhere.rs:// @!has foo/fn.foo.html '//section[@id="main"]//pre' "x: &\'x impl Foo"
 - [x] impl-everywhere.rs:// @!has foo/fn.foo.html '//section[@id="main"]//pre' "-> &\'x impl Foo {"
 - [x] impl-everywhere.rs:// @!has foo/fn.foo2.html '//section[@id="main"]//pre' "x: &\'x impl Foo"
 - [x] impl-everywhere.rs:// @!has foo/fn.foo2.html '//section[@id="main"]//pre' '-> impl Foo2 {'
 - [x] impl-everywhere.rs:// @!has foo/fn.foo_foo.html '//section[@id="main"]//pre' '-> impl Foo + Foo2 {'
 - [x] impl-everywhere.rs:// @!has foo/fn.foo2.html '//section[@id="main"]//pre' "x: &'x (impl Foo + Foo2)"
 - [x] issue-19190.rs:// @!has - '//*[@id="static_foo.v"]' 'fn static_foo()'
 - [x] issue-19190.rs:// @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'
 - [x] deprecated-impls.rs:    // @!has - 'fn_def_def_with_doc full'
 - [x] deprecated-impls.rs:    // @!has - 'fn_empty_with_doc full'
 - [x] deprecated-impls.rs:    // @!has - 'fn_def_with full'
 - [x] deprecated-impls.rs:    // @!has - 'fn_def_def_with_doc full'
 - [x] issue-19190-3.rs:// @!has - '//*[@id="method.new"]' 'fn new() -> String'
 - [x] issue-19190-3.rs:// @!has - '//*[@id="method.static_baz"]' 'fn static_baz()'
 - [x] issue-19190-3.rs:// @!has - '//*[@id="method.static_baz"]' 'fn static_baz()'
 - [x] sidebar-items.rs:// @!has - '//*[@class="sidebar-links"]/a' 'waza'
 - [x] sidebar-items.rs:// @!has - '//*[@class="sidebar-links"]/a' 'waza'
 - [x] issue-27104.rs:// @!has - 'extern crate std'
 - [x] issue-27104.rs:// @!has - 'use std::prelude::'
 - [x] issue-13698.rs:// @!has issue_13698/struct.Foo.html '//*[@id="method.foo"]' 'fn foo'
 - [x] issue-13698.rs:// @!has issue_13698/struct.Foo.html '//*[@id="method.foo"]' 'fn bar'
 - [x] issue-41783.rs:// @!has - 'space'
 - [x] issue-41783.rs:// @!has - 'comment'
 - [x] trait-self-link.rs:// @!has trait_self_link/trait.Foo.html //a/@href ../trait_self_link/trait.Foo.html
 - [x] generic-impl.rs:// @!has foo/struct.Bar.html '//h3[@id="impl-ToString"]//code' 'impl<T> ToString for T'
 - [x] all.rs:// @!has foo/all.html 'private_module'
 - [x] issue-35169-2.rs:// @!has - '//*[@id="by_explicit_box.v"]' 'fn by_explicit_box(self: Box<Foo>)'
 - [x] issue-35169-2.rs:// @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
 - [x] issue-35169-2.rs:// @!has - '//*[@id="by_explicit_self_box.v"]' 'fn by_explicit_self_box(self: Box<Self>)'
 - [x] issue-35169-2.rs:// @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<Self>)'
 - [x] issue-35169-2.rs:// @!has - '//*[@id="static_foo.v"]' 'fn static_foo()'
 - [x] issue-35169-2.rs:// @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'
 - [x] doc-cfg.rs:// @!has - '//*[@id="main"]/*[@class="stability"]/*[@class="stab portability"]' ''
 - [x] inline_local/glob-private.rs:// @!has - "mod1"
 - [x] inline_local/glob-private.rs:// @!has - "Mod1Private"
 - [x] inline_local/glob-private.rs:// @!has - "mod2"
 - [x] inline_local/glob-private.rs:// @!has - "Mod2Private"
 - [x] inline_local/glob-private.rs:// @!has foo/struct.Mod1Private.html
 - [x] inline_local/glob-private.rs:// @!has foo/struct.Mod2Private.html
 - [x] inline_local/glob-private.rs:// @!has foo/mod1/index.html
 - [x] inline_local/glob-private.rs:// @!has foo/mod1/struct.Mod1Private.html
 - [x] inline_local/glob-private.rs:// @!has foo/mod1/struct.Mod2Public.html
 - [x] inline_local/glob-private.rs:// @!has foo/mod1/struct.Mod2Private.html
 - [x] inline_local/glob-private.rs:// @!has foo/mod1/mod2/index.html
 - [x] inline_local/glob-private.rs:// @!has foo/mod1/mod2/struct.Mod2Private.html
 - [x] inline_local/glob-private.rs:// @!has-dir foo/mod2
 - [x] inline_local/glob-private.rs:// @!has foo/mod2/index.html
 - [x] inline_local/glob-private.rs:// @!has foo/mod2/struct.Mod2Public.html
 - [x] inline_local/glob-private.rs:// @!has foo/mod2/struct.Mod2Private.html
 - [x] inline_local/hidden-use.rs:// @!has - 'private'
 - [x] inline_local/hidden-use.rs:// @!has - 'Foo'
 - [x] inline_local/hidden-use.rs:// @!has hidden_use/struct.Foo.html
 - [x] inline_local/glob-extern-no-defaults.rs:// @!has - "private_fn"
 - [x] inline_local/glob-extern-no-defaults.rs:// @!has foo/fn.private_fn.html
 - [x] inline_local/issue-32343.rs:// @!has issue_32343/struct.Foo.html
 - [x] inline_local/issue-32343.rs:// @!has - '//code/a' 'Foo'
 - [x] inline_local/issue-32343.rs:// @!has issue_32343/struct.Bar.html
 - [x] inline_local/glob-private-no-defaults.rs:// @!has - "Mod1Private"
 - [x] inline_local/glob-private-no-defaults.rs:// @!has - "mod2"
 - [x] inline_local/glob-private-no-defaults.rs:// @!has - "Mod2Private"
 - [x] inline_local/glob-private-no-defaults.rs:// @!has foo/struct.Mod1Private.html
 - [x] inline_local/glob-private-no-defaults.rs:// @!has foo/struct.Mod2Private.html
 - [x] inline_local/glob-private-no-defaults.rs:// @!has - "Mod2Public"
 - [x] inline_local/glob-private-no-defaults.rs:// @!has - "Mod2Private"
 - [x] inline_local/glob-private-no-defaults.rs:// @!has foo/mod1/struct.Mod2Public.html
 - [x] inline_local/glob-private-no-defaults.rs:// @!has foo/mod1/struct.Mod2Private.html
 - [x] inline_local/glob-private-no-defaults.rs:// @!has foo/mod2/index.html
 - [x] inline_local/glob-private-no-defaults.rs:// @!has foo/mod2/struct.Mod2Public.html
 - [x] inline_local/glob-private-no-defaults.rs:// @!has foo/mod2/struct.Mod2Private.html
 - [x] inline_local/glob-extern.rs:// @!has - "mod1"
 - [x] inline_local/glob-extern.rs:// @!has - "private_fn"
 - [x] inline_local/glob-extern.rs:// @!has foo/fn.private_fn.html
 - [x] inline_local/glob-extern.rs:// @!has foo/mod1/index.html
 - [x] inline_local/glob-extern.rs:// @!has foo/mod1/fn.private_fn.html
 - [x] inline_local/please_inline.rs:    // @!has - 'pub use foo::'
 - [x] inline_local/please_inline.rs:    // @!has please_inline/b/struct.Foo.html
 - [x] inline_cross/hidden-use.rs:// @!has - 'rustdoc_hidden'
 - [x] inline_cross/hidden-use.rs:// @!has - 'Bar'
 - [x] inline_cross/hidden-use.rs:// @!has hidden_use/struct.Bar.html
 - [x] inline_cross/inline_hidden.rs:// @!has - '//a/@title' 'Foo'
 - [x] inline_cross/assoc-items.rs:// @!has - 'PrivateConst'
 - [x] inline_cross/assoc-items.rs:// @!has - 'private_method'
 - [x] inline_cross/cross-glob.rs:// @!has cross_glob/index.html '//code' 'pub use inner::*;'
 - [x] inline_cross/macro-vis.rs:// @!has - '//pre' 'some_macro'
 - [x] inline_cross/macro-vis.rs:// @!has macro_vis/macro.other_macro.html
 - [x] inline_cross/macro-vis.rs:// @!has macro_vis/index.html '//a/@href' 'macro.other_macro.html'
 - [x] inline_cross/macro-vis.rs:// @!has - '//code' 'pub use qwop::other_macro;'
 - [x] inline_cross/macro-vis.rs:// @!has macro_vis/macro.super_macro.html
 - [x] inline_cross/issue-31948.rs:// @!has - '//*[@class="impl"]//code' 'Bar for'
 - [x] inline_cross/issue-31948.rs:// @!has - '//*[@class="impl"]//code' 'Qux for'
 - [x] inline_cross/issue-31948.rs:// @!has - '//code' 'for Wibble'
 - [x] inline_cross/issue-31948.rs:// @!has - '//code' 'for Wobble'
 - [x] inline_cross/issue-31948.rs:// @!has - '//code' 'for Wibble'
 - [x] inline_cross/issue-31948.rs:// @!has - '//code' 'for Wobble'
 - [x] inline_cross/issue-31948.rs:// @!has issue_31948/trait.Bar.html
 - [x] inline_cross/issue-31948.rs:// @!has issue_31948/trait.Qux.html
 - [x] inline_cross/issue-31948.rs:// @!has issue_31948/struct.Wibble.html
 - [x] inline_cross/issue-31948.rs:// @!has issue_31948/struct.Wobble.html
 - [x] inline_cross/issue-31948-1.rs:// @!has - '//*[@class="impl"]//code' 'Bar for'
 - [x] inline_cross/issue-31948-1.rs:// @!has - '//*[@class="impl"]//code' 'Qux for'
 - [x] inline_cross/issue-31948-1.rs:// @!has - '//code' 'for Wibble'
 - [x] inline_cross/issue-31948-1.rs:// @!has - '//code' 'for Wibble'
 - [x] inline_cross/issue-31948-1.rs:// @!has issue_31948_1/trait.Bar.html
 - [x] inline_cross/issue-31948-1.rs:// @!has issue_31948_1/trait.Qux.html
 - [x] inline_cross/issue-28480.rs:// @!has -  '//a/@title' 'Hidden'
 - [x] inline_cross/issue-28480.rs:// @!has -  '//a/@title' 'Hidden'
 - [x] inline_cross/issue-31948-2.rs:// @!has - '//*[@class="impl"]//code' 'Bar for'
 - [x] inline_cross/issue-31948-2.rs:// @!has issue_31948_2/trait.Bar.html
 - [x] inline_cross/issue-31948-2.rs:// @!has issue_31948_2/trait.Woof.html
 - [x] inline_cross/issue-31948-2.rs:// @!has issue_31948_2/trait.Bark.html

It doesn't look like `@!matches` is used anywhere.
2018-10-26 18:24:55 +08:00
Aaron Hill
098c659276
Check for negative impls when finding auto traits
Fixes #55321

When AutoTraitFinder begins examining a type, it checks for an explicit
negative impl. However, it wasn't checking for negative impls found when
calling 'select' on predicates found from nested obligations.

This commit makes AutoTraitFinder check for negative impls whenever it
makes a call to 'select'. If a negative impl is found, it immediately
bails out.

Normal users of SelectioContext don't need to worry about this, since
they stop as soon as an Unimplemented error is encountered. However, we
add predicates to our ParamEnv when we encounter this error, so we need
to handle negative impls specially (so that we don't try adding them to
our ParamEnv).
2018-10-25 15:14:32 -04:00
Ralf Jung
7717a63182 fix a test comment 2018-10-25 16:47:35 +02:00
Alexander Regueiro
7c34f2da57 Addressed minor issues brought up in review. 2018-10-25 16:47:35 +02:00
Oliver Schneider
f4a3e50d78 Update rustdoc test 2018-10-25 16:47:35 +02:00
Felix S. Klock II
be2075c661 This is a regression test for #54478.
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-24 12:19:47 +02:00
Aaron Hill
4f2624cac9
Fix Rustdoc ICE when checking blanket impls
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-10-22 19:40:43 -04:00
Guillaume Gomez
b2f80ddf34 Fix multiple errors 2018-10-22 00:43:23 +02:00
Guillaume Gomez
f729f4a75e Update failing test 2018-10-21 19:22:37 +02:00
Oliver Middleton
86d5a33c89 rustdoc: Use dyn keyword when rendering dynamic traits
The dyn keyword has been stable for a while now so rustdoc should start using it.
2018-10-15 00:48:57 +01:00
kennytm
d64c77a671
Rollup merge of #54989 - Munksgaard:fix-htmldocck-typos, r=tmandry
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-12 22:04:19 +08:00
Philip Munksgaard
1de8f51849 Include rustdoc tests that have been fixed by #33133
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-11 18:25:55 +02:00
Philip Munksgaard
a9217e316c Fix typo in issue-13698.rs 2018-10-10 22:30:15 +02:00
Philip Munksgaard
df79da9661 Fix typo in deprecated_impls
The function is called `fn_def_with_doc`, not `fn_def_with`.
2018-10-10 22:01:05 +02:00
Philip Munksgaard
9dbe902800 Fix issue-46767 test
The link that is matched against is not the same as would be generated by
rustdoc. We should also check that the `foo/private` directory is not generated
at all.
2018-10-10 21:20:00 +02:00
Philip Munksgaard
e8bc04e1c8 Use XPATH notation to match against flattened nodes
The generated code would look like `<code>impl <a href="...">Foo</a></code>`
which the plain text matcher doesn't match. But by using the XPATH notation, the
nodes are flattened and we can correctly assert that `impl Foo` does not occur
in the generated docs.
2018-10-10 21:04:52 +02:00
Philip Munksgaard
28596ade71 Fix empty-section.rs test
The Auto Trait Implementation section is not wrapped in a
`synthetic-implementations` class. In fact, it is wrapped in a
`synthetic-implementations` id. However, we can generalize and completely remove
the `synthetic-implementations` requirement. We just have to verify that there's
no mention of "Auto Trait Implementations" anywhere.
2018-10-05 23:28:08 +02:00
Philip Munksgaard
a9a26de8b3 Fix redirect.rs test
Struct names are no longer encapsulated in `<code>` tags, which meant that the
test was not correctly verifying that it wasn't being show. I've also added a
check to make sure the documentation page for the redirect::Qux struct is not
generated at all.
2018-10-05 22:55:13 +02:00
Philip Munksgaard
5f8dc0ddf4 Fix unneeded-trait-implementations-title test
The `@!has` command does not support specifying just a PATH and an XPATH. That
means that the previous test searched for the literal string
`//h2[@id="implementations"]` within the generated output, which obviously
didn't exist. Even after adding a trait implementation, the test still passed.
The correct way to check for the existence of a DOM element with the id
`implementations` is to use the `@count` keyword.
2018-10-05 19:13:37 +02:00
Philip Munksgaard
46ccce0803 Remove duplicate test line 2018-10-05 18:24:25 +02:00
Oliver Schneider
ec74d3533a Stabilize min_const_fn 2018-10-05 10:36:14 +02:00
Philip Munksgaard
f97e094b19 Add compile flags to playground-empty test
"Run" links to the playground are not added to the generated documentation if
the unstable `--playground-url` argument is not passed to rustdoc. Therefore,
without specifying `--playground-url` as a compile-flag, the test doesn't
correctly assert that `#![doc(html_playground_url = "")]` removes playground
links.
2018-10-04 22:23:19 +02:00
Philip Munksgaard
7d3d835c58 replace escape-rust-expr test with dont-show-const-contents
The old test was supposed to check for proper html escaping when showing the
contents of constants. This was changed as part of #53409. The revised test
asserts that the contents of the constant is not shown as part of the generated
documentation.
2018-10-04 22:22:19 +02:00
kennytm
def5f84fa6
Rollup merge of #54577 - QuietMisdreavus:docs-for-procs, r=GuillaumeGomez
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-29 16:46:30 +08:00
QuietMisdreavus
d37f3696b1 check for proc-macros in "all items" 2018-09-27 10:22:29 -05:00
bors
e783d2be40 Auto merge of #54199 - nikomatsakis:predicate_may_hold-failure, r=eddyb
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-26 12:39:20 +00:00
QuietMisdreavus
8f69a82513 add test for proc-macro re-export 2018-09-25 16:30:19 -05:00
QuietMisdreavus
aea1bd0a59 handle proc-macros as macros instead of functions 2018-09-25 14:56:43 -05:00
Niko Matsakis
a3997f7255 add regression test 2018-09-25 13:54:51 -04:00
Pietro Albini
23636e3f99
Rollup merge of #54350 - Munksgaard:support-edition-in-doc-test, r=steveklabnik
Support specifying edition in doc test

Fixes #52623

r? @QuietMisdreavus
2018-09-22 09:56:30 +02:00
QuietMisdreavus
1106577116 fix intra-links for trait impls 2018-09-20 05:54:31 -05:00
QuietMisdreavus
e854d39929 don't index trait impls if the trait isn't also documented 2018-09-20 05:42:36 -05:00
QuietMisdreavus
7e70fee0c7 add more tests for traits-in-non-module-scope 2018-09-20 05:42:35 -05:00
QuietMisdreavus
e79780f18f don't check visibility when inlining local impls
those get handled properly in strip-hidden anyway
2018-09-20 05:42:33 -05:00
QuietMisdreavus
457efc111a ignore rustdoc/doc-proc-macro on stage1 2018-09-20 05:42:22 -05:00
QuietMisdreavus
02bea3c581 rustdoc: collect trait impls as an early pass 2018-09-20 05:42:20 -05:00
Philip Munksgaard
ac8d8d71fa Add test for doctest edition support 2018-09-20 08:36:07 +02:00
Guillaume Gomez
6aed133ebd
Rollup merge of #54097 - GuillaumeGomez:remove-keyword-namespace, r=QuietMisdreavus
rustdoc: Remove namespace for keywords

Fixes #54084.

r? @QuietMisdreavus
2018-09-18 10:21:35 +02:00
Kazuyoshi Kato
2fe4503703 Check the remaining nodes 2018-09-16 00:39:12 -07:00
Kazuyoshi Kato
bbcb6339aa Add a test to prevent regression
The way it defines implementations is unrealistic though.
2018-09-14 22:42:44 -07:00
bors
f2302daef3 Auto merge of #53409 - GuillaumeGomez:associated-const-value, r=QuietMisdreavus
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-12 21:20:05 +00:00
Guillaume Gomez
1a0e8f95f5 Remove namespace for keywords 2018-09-10 11:27:21 +02:00
Oliver Middleton
d3e56854e1 rustdoc: Remove generated blanket impls from trait pages 2018-09-09 18:27:05 +01:00
Guillaume Gomez
d65c8636d9 Fix hover on impls 2018-09-06 23:32:30 +02:00
bors
fea32f1b77 Auto merge of #53604 - oli-obk:min_const_fn, r=Centril,varkor
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-09-01 11:26:24 +00:00
bors
aaa170bebe Auto merge of #51384 - QuietMisdreavus:extern-version, r=GuillaumeGomez
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-31 17:39:28 +00:00
Oliver Schneider
d125e904b5 Restrict most uses of const_fn to min_const_fn 2018-08-31 08:40:00 +02:00
Corey Farwell
e477a13d63 Replace usages of 'bad_style' with 'nonstandard_style'.
`bad_style` is being deprecated in favor of `nonstandard_style`:

- https://github.com/rust-lang/rust/issues/41646
2018-08-29 09:01:35 -05:00
Guillaume Gomez
86141797db Remove static and const initialization from documentation 2018-08-26 12:08:30 +02:00
Guillaume Gomez
b0ee5ded7a Update tests 2018-08-25 15:30:47 +02:00
Guillaume Gomez
3d8e760bf8
Rollup merge of #53541 - GuillaumeGomez:fix-impl-trait-ret-type, r=oli-obk
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-22 17:45:36 +02:00