These were hidden by default, and duplicated information already on the
page anyhow.
Also remove the "Auto-hide trait implementors of a trait" setting,
which is not needed anymore.
The previous linking seemed confusing: within "the sum() method on
iterators", "sum()" was linked to `Sum::sum`, not `Iterator::sum`, even
though the sentence is talking about the latter.
I have rewritten the sentence to be, I believe, clearer, as well as
changing the link destinations; applying the same change to the
`Product` documentation as well as `Sum`.
The `RustdocGUI::should_run` condition spawns `npm list` several times
which adds up to seconds of wall-time.
Evaluate the condition lazily to to keep `./x.py test tidy` and similar
short-running tasks fast.
Stop returning a value from `report_assert_as_lint`
This function only ever returns `None`. Make that explicity by not returning a value at all.
`@rustbot` modify labels +C-cleanup +T-compiler
Open trait implementations' toggles by default.
This makes it possible to use Ctrl-F to find methods defined in traits.
As discussed in #85923. This modifies the approach suggested in #40363, but still achieves the goal of skimmability. For new users who aren't familiar with all the traits, their methods are readily visible and searchable. For experienced users who prefer to skim the list of all traits, there are two options: the "collapse all" shortcut, and the "auto hide trait implementations" setting.
Demo https://hoffman-andrews.com/rust/expand-methods/std/string/struct.String.html#trait-implementations
r? `@GuillaumeGomez`
Link reference in `dyn` keyword documentation
The "read more" sentence formatted "object safety" as inline code
instead of providing a link to more information. This PR adds a link
to the Reference about this matter, as well as the page regarding trait
objects.
---
We could also put these links in the very first line (instead of the link to the
Book) and in the first paragraph which mentions the "object safe" requirement.
Personally, I think it's good to keep the link to the Book up-front as it's more
accessible than the Reference.
Mention the `Borrow` guarantee on the `Hash` implementations for Arrays and `Vec`
To remind people like me who forget about it and send PRs to make them different, and to (probably) get a test failure if the code is changed to no longer uphold it.
Fix span calculation in format strings
This pull request fixes#86085. The ICE described there is due to an error in the span calculation inside format strings, if the format string is the result of a macro invocation:
```rust
fn main() {
format!(concat!("abc}"));
}
```
currently produces:
```
error: invalid format string: unmatched `}` found
--> test.rs:2:17
|
2 | format!(concat!("abc}"));
| ^ unmatched `}` in format string
```
which is obviously incorrect. This happens because the span of the entire `concat!()` is combined with the _relative_ location of the unmatched `` `}` `` in the _result_ of the macro invocation (i.e. 4).
In #86085, this has led to a span that starts or ends in the middle of a multibyte character, but the root cause was the same. This pull request fixes the problem.
Box `thir::ExprKind::Adt` for performance
`Adt` is the biggest variant in the enum and probably isn't used very often compared to the other expr kinds, so boxing it should be beneficial for performance. We need a perf test to be sure.
optimize Eq implementation for paths
Filesystems generally have a tree-ish structure which means paths are more likely to share a prefix than a suffix. Absolute paths are especially prone to share long prefixes.
quick benchmark consisting of a search through through a vec containing the absolute paths of all (1850) files in `compiler/`:
```
# old
test path::tests::bench_path_cmp ... bench: 227,407 ns/iter (+/- 2,162)
# new
test path::tests::bench_path_cmp ... bench: 64,976 ns/iter (+/- 1,142)
```
Refactor vtable codegen
This refactor the codegen of vtables of miri interpreter, llvm, cranelift codegen backends.
This is preparation for the implementation of trait upcasting feature. cc #65991
Note that aside from code reorganization, there's an internal behavior change here that now InstanceDef::Virtual's index now include the three metadata slots, and now the first method is with index 3.
cc `@RalfJung` `@bjorn3`
Rollup of 8 pull requests
Successful merges:
- #85283 (Avoid possible filename collision in coverage tests)
- #86200 (Updates `Clone` docs for `Copy` comparison.)
- #86209 (fix minor wording/typo issues in core::option docs)
- #86242 (rustdoc- dont ICE on `ConstEvaluatable` predicates)
- #86280 (Add a regression test for issue-76510)
- #86293 (Allow to run only a few GUI tests)
- #86327 (Don't mark "safe" intrinsics as unsafe)
- #86345 (Remove some duplicate `char` assoc items on RELEASES.md)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Allow to run only a few GUI tests
It allows to specify only one (or more) GUI tests. Considering the tests are not super fast to run, this is very useful for development.
cc `@Mark-Simulacrum`
r? `@jsha`
rustdoc- dont ICE on `ConstEvaluatable` predicates
Fixes#77647
rustdoc doesn't need to be handling these as you cant write them, they just get added implicitly when you write a where clause containing an expression.
Updates `Clone` docs for `Copy` comparison.
Quite a few people (myself included) have come under the impression that the difference between `Copy` and `Clone` is that `Copy` is cheap and `Clone` is expensive, where the actual difference is that `Copy` constrains the type to bit-wise copying, and `Clone` allows for more expensive operations. The source of this misconception is in the `Clone` docs, where the following line is in the description:
> Differs from `Copy` in that `Copy` is implicit and extremely inexpensive, while `Clone` is always explicit and may or may not be expensive.
The `Clone` documentation page also comes up before the `Copy` page on google when searching for "the difference between `Clone` and `Copy`".
This PR updates the documentation to clarify that "extremely inexpensive" means an "inexpensive bit-wise copy" to hopefully prevent future rust users from falling into this misunderstanding.
Avoid possible filename collision in coverage tests
Previously, coverage tests were writing profiler data to files based on
their pid. As rustdoc spawns each doctest as its own process, it might
be possible in rare cases that a pid is being reused which would cause
a file to be overwritten, leading to incorrect coverage results.
should help with #83262
r? `@tmandry`