pprust: adjust mixed comment printing and add regression test for #74745Fixes#74745.
This PR adds a regression test for #74745. While a `ignore-tidy-trailing-lines` header is required, this doesn't stop the test from reproducing, so long as there is no newline at the end of the file.
However, adding the header comments made the test fail due to a bug in pprust - so this PR also adjusts the pretty printing of mixed comments so that the initial zero-break isn't emitted at the beginning of the line. Through this, the `block-comment-wchar` test can have the `pp-exact` file removed, as it no longer converges from pretty printing of the source.
Introduce NonterminalKind for more type-safe mbe parsing
It encapsulate the (part of) the interface between the parser and
macro by example (macro_rules) parser.
The second bit is somewhat more general `parse_ast_fragment`, which is
the reason why we keep some `parse_xxx` functions as public.
Fix ICEs with `@ ..` binding
This reverts #74557 and introduces an alternative fix while ensuring that #74954 is not broken.
The diagnostics are verbose though, it fixes three related issues.
cc #74954, #74539, and #74702
Rollup of 10 pull requests
Successful merges:
- #74686 (BTreeMap: remove into_slices and its unsafe block)
- #74762 (BTreeMap::drain_filter should not touch the root during iteration)
- #74781 (Clean up E0733 explanation)
- #74874 (BTreeMap: define forget_type only when relevant)
- #74974 (Make tests faster in Miri)
- #75010 (Update elasticlunr-rs and ammonia transitive deps)
- #75041 (Replaced log with tracing crate)
- #75044 (Clean up E0744 explanation)
- #75054 (Rename rustc_middle::cstore::DepKind to CrateDepKind)
- #75057 (Avoid dumping rustc invocations to stdout)
Failed merges:
- #74827 (Move bulk of BTreeMap::insert method down to new method on handle)
r? @ghost
Avoid dumping rustc invocations to stdout
These are quite long, usually, and in most cases not interesting. On smaller
terminals they can take up more than a full page of output, hiding the error
diagnostics emitted.
BTreeMap: define forget_type only when relevant
Similar to `forget_node_type` for handles.
No effect on generated code, apart maybe from the superfluous calls that might not have been optimized away.
r? @Mark-Simulacrum
BTreeMap::drain_filter should not touch the root during iteration
Although Miri doesn't point it out, I believe there is undefined behaviour using `drain_filter` when draining the 11th-last element from a tree that was larger. When this happens, the last remaining child nodes are merged, the root becomes empty and is popped from the tree. That last step establishes a mutable reference to the node elected root and writes a pointer in `node::Root`, while iteration continues to visit the same node.
This is mostly code from #74437, slightly adapted.
These are quite long, usually, and in most cases not interesting. On smaller
terminals they can take up more than a full page of output, hiding the error
diagnostics emitted.
This commit modifies compiletest so that a diff of actual and expected
output is shown for pretty tests. This makes it far easier to work out
what has changed.
Signed-off-by: David Wood <david@davidtw.co>
This commit adds a regression test for #74745. While a
`ignore-tidy-trailing-lines` header is required, this doesn't stop the
test from reproducing, so long as there is no newline at the end of the
file.
However, adding the header comments made the test fail due to a bug in
pprust, fixed in the previous commit.
Signed-off-by: David Wood <david@davidtw.co>
This commit adjusts the pretty printing of mixed comments so that the
initial zero-break isn't emitted at the beginning of the line. Through
this, the `block-comment-wchar` test can have the `pp-exact` file
removed, as it no longer converges from pretty printing of the source.
Signed-off-by: David Wood <david@davidtw.co>
Add fallible AArch64 CI builder
This adds the `aarch64-gnu` CI builder to the `auto-fallible` job, as a first step in the process of actually gating on it.
r? @Mark-Simulacrum
Deduplicate `::` -> `:` typo errors
Deduplicate errors caused by the same type ascription typo, including
ones suggested during parsing that would get reported again during
resolve. Fix#70382.
It encapsulate the (part of) the interface between the parser and
macro by example (macro_rules) parser.
The second bit is somewhat more general `parse_ast_fragment`, which is
the reason why we keep some `parse_xxx` functions as public.
Fix std::fs::File::metadata permission on WASI target
Previously `std::fs::File::metadata` on wasm32-wasi would call `fd_filestat_get`
to get metadata associated with fd, but that fd is opened without
RIGHTS_FD_FILESTAT_GET right, so it will failed on correctly implemented WASI
environment.
This change instead to add the missing rights when opening an fd.
Use a slice pattern instead of rchunks_exact(_).next()
This is a minor cleanup, but trying a single-use `rchunks` iterator can
be more directly matched with a slice pattern, `[.., a, b]`.