| Age | Commit message (Collapse) | Author | Lines |
|
use .to_string() instead of format!() macro to create strings
handles what is left after https://github.com/rust-lang/rust/pull/69541
|
|
|
|
|
|
|
|
Even when buffered. Ideally we would flush only when the emitter is
done, but that requires larger changes. This gives most of the benefit
of buffering in any case.
|
|
Since `stderr` is unbuffered, writing out json messages actually take up
about ~10%/0.1s of the runtime of the `inflate` benchmark.
cc #64413
|
|
Rollup of 8 pull requests
Successful merges:
- #66498 (Remove unused feature gates)
- #68816 (Tweak borrow error on `FnMut` when `Fn` is expected)
- #68824 (Enable Control Flow Guard in rustbuild)
- #69022 (traits: preallocate 2 Vecs of known initial size)
- #69031 (Use `dyn Trait` more in tests)
- #69044 (Don't run coherence twice for future-compat lints)
- #69047 (Don't rustfmt check the vendor directory.)
- #69055 (Clean up E0307 explanation)
Failed merges:
r? @ghost
|
|
Remove unused feature gates
I think many of the remaining unstable things can be easily be replaced with stable things. I have kept the `#![feature(nll)]` even though it is only necessary in `libstd`, to make regressions of it harder.
|
|
|
|
Caller now passes in a `decorate` function, which is only run if the
lint is allowed.
|
|
Initial implementation of `#![feature(move_ref_pattern)]`
Following up on #45600, under the gate `#![feature(move_ref_pattern)]`, `(ref x, mut y)` is allowed subject to restrictions necessary for soundness. The match checking implementation and tests for `#![feature(bindings_after_at)]` is also adjusted as necessary.
Closes #45600.
Tracking issue: #68354.
r? @matthewjasper
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Use termize instead of term_size
`termize` is a fork of `term_size` which uses `winapi` 0.3 instead of 0.2. This is a step towards removing the `winapi` 0.2 dependency.
r? @Mark-Simulacrum
|
|
|
|
|
|
|
|
|
|
|
|
Further improve `impl Trait`/`dyn Trait` suggestions
After reading [_Returning Trait Objects_ by Bryce Fisher-Fleig](https://bryce.fisher-fleig.org/blog/returning-trait-objects/), [I noticed that](https://www.reddit.com/r/rust/comments/esueur/returning_trait_objects/ffczl4k/) #68195 had a few bugs due to not ignoring `ty::Error`.
- Account for `ty::Error`.
- Account for `if`/`else` and `match` blocks when pointing at return types and referencing their types.
- Increase the multiline suggestion output from 6 lines to 20.
|
|
|
|
When encountering a multipart suggestion with spans belonging to
different contexts, skip that suggestion.
|
|
|
|
|
|
|
|
Do not ICE on malformed suggestion spans
Under the assumption that suggestions are by their very nature always "best effort", it is ok if we don't display them instead of having an ICE. The underlying issue of the malformed span being _created_ is left unaddressed.
Fix #67567.
r? @petrochenkov
|
|
|
|
|
|
found via clippy
|
|
|
|
|
|
|
|
- remove syntax::{help!, span_help!, span_note!}
- remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!}
- lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints
- inline syntax::{struct_span_warn!, diagnostic_used!}
- stringify_error_code! -> error_code! & use it more.
- find_plugin_registrar: de-fatalize an error
- de-fatalize metadata errors
- move type_error_struct! to rustc_typeck
- struct_span_err! -> rustc_errors
|
|
The existing code seems to assume that substitutions spans are disjoint,
which is not always the case.
In the example:
pub trait AAAA {}
pub trait B {}
pub trait C {}
pub type T<P: AAAA + B + C> = P;
, we get three substituions starting from ':' and ending respectively at
the end of each trait token.
With the former offset calculation, this would cause `underline_start` to
eventually become negative before being converted to `usize`...
The new version may report erroneous results for non perfectly overlapping
substitutions but I don't know if such examples exist. Alternatively, we
could detect these cases and trim out overlapping substitutions.
|
|
|
|
|
|
|
|
|
|
Set callbacks globally
This sets the callbacks from syntax and rustc_errors just once, utilizing static (rather than thread-local) storage.
|
|
The callbacks have precisely two states: the default, and the one
present throughout almost all of the rustc run (the filled in value
which has access to TyCtxt).
We used to store this as a thread local, and reset it on each thread to
the non-default value. But this is somewhat wasteful, since there is no
reason to set it globally -- while the callbacks themselves access TLS,
they do not do so in a manner that fails in when we do not have TLS to
work with.
|
|
`description` has been documented as soft-deprecated since 1.27.0 (17
months ago). There is no longer any reason to call it or implement it.
This commit:
- adds #[rustc_deprecated(since = "1.41.0")] to Error::description;
- moves description (and cause, which is also deprecated) below the
source and backtrace methods in the Error trait;
- reduces documentation of description and cause to take up much less
vertical real estate in rustdocs, while preserving the example that
shows how to render errors without needing to call description;
- removes the description function of all *currently unstable* Error
impls in the standard library;
- marks #[allow(deprecated)] the description function of all *stable*
Error impls in the standard library;
- replaces miscellaneous uses of description in example code and the
compiler.
|
|
|
|
|
|
Signed-off-by: David Wood <david@davidtw.co>
|
|
correctly when non-1space unicode characters are to the left
For this we use the correct calculation of the 'left' identation
|