Add strong_count mutation methods to Rc
The corresponding methods were stabilized on `Arc` in #79285 (tracking: #71983). This patch implements and stabilizes identical methods on the `Rc` types as well.
rustdoc: Store intra-doc links in Cache instead of on items directly
Items are first built after rustdoc creates the TyCtxt. To allow
resolving the links before the TyCtxt is built, the links can't be
stored on `clean::Item` directly.
Helps with https://github.com/rust-lang/rust/issues/83761. Opening this early because I think it might decrease memory usage.
rustdoc: Use `ThinVec` in a few places
Almost every crate has no primitives and no keywords defined in it, so
using `ThinVec` should make some types smaller.
- Don't treat it as deprecated on stable and beta channels. Before, it
would give confusing and incorrect output:
```
warning: the 'output-format' flag is considered deprecated
|
= warning: see issue #44136 <https://github.com/rust-lang/rust/issues/44136> for more information
error: json output format isn't supported for doc generation
```
Both of those are wrong: output-format isn't deprecated, and json
output is supported.
- Require -Z unstable-options for `--output-format json`
Previously, it was allowed by default on nightly, which made it hard
to realize the flag wouldn't be accepted on beta or stable.
Note that this still allows `--output-format html`, which has been
stable since 1.0.
- Remove unnecessary double-checking of the feature gate when parsing
the output format
- Add custom run-make test since compiletest passes -Zunstable-options
by default
Items are first built after rustdoc creates the TyCtxt. To allow
resolving the links before the TyCtxt is built, the links can't be
stored on `clean::Item` directly.
Fix HashMap/HashSet LLDB pretty-printer after hashbrown 0.11.0
The pretty-printer was broken in https://github.com/rust-lang/rust/pull/77566 after updating hashbrown to 0.11.0.
Note that the corresponding GDB pretty-printer was updated properly.
Fixes#83891
Move `SharedContext` to `context.rs`
It is tightly connected to `Context` and is primarily used as a field in
`Context`. Thus, it should be next to `Context`.
rustdoc: Use DiagnosticInfo in more parts of intra-doc links
This makes the code a lot less verbose.
This is separated into lots of tiny commits because it was easier for me that way, but the overall diff isn't that big if you want to read it at once.
r? `@bugadani`
Fix all occurences `needless_borrow` internally
The bug that got 'needless_borrow' moved into the nursery was fixed two years ago in d4370f8b.
This did trigger over a thousand times internally, so that's all the other changes. I vetted most of them, but there's a lot The only interesting change is to the lint list. `declare_tool_lint` already makes a reference, so there's no need to take a reference to the lints.
changelog: None
consider mutability on useless_vec suggestions
fixes#7035
changelog: Now the suggested by `useless_vec` considers mutability to suggest either `&[]`, as before, or `&mut []` if the used reference is mutable.
Add `FromIterator` and `IntoIterator` impls for `ThinVec`
These should make using `ThinVec` feel much more like using `Vec`.
They will allow users of `Vec` to switch to `ThinVec` while continuing
to use `collect()`, `for` loops, and other parts of the iterator API.
I don't know if there were use cases before for using the iterator API
with `ThinVec`, but I would like to start using `ThinVec` in rustdoc,
and having it conform to the iterator API would make the transition
*a lot* easier.
I added a `FromIterator` impl, an `IntoIterator` impl that yields owned
elements, and `IntoIterator` impls that yield immutable or mutable
references to elements. I also added some unit tests for `ThinVec`.
The pretty-printer was broken in https://github.com/rust-lang/rust/pull/77566
after updating hashbrown to 0.11.0.
Note that the corresponding GDB pretty-printer was updated properly.