| Age | Commit message (Collapse) | Author | Lines |
|
rustdoc: Cleanup various `clean` types
Cleanup various `clean` types.
|
|
rustdoc: Improve doctest pass's name and module's name
As the docs at the top of the file say, it is an overloaded pass and
actually runs two lints.
|
|
|
|
As the docs at the top of the file say, it is an overloaded pass and
actually runs two lints.
|
|
|
|
|
|
It should only ever be a `ResolvedPath`, so this (a) enforces that, and
(b) reduces the size of `Impl`.
I had to update a test because the order of the rendered auto trait impl
bounds changed. I think the order changed because rustdoc sorts auto
trait bounds using their `Debug` output.
|
|
Use the correct edition for syntax highlighting doctests
Previously it would unconditionally use edition 2015, which was incorrect.
Helps with https://github.com/rust-lang/rust/issues/89135 in that you can now override the doctest to be 2018 edition instead of being forced to fix the error. This doesn't resolve any of the deeper problems that rustdoc disagrees with most rust users on what a code block is.
cc `@Mark-Simulacrum`
|
|
Previously it would unconditionally use edition 2015, which was
incorrect.
|
|
Previously, only the raw string and the `is_ignore` field were
preserved, which made it hard to recover anything else.
|
|
rustdoc: Cleanup `clean` part 2
Split out from #88379. This contains the following commits from that PR:
- Remove `Type::ResolvedPath.is_generic`
- Rename `is_generic()` to `is_assoc_ty()`
r? `@jyn514`
|
|
The `Option<Module>` version is supported for the case where we don't know whether the `DefId` refers to a module or not.
Non-local traits and enums are also correctly found now.
|
|
It turned out to cause (minor) perf regressions.
|
|
Fixes #81775
|
|
Use smaller spans for some structured suggestions
Use more accurate suggestion spans for
* argument parse error
* fully qualified path
* missing code block type
* numeric casts
|
|
Allow missing code examples in trait impls.
Excludes Trait implementations from the items that need to have doc code examples when using the `rustdoc::missing_doc_code_examples` lint.
For details see #88741
fixes #88741
r? `@jyn514`
|
|
The new name is more accurate than the previous one.
|
|
- Fix broken handling of primitive associated items
- Remove fragment hack
Fixes 83083
- more logging
- Update CrateNum hacks
The CrateNum has no relation to where in the dependency tree the crate
is, only when it's loaded. Explicitly special-case core instead of
assuming it will be the first DefId.
- Update and add tests
- Cache calculation of primitive locations
This could possibly be avoided by passing a Cache into
collect_intra_doc_links; but that's a much larger change, and doesn't
seem valuable other than for this.
|
|
|
|
r=Manishearth
Rustdoc coverage fields count
Follow-up of #88688.
Instead of requiring enum tuple variant fields and tuple struct fields to be documented, we count them if they are documented, otherwise we don't include them in the count.
r? `@Manishearth`
|
|
struct fields.
|
|
|
|
It was accidentally changed to use `opts()` in #86451.
I also renamed `opts()` to `main_body_opts()` to make this kind of
accidental change less likely.
|
|
r=camelid,notriddle
Fix json tuple struct enum variant
Fixes #87887.
cc `@dsherret` `@camelid`
r? `@notriddle`
|
|
|
|
|
|
- All attributes for an item need to be considered at once, they can't
be considered a line at a time.
- The top-level crate was not being visited. This bug was caught by
`extern-crate-used-only-in-link`, which I'm very glad I added.
- Make the loader private to the module, so that only one function is
exposed.
|
|
This reverts commit 5f0c54db4e595a6a77048f2b0605138ffa49a326.
|
|
|
|
Use more accurate suggestion spans for
* argument parse error
* fully qualified path
* missing code block type
* numeric casts
* E0212
|
|
rustc: Replace `HirId`s with `LocalDefId`s in `AccessLevels` tables
and passes using those tables - primarily privacy checking, stability checking and dead code checking.
All these passes work with definitions rather than with arbitrary HIR nodes.
r? `@cjgillot`
cc `@lambinoo` (#87487)
|
|
(clippy::useless_conversion)
Example:
let _x: String = String::from("hello world").into();
|
|
and passes using them - primarily privacy checking, stability checking and dead code checking.
WIP
|
|
|
|
|
|
|
|
This reverts commit 41a345d4c46dad1a98c9993bc78513415994e8ba.
|
|
|
|
|
|
|
|
Revert "Don't load all extern crates unconditionally"
Fixes https://github.com/rust-lang/rust/issues/84738.
This reverts https://github.com/rust-lang/rust/pull/83738.
For the "smart" load of external crates, we need to be able to access their items in order to check their doc comments, which seems, if not impossible, quite complicated using only the AST.
For some context, I first tried to extend the `IntraLinkCrateLoader` visitor by adding `visit_foreign_item`. Unfortunately, it never enters into this call, so definitely not the right place...
I then added `visit_use_tree` to then check all the imports outside with something like this:
```rust
let mut loader = crate::passes::collect_intra_doc_links::IntraLinkCrateLoader::new(resolver);
ast::visit::walk_crate(&mut loader, krate);
let mut items = Vec::new();
for import in &loader.imports_to_check {
if let Some(item) = krate.items.iter().find(|i| i.id == *import) {
items.push(item);
}
}
for item in items {
ast::visit::walk_item(&mut item);
for attr in &item.attrs {
loader.check_attribute(attr);
}
}
```
This was, of course, a failure. We find the items without problems, but we still can't go into the external crate to check its items' attributes.
Finally, `@jyn514` suggested to look into the [`CrateLoader`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/creader/struct.CrateLoader.html), but it only seems to provide metadata (I went through [`CStore`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/creader/struct.CStore.html) and [`CrateMetadata`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/decoder/struct.CrateMetadata.html)).
I think we are too limited here (with AST only) to be able to determine the crates we actually need to import, but it's very likely that I missed something. Maybe `@petrochenkov` or `@Aaron1011` have an idea?
So until we find a way to make it work completely, we need to revert it to fix the ICE. Once merged, we'll need to re-open #68427.
r? `@jyn514`
|
|
|
|
|
|
Improvements to intra-doc link macro disambiguators
A few small improvements around macro disambiguators:
- display the link text as it was entered: previously `[macro!()]` would be displayed without the parantheses (fixes #86309)
- support `!{}` and `![]` as macro disambiguators (fixes #86310)
r? `@jyn514` cc `@Manishearth` `@camelid`
|
|
|
|
Resolve type aliases to the type they point to in intra-doc links
This feels a bit sketchy, but I think it's better than just rejecting the link.
Helps with #86120, r? ``@jyn514``
|
|
|
|
|
|
Use the now available implementation of `IntoIterator` for arrays
|
|
|