Rollup of 8 pull requests
Successful merges:
- #52453 (improve diagnostics for tests with custom return values)
- #53271 (use ? to simplify `TransitiveRelation.maybe_map`)
- #53279 (Extend documentation of `rustc_on_unimplemented`)
- #53342 (fix error for unsized packed struct field)
- #53344 (Add doc examples for std::alloc::{alloc,alloc_zeroed}.)
- #53368 (Ignore test that fails on stage1)
- #53388 (Fix links' color)
- #53396 (Fix since of Iterator::flatten to be a proper semver)
Failed merges:
r? @ghost
fix error for unsized packed struct field
It was really confusing to be told "only the last field of a struct may have a dynamically sized type" when only the last field *was* unsized.
improve diagnostics for tests with custom return values
This is an attempt at getting the ball rolling to improve the diagnostics for test functions that return custom `impl Termination` values (see #52436).
An alternative could be to use `eprintln!`, but including this in the panic message felt nicely consistent with how failing test assertions would be reported.
Let me know what you think!
Add lldb to the build
This optionally adds lldb (and clang, which it needs) to the build.
Because rust uses LLVM 7, and because clang 7 is not yet released, a
recent git master version of clang is used.
The lldb that is used includes the Rust plugin.
lldb is only built when asked for, or when doing a nightly build on
macOS. Only macOS is done for now due to difficulties with the Python
dependency.
This optionally adds lldb (and clang, which it needs) to the build.
Because rust uses LLVM 7, and because clang 7 is not yet released, a
recent git master version of clang is used.
The lldb that is used includes the Rust plugin.
lldb is only built when asked for, or when doing a nightly build on
macOS. Only macOS is done for now due to difficulties with the Python
dependency.
(old) borrowck cleanup
Primarily moves dataflow code based on CFG to borrowck; this is mostly so we don't forget to delete it once it becomes unused after we fully move to MIR borrowck.
Idiomatic improvements to IP method
Since match ergonomics and slice patterns are stable this might be more idiomatic modern Rust implementations of these methods? Or well, slice patterns with `..` are not stabilized yet, so maybe we want to specify all fields but with `_`?
A few cleanups
- change `skip(1).next()` to `nth(1)`
- collapse some `if-else` expressions
- remove a few explicit `return`s
- remove an unnecessary field name
- dereference once instead of matching on multiple references
- prefer `iter().enumerate()` to indexing with `for`
- remove some unnecessary lifetime annotations
- use `writeln!()` instead of `write!()`+`\n`
- remove redundant parentheses
- shorten some enum variant names
- a few other cleanups suggested by `clippy`
rustc_codegen_llvm: Restore the closure env alloca hack for LLVM 5.
This hack was removed in #50949, but without it I found that building
`std` with full debuginfo would print many LLVM `DW_OP_LLVM_fragment`
errors, then die `LLVM ERROR: Failed to strip malformed debug info`.
It doesn't seem to be a problem for LLVM 6, so we can re-enable the hack
just for older LLVM.
This reverts commit da579ef75e.
Fixes#53204.
r? @eddyb