Emit error for pattern arguments in trait methods
The error and check for this already existed, but the parser didn't try to parse trait method arguments as patterns, so the error was never emitted. This surfaces the error, so we get better errors than simple parse errors.
This improves the error message described in https://github.com/rust-lang/rust/issues/53046.
r? @petrochenkov
Rollup of 15 pull requests
Successful merges:
- #52955 (Update compiler test documentation)
- #53019 (Don't collect() when size_hint is useless)
- #53025 (Consider changing assert! to debug_assert! when it calls visit_with)
- #53059 (Remove explicit returns where unnecessary)
- #53165 ( Add aarch64-unknown-netbsd target)
- #53210 (Deny future duplication of rustc-ap-syntax)
- #53223 (A few cleanups for rustc_data_structures)
- #53230 ([nll] enable feature(nll) on various crates for bootstrap: part 4)
- #53231 (Add let keyword doc)
- #53240 (Add individual documentation for <integer>`.swap_bytes`/.`reverse_bits`)
- #53253 (Remove unwanted console log)
- #53264 (Show that Command can be reused and remodified)
- #53267 (Fix styles)
- #53273 (Add links to std::char::REPLACEMENT_CHARACTER from docs.)
- #53283 (wherein we suggest float for integer literals where a float was expected)
Failed merges:
r? @ghost
wherein we suggest float for integer literals where a float was expected
@sunjay pointed out that this is a nice thing that we could do.
Resolves#53280.
r? @estebank
Add links to std::char::REPLACEMENT_CHARACTER from docs.
There are a few places where we mention the replacement character in the
docs, and it could be helpful for users to utilize the constant which is
available in the standard library, so let’s link to it!
Show that Command can be reused and remodified
The prior documentation did not make it clear this was possible.
I wanted to make the `list_dir` example work on Windows, but I don't know if passing "/" will error or show the root of the current volume (e.g. `C:`).
r? @GuillaumeGomez
A few cleanups for rustc_data_structures
- remove a redundant `clone()`
- make some calls to `.iter()` implicit
- collapse/simplify a few operations
- remove some explicit `return`s
- make `SnapshotMap::{commit, rollback_to}` take references
- remove unnecessary struct field names
- change `transmute()`s in `IdxSet::{from_slice, from_slice_mut}` to casts
- remove some unnecessary lifetime annotations
- split 2 long literals
Consider changing assert! to debug_assert! when it calls visit_with
The perf run from #52956 revealed that there were 3 benchmarks that benefited most from changing `assert!`s to `debug_assert!`s:
- issue #46449: avg -4.7% for -check
- deeply-nested (AKA #38528): avg -3.4% for -check
- regression #31157: avg -3.2% for -check
I analyzed their fixing PRs and decided to look for potentially heavy assertions in the files they modified. I noticed that all of the non-trivial ones contained indirect calls to `visit_with()`.
It might be a good idea to consider changing `assert!` to `debug_assert!` in those places in order to get the performance wins shown by the benchmarks.
Don't collect() when size_hint is useless
This adjusts PRs #52738 and #52697 by falling back to calculating capacity and extending or pushing in a loop where `collect()` can't be trusted to calculate the right capacity.
It is a performance win.
Update compiler test documentation
Update the compiler test documentation to document ignore-gdb-version
and min-system-llvm-version; and expand the min-gdb-version,
min-lldb-version, and min-llvm-version documentation a little.
The error and check for this already existed, but the parser didn't try to parse trait method arguments as patterns, so the error was never emitted. This surfaces the error, so we get better errors than simple parse errors.
There are a few places where we mention the replacement character in the
docs, and it could be helpful for users to utilize the constant which is
available in the standard library, so let’s link to it!