Issue #22750
The error reporting for E0277 (the trait `X` is not implemented for `Foo`)
now checks whether `Foo` implements a trait with the same path as `X`,
which probably means that the programmer wanted to actually use only one
version of the trait `X` instead of the two.
Rework raw ident suggestions
Use heuristics to determine whethersuggesting raw identifiers is
appropriate.
Account for raw identifiers when printing a path in a `use` suggestion.
Fix#66126.
introduce benchmarks of HashSet operations
To avoid goofs such as corrected by #66280, I added benchmarks of binary HashSet operations.
Due to the fact x.py keeps recompiling the whole shebang (or at least a big part of it) whenever you touch the test code, and because piling up all tests in one file does not strike me as future proof, I tried moving the hash benches to the separate place they are for liballoc/collections/btree. But it turns out that, in a cleaned checkout, x.py still recompiles the whole shebang whenever you touch the test code (PS or when you add or delete any irrelevant file). So I'm not going to add more tests, and I doubt others will, and these tests have proven their point already, so this PR is kind of pointless
Fix cycle when debug-printing opaque types
Fixes#61577
When printing an opaque type in non-verbose mode, we use the
`tcx.predicates_of` query to retrieve the opaque type's bounds for
pretty-printing. However, the pervasiveness of logging within librustc
means that we may already be executing `tcx.predicates_of` for the
opaque type we're trying to print, leading to a cycle error.
This commit adds a new 'no queries' thread-local flag to the pretty
printer. This flag is enabled during the computation of `predicates_of`
for opaque types, and causes us to print the opaque type in 'verbose'
mode (which does not require computing any additinal queries). This
should only affect debug logging for highly nested log messages, not any
user-visible output.
Scope format! temporaries
This places the temporaries that `format!` generates to refer to its arguments (through `&dyn Trait`) in a short-lived scope surrounding just the invocation of `format!`. This enables `format!` to be used in generators without the temporaries preventing the generator from being `Send` (due to `dyn Trait` not being `Sync`).
See rust-lang/rust#64477 for details.
Rollup of 5 pull requests
Successful merges:
- #61351 (Stabilize cfg(doc))
- #66539 (Point at type in `let` assignment on type errors)
- #66655 (rustdoc: Mark `--extern-private` as unstable)
- #66657 (rustdoc: Don't panic when failing to write .lock file)
- #66673 (Move def collector from `rustc` to `rustc_resolve`)
Failed merges:
r? @ghost
Move def collector from `rustc` to `rustc_resolve`
It's used only from `rustc_resolve`, so we can move it there, thus reducing the size of `rustc` (https://github.com/rust-lang/rust/issues/65031).
It's quite possible that we can merge the def collector pass into the "build reduced graph" pass (they are always run together and do similar things), but it's some larger work.
r? @eddyb
rustdoc: Don't panic when failing to write .lock file
It can be treated like any other unexpected IO error.
I couldn't think of a good way to add a test for this unfortunately.
r? @GuillaumeGomez