Commit Graph

451 Commits

Author SHA1 Message Date
bors
b239743753 Auto merge of #52644 - varkor:lib-feature-gate-2, r=withoutboats
Add errors for unknown, stable and duplicate feature attributes

- Adds an error for unknown (lang and lib) features.
- Extends the lint for unnecessary feature attributes for stable features to libs features (this already exists for lang features).
- Adds an error for duplicate (lang and lib) features.

```rust
#![feature(fake_feature)] //~ ERROR unknown feature `fake_feature`

#![feature(i128_type)] //~ WARNING the feature `i128_type` has been stable since 1.26.0

#![feature(non_exhaustive)]
#![feature(non_exhaustive)] //~ ERROR duplicate `non_exhaustive` feature attribute
```

Fixes #52053, fixes #53032 and address some of the problems noted in #44232 (though not unused features).

There are a few outstanding problems, that I haven't narrowed down yet:
- [x] Stability attributes on macros do not seem to be taken into account.
- [x] Stability attributes behind `cfg` attributes are not taken into account.
- [x] There are failing incremental tests.
2018-08-06 16:58:27 +00:00
bors
4b8089daf8 Auto merge of #52990 - Aaron1011:fix/rustdoc-auto-trait-static, r=eddyb
Fix ICE when rustdoc encounters certain usages of HRTBs

Fixes #51236

Under certain circumstances, `AutoTraitFinder` could end up computing a `ParamEnv` involving two trait predicates that differed only in the region parameters involved. One of these parameters would be a HRTB, while the other would be a normal region parameter.

When this `ParamEnv` was later passed to `SelectionContext`, an `Ambiguity` error would occur, since the erased versions of these predicates would be identical. To solve the issue, we de-duplicate our list of predicates as we build it up. Whenever we encounter two predicates that differ only in their assignment of region parameters (a HRTB vs a normal lifetime parameter), we pick the HRTB. This corresponds to selecting a 'stricter' bound to display in the generated documentation: we're requiring that a particular type works for all possible lifetime parameters if it's going to implement a particular auto trait.
2018-08-06 14:07:22 +00:00
bors
aa1e6db709 Auto merge of #53002 - QuietMisdreavus:brother-may-i-have-some-loops, r=pnkfelix
make `everybody_loops` preserve item declarations

First half of https://github.com/rust-lang/rust/issues/52545.

`everybody_loops` is used by rustdoc to ensure we don't contain erroneous references to platform APIs if one of its uses is pulled in by `#[doc(cfg)]`. However, you can also implement traits for public types inside of functions. This is used by Diesel (probably others, but they were the example that was reported) to get around a recent macro hygiene fix, which has caused their crate to fail to document. While this won't make the traits show up in documentation (that step comes later), it will at least allow files to be generated.
2018-08-06 01:53:58 +00:00
varkor
8cee487eb3 Fix rustdoc test 2018-08-05 15:54:49 +01:00
varkor
f22ccbe315 Fix run-pass-fulldeps tests 2018-08-05 15:54:49 +01:00
QuietMisdreavus
001445b235 add tests for new intra-doc-link behavior 2018-08-04 22:20:45 -05:00
Guillaume Gomez
e0f8f871f6 Strengthen tests 2018-08-04 11:02:00 +02:00
Guillaume Gomez
8301081c90 Fix primitive blanket impls not showing up 2018-08-04 11:02:00 +02:00
QuietMisdreavus
d6a7a3cab0 add rustdoc test for everybody_loops fix 2018-08-02 15:42:02 -05:00
Aaron Hill
a0943b6bba
Filter out duplicated trait predicates when generating auto traits
Fixes #51236
2018-08-02 13:59:16 -04:00
Aaron Hill
bff08f2731
Fix rustdoc crash when 'static bound appears in struct declaration 2018-08-02 09:58:44 -04:00
Guillaume Gomez
7a3c7b2097 Don't display full blanket implementation and put it into its own section 2018-07-28 15:18:38 +02:00
Guillaume Gomez
d64c2ac01a Improve code 2018-07-22 21:03:21 +02:00
Guillaume Gomez
6b830ec23e Add new tests and fix old ones 2018-07-22 21:02:44 +02:00
bors
d3b3bc5767 Auto merge of #52368 - GuillaumeGomez:intra_doc_link_resolution_failure-documented, r=QuietMisdreavus
Add "self" intra-link support

Fixes #49583.

r? @QuietMisdreavus
2018-07-22 10:48:15 +00:00
Guillaume Gomez
88f2643679 Add "self" intra-link support 2018-07-22 00:22:30 +02:00
kennytm
c0db1aafea
Rollup merge of #52385 - GuillaumeGomez:pass-edition-to-parser, r=QuietMisdreavus
Pass edition flags to compiler from rustdoc as expected

Fixes #52357.
2018-07-17 19:24:57 +08:00
Guillaume Gomez
65e6b2b4a8 Pass edition flags to compiler from rustdoc as expected 2018-07-14 20:45:44 +02:00
QuietMisdreavus
e78fb9bad0 add test for issue 52129 2018-07-13 21:46:47 -05:00
Oliver Middleton
6b1d584ed8 rustdoc: Hide struct and enum variant constructor imports 2018-07-10 00:16:18 +01:00
bors
a8403e1cda Auto merge of #51861 - GuillaumeGomez:prevent-some-markdown-short-doc, r=QuietMisdreavus
Prevent some markdown transformation on short docblocks

Before:

<img width="1440" alt="screen shot 2018-06-28 at 01 46 01" src="https://user-images.githubusercontent.com/3050060/42005762-7d533bbe-7a76-11e8-8361-027886803399.png">

After:

<img width="1440" alt="screen shot 2018-06-28 at 01 46 02" src="https://user-images.githubusercontent.com/3050060/42005768-81bd59a0-7a76-11e8-819b-9b4be72579d6.png">

This is only performed on short doc blocks, not on plain ones. Not all transformations are prevented (you still have a few like urls, code blocks, etc...).

cc @nical

r? @QuietMisdreavus
2018-07-06 00:36:34 +00:00
QuietMisdreavus
61dc03cd63 test for renaming re-exported macros 2018-07-03 10:40:11 -05:00
Guillaume Gomez
6a86ee7328 Prevent some markdown transformation on short docblocks 2018-06-28 01:55:43 +02:00
QuietMisdreavus
5e509502b4 fix test pub-use-extern-macros 2018-06-17 20:14:24 -05:00
QuietMisdreavus
54997972a7 fix cross-crate-links test
hey look, macros properly link to the right place now
2018-06-17 16:27:46 -05:00
QuietMisdreavus
d4387b3e4f rustdoc: import cross-crate macros alongside everything else 2018-06-17 14:59:49 -05:00
bors
594b05dd97 Auto merge of #51425 - QuietMisdreavus:thats-def-a-namespace-there, r=petrochenkov
refactor: create multiple HIR items for imports

When lowering `use` statements into HIR, they get a `Def` of the thing they're pointing at. This is great for things that need to know what was just pulled into scope. However, this is a bit misleading, because a `use` statement can pull things from multiple namespaces if their names collide. This is a problem for rustdoc, because if there are a module and a function with the same name (for example) then it will only document the module import, because that's that the lowered `use` statement points to.

The current version of this PR does the following:

* Whenever the resolver comes across a `use` statement, it loads the definitions into a new `import_map` instead of the existing `def_map`. This keeps the resolutions per-namespace so that all the target definitions are available.
* When lowering `use` statements, it looks up the resolutions in the `import_map` and creates multiple `Item`s if there is more than one resolution.
* To ensure the `NodeId`s are properly tracked in the lowered module, they need to be created in the AST, and pulled out as needed if multiple resolutions are available.

Fixes https://github.com/rust-lang/rust/issues/34843
2018-06-17 09:48:10 +00:00
bors
0f8f4903f7 Auto merge of #51382 - GuillaumeGomez:intra-link-lint, r=QuietMisdreavus
Add lint for intra link resolution failure

This PR is almost done, just remains this note:

```
note: requested on the command line with `-W intra-link-resolution-failure`
```

I have no idea why my lint is considered as being passed through command line and wasn't able to find where it was set. If anyone has an idea, it'd be very helpful!

cc @QuietMisdreavus
2018-06-17 02:57:40 +00:00
QuietMisdreavus
042f1df198 process cross-crate glob re-exports 2018-06-15 18:18:14 -05:00
QuietMisdreavus
02121f36e8 add test for issue 34843 2018-06-14 17:47:35 -05:00
Guillaume Gomez
6d5e6b4928 Fix rustdoc test failure 2018-06-13 21:18:56 +02:00
Oliver Middleton
e73941a06b rustdoc: Fix missing stability and src links for inlined external macros 2018-06-06 04:13:55 +01:00
Mark Simulacrum
ac32f8151b
Rollup merge of #51256 - GuillaumeGomez:fix-rustdoc-crate-name, r=QuietMisdreavus
Fix crate-name option in rustdoc

Fixes #51229.

r? @QuietMisdreavus
2018-06-05 08:33:47 -06:00
Guillaume Gomez
3cbcc5a22d Fix crate-name option in rustdoc 2018-06-04 23:05:14 +02:00
Guillaume Gomez
402aa0ff15 Add even more tests 2018-06-04 09:52:31 +02:00
Guillaume Gomez
ded5c5a9ee Put doc keyword behind feature flag 2018-06-04 09:52:31 +02:00
Guillaume Gomez
ebee483e24 Add doc keyword support 2018-06-04 09:51:41 +02:00
bors
251ec62a13 Auto merge of #50953 - GuillaumeGomez:attributes-in-other-places, r=QuietMisdreavus
Add attributes for trait and methods as well

Fixes #48485.

r? @QuietMisdreavus
2018-06-03 00:31:13 +00:00
Guillaume Gomez
26ad95c9d4 Add attributes for trait and methods as well 2018-06-02 23:26:46 +02:00
Mark Simulacrum
cf24a1df33 Rustdoc itself no longer requires proc macros to build
This avoids a full compiler build in order to build and/or run tests for
rustdoc.
2018-06-02 09:32:22 -06:00
kennytm
98606cfe12
Rollup merge of #51011 - QuietMisdreavus:duplicitous-macros, r=ollie27
rustdoc: hide macro export statements from docs

As mentioned in https://github.com/rust-lang/rust/issues/50647, rustdoc now prints both the import statement and the macro itself when re-exporting macros. This is a stopgap solution to clean up the std docs and get something small backported into beta.

What this does: When rustdoc finds an export statement for a macro, instead of printing the export and bailing, now it will instead hide the export and bail. Until we can solve https://github.com/rust-lang/rust/issues/34843 or have a better way to find the attributes on an export statement when inlining macros, this will at least match the current behavior and clean up the re-export statements from the docs.
2018-05-24 17:34:55 +08:00
QuietMisdreavus
4cf0c5fa32 fix @!has conditions in pub-use-extern-macros test 2018-05-23 20:53:45 -05:00
QuietMisdreavus
d19b5edfb0 update "pub-use-extern-macros" test to hide the regular import statement 2018-05-23 16:39:47 -05:00
bors
ba64edb3ed Auto merge of #50533 - GuillaumeGomez:rustdoc-prim-auto, r=QuietMisdreavus
add auto-impl for primitive type

Part of #50431.

I have no clue how to test this though with the rustdoc test suite...

r? @QuietMisdreavus
2018-05-18 14:52:12 +00:00
Shotaro Yamada
7eefe2b473 Fix rustdoc panic with impl Trait in type parameters 2018-05-16 11:03:02 +09:00
Guillaume Gomez
564511e58b add auto-impl for primitive type 2018-05-15 21:37:12 +02:00
Oliver Middleton
3daded02fa rustdoc: Add support for pub(restricted) 2018-05-12 18:25:09 +01:00
bors
715d6a98aa Auto merge of #50305 - GuillaumeGomez:fix-mod-stackoverflow, r=QuietMisdreavus
Prevent infinite recursion of modules

Fixes #50196.

r? @QuietMisdreavus
2018-05-07 23:18:12 +00:00
Guillaume Gomez
3ba7c00f94 Prevent infinite recursion of modules 2018-05-07 12:44:03 +02:00
Shotaro Yamada
14f32f64c8 rustdoc: Resolve nested impl Traits 2018-05-03 22:34:10 +09:00