Add new diagnostic writer using annotate-snippet library
This adds a new diagnostic writer `AnnotateRsEmitterWriter` that uses
the [`annotate-snippet`][as] library to print out the human readable
diagnostics.
The goal of #59346 is to eventually switch over to using the library instead of
maintaining our own diagnostics output.
This PR does **not** add all the required features to the new
diagnostics writer. It is only meant as a starting point so that other
people can start contributing as well.
There are some FIXMEs in `librustc_errors/annotate_rs_emitter.rs` that
point at yet to be implemented features of the new diagnostic emitter, however
those are most likely not exhaustive.
[as]: https://github.com/rust-lang/annotate-snippets-rs
This adds a new diagnostic writer `AnnotateRsEmitterWriter` that uses
the [`annotate-snippet`][as] library to print out the human readable
diagnostics.
The goal is to eventually switch over to using the library instead of
maintaining our own diagnostics output.
This commit does *not* add all the required features to the new
diagnostics writer. It is only meant as a starting point so that other
people can contribute as well.
[as]: https://github.com/rust-lang/annotate-snippets-rs
Make cannot move errors more consistent with other borrowck errors
* Note the type of the place being moved in all cases.
* Note the place being moved from.
* Simplify the search for overloaded place operators
* Extend the note for move from overloaded deref apply to all types.
* Add a note for moves from overloaded index.
* Special case moves for closure captures.
r? @pnkfelix
Rollup of 13 pull requests
Successful merges:
- #61135 (Fix documentation of `Rc::make_mut` regarding `rc::Weak`.)
- #61404 (miri unsizing: fix projecting into a field of an operand)
- #61409 (Fix an ICE with a const argument in a trait)
- #61413 (Re-implement async fn drop order lowering )
- #61419 (Add an unusual-conversion example to to_uppercase)
- #61420 (Succinctify splice docs)
- #61444 (Suggest using `as_ref` on `*const T`)
- #61446 (On TerminatorKind::DropAndReplace still handle unused_mut correctly)
- #61485 (azure: retry s3 upload if it fails)
- #61489 (ci: Reenable step timings on AppVeyor)
- #61496 (Do not panic in tidy on unbalanced parentheses in cfg's)
- #61497 (Treat 0 as special value for codegen-units-std)
- #61499 (Add regression test for existential type ICE #53457)
Failed merges:
r? @ghost
ci: Reenable step timings on AppVeyor
This was accidentally regressed in #60777 by accident, and we've stopped
printing out step timings on AppVeyor recently reducing the ability for
us to track build times over time!
Re-implement async fn drop order lowering
This PR re-implements the async fn drop order lowering changes so
that it all takes place in HIR lowering, building atop the work done by
@eddyb to refactor `Res::Upvar`.
Previously, this types involved in the lowering were constructed in
libsyntax as they had to be used during name resolution and HIR
lowering. This was awful because none of that logic should have existed
in libsyntax.
This commit also changes `ArgSource` to keep a `HirId` to the original
argument pattern rather than a cloned copy of the pattern.
Only b7aa4ed and 71fb8fa should be reviewed, any other commits
are from #61276 (though 447e336 might end up staying in this PR).
As a nice side effect, it also fixes#61187 (cc #61192).
r? @eddyb
cc @cramertj
miri unsizing: fix projecting into a field of an operand
I don't know why this open-coded an operand field projection. Probably this code predates one or more of my refactorings.
Fixes https://github.com/rust-lang/miri/issues/754
r? @oli-obk
add support for unchecked math
add compiler support for
```rust
/// Returns the result of an unchecked addition, resulting in
/// undefined behavior when `x + y > T::max_value()` or `x + y < T::min_value()`.
pub fn unchecked_add<T>(x: T, y: T) -> T;
/// Returns the result of an unchecked substraction, resulting in
/// undefined behavior when `x - y > T::max_value()` or `x - y < T::min_value()`.
pub fn unchecked_sub<T>(x: T, y: T) -> T;
/// Returns the result of an unchecked multiplication, resulting in
/// undefined behavior when `x * y > T::max_value()` or `x * y < T::min_value()`.
pub fn unchecked_mul<T>(x: T, y: T) -> T;
```
cc https://github.com/rust-lang/rfcs/issues/2508
This was accidentally regressed in #60777 by accident, and we've stopped
printing out step timings on AppVeyor recently reducing the ability for
us to track build times over time!
Fix duplicated bounds printing in rustdoc
Fixes#56331.
Once again, I couldn't find out how to reproduce it with a small code so no test... :-/
r? @QuietMisdreavus
* Show the place and type being moved
* Give a special error for variables in match guard
* Simplify search for overloaded deref
* Search for overloaded index