| Age | Commit message (Collapse) | Author | Lines |
|
This adds `span_approximate_suggestion()` that lets you emit a
suggestion marked as "approximate" in the JSON output. UI
users see no difference. This is for when rustc and clippy wish to
emit suggestions which will make sense to the reader (e.g. they may
have placeholders like `<type>`) but are not source-applicable, so that
rustfix/etc can ignore these.
fixes #39254
|
|
|
|
errors
|
|
|
|
|
|
Use correct line offsets for doctests
Not yet tested.
This doesn't handle char positions. It could if I collected a map of char offsets and lines, but this is a bit more work and requires hooking into the parser much more (unsure if it's possible).
r? @QuietMisdreavus
(fixes #45868)
|
|
|
|
When external tools like `rustfmt` calls to `reset_err_count` for handler
reusing, it will set the error count on the handler to 0, but since
https://github.com/rust-lang/rust/pull/47146 the handler will contain
status that will prevent the error count to be bumped if this handler is
reused.
This caused `rustfmt` idempotency tests to fail:
https://github.com/rust-lang-nursery/rustfmt/issues/2338
Fixes: https://github.com/rust-lang-nursery/rustfmt/issues/2338
|
|
This ensures that if we emit the same diagnostic twice, the error count will
match the real number of errors shown to the user.
Fixes #42106
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Don't emit the same compiler diagnostic twice.
This PR makes the compiler filter out diagnostic messages that have already been emitted during the same compilation session.
|
|
|
|
|
|
Make fields of `Span` private
I actually tried to intern spans and benchmark the result<sup>*</sup>, and this was a prerequisite.
This kind of encapsulation will be a prerequisite for any other attempt to compress span's representation, so I decided to submit this change alone.
The issue https://github.com/rust-lang/rust/issues/43088 seems relevant, but it looks like `SpanId` won't be able to reuse this interface, unless the tables are global (like interner that I tried) and are not a part of HIR.
r? @michaelwoerister anyway
<sup>*</sup> Interning means 2-3 times more space is required for a single span, but duplicates are free. In practice it turned out that duplicates are not *that* common, so more memory was wasted by interning rather than saved.
|
|
|
|
Add reset_err_count() to errors::Handler
The motivation here is to allow rustfmt to recover from parse errors after failing to parse macros (cc https://github.com/rust-lang-nursery/rustfmt/issues/1742).
r? @nrc
|
|
|
|
rustc: Start moving toward "try_get is a bug" for incremental
This PR is an effort to burn down some of the work items on #42633. The basic change here was to leave the `try_get` function exposed but have it return a `DiagnosticBuilder` instead of a `CycleError`. This means that it should be a compiler bug to *not* handle the error as dropping a diagnostic should result in a complier panic.
After that change it was then necessary to update the compiler's callsites of `try_get` to handle the error coming out. These were handled as:
* The `sized_constraint` and `needs_drop_raw` checks take the diagnostic and defer it as a compiler bug. This was a new piece of functionality added to the error handling infrastructure, and the idea is that for both these checks a "real" compiler error should be emitted elsewhere, so it's only a bug if we don't actually emit the complier error elsewhere.
* MIR inlining was updated to just ignore the diagnostic. This is being tracked by https://github.com/rust-lang/rust/issues/43542 which sounded like it either already had some work underway or was planning to change regardless.
* The final case, `item_path`, is still sort of up for debate. At the time of this writing this PR simply removes the invocations of `try_get` there, assuming that the query will always succeed. This turns out to be true for the test suite anyway! It sounds like, though, that this logic was intended to assist in "weird" situations like `RUST_LOG` where debug implementations can trigger at any time. This PR would therefore, however, break those implementations.
I'm unfortunately sort of out of ideas on how to handle `item_path`, but other thoughts would be welcome!
Closes #42633
|
|
This adds a function to `DiagnosticBuilder` to delay the entire diagnostic as a
bug to be emitted at a later time. This'll end up getting used in the compiler
in the subsequent commits...
|
|
*: remove crate_{name,type} attributes
Fixes #41701.
r? @arielb1
|
|
Fixes #41701.
|
|
This commit alters the `rustc::ty::maps` implementation to ensure that all
output diagnostics from the compiler are tracked for the duration of each query.
These are then intended to be replayed back the first time a cached value is
loaded, and otherwise the cache should operate the same as it does today.
Closes #42513
|
|
The motivation here is to allow rustfmt to recover from parse errors
after failing to parse macros.
|
|
rustc: Remove some dead code
Extracted from https://github.com/rust-lang/rust/pull/43192
r? @eddyb
|
|
|
|
|
|
Like #43008 (f668999), but _much more aggressive_.
|
|
|
|
Now there's a way to add suggestions that hide the suggested code when
presented inline, to avoid weird wording when short code snippets are
added at the end.
|
|
|
|
|
|
This reverts commit 5558c64f33446225739c1153b43d2e309bb4f50e.
|
|
|
|
* The lazy loading mechanism has been moved to a more appropriate place.
* Return values from the functions invoked there are properly used.
* Documentation has gotten some minor improvements.
* Possibly some larger restructuring will need to take place still.
|
|
We now fetch source lines from the `external_src` member as a secondary
fallback if no regular source is present, that is, if the file map
belongs to an external crate and the source has been fetched from disk.
|
|
|
|
They are now handled in their own member to prevent mutating access to
the `src` member. This way, we can safely load external sources, while
keeping the mutation of local source strings off-limits.
|
|
When suggesting an appropriate mutability for a macro call, use the call
span instead of the expanded macro's span.
|
|
|
|
See #33525 for details.
|
|
|
|
Rollup of 15 pull requests
- Successful merges: #41820, #41860, #41876, #41896, #41912, #41916, #41918, #41921, #41923, #41934, #41935, #41940, #41942, #41943, #41951
- Failed merges:
|
|
These are now no longer necessary with `-Z force-unstable-if-unmarked`
|
|
|