summary refs log tree commit diff
path: root/src/librustc_errors/lib.rs
AgeCommit message (Collapse)AuthorLines
2017-11-16Remove left over dead code from suggestion diagnostic refactoringOliver Schneider-14/+0
2017-11-03Refactor internal suggestion APIOliver Schneider-77/+55
2017-11-02Make the difference between lint codes and error codes explicitOliver Schneider-14/+18
2017-10-26Auto merge of #45519 - michaelwoerister:dedup-errors, r=arielb1bors-6/+31
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.
2017-10-25librustc_errors: Don't emit the same error message twice.Michael Woerister-6/+31
2017-10-20Add short message-formatGuillaume Gomez-1/+1
2017-08-30Auto merge of #43968 - petrochenkov:span2, r=michaelwoeristerbors-11/+7
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.
2017-08-30Make fields of `Span` privateVadim Petrochenkov-11/+7
2017-08-29Rollup merge of #43778 - topecongiro:handler-reset-err-count, r=arielb1Ariel Ben-Yehuda-0/+6
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
2017-08-27Additional libc cleanupTatsuyuki Ishi-1/+2
2017-08-26Auto merge of #44071 - alexcrichton:no-cycles, r=nikomatsakisbors-10/+6
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
2017-08-25rustc_errors: Add the ability to delay as bugsAlex Crichton-10/+6
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...
2017-08-25Auto merge of #43994 - tamird:remove-attributes, r=alexcrichtonbors-3/+0
*: remove crate_{name,type} attributes Fixes #41701. r? @arielb1
2017-08-25*: remove crate_{name,type} attributesTamir Duberstein-3/+0
Fixes #41701.
2017-08-24rustc: Capture diagnostics from all queriesAlex Crichton-1/+22
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
2017-08-23Add reset_err_count() to errors::HandlerSeiichi Uchida-0/+6
The motivation here is to allow rustfmt to recover from parse errors after failing to parse macros.
2017-08-21Auto merge of #43986 - petrochenkov:pubcrate3, r=pnkfelixbors-15/+6
rustc: Remove some dead code Extracted from https://github.com/rust-lang/rust/pull/43192 r? @eddyb
2017-08-19rustc: Remove some dead codeVadim Petrochenkov-15/+6
2017-08-18Add an additional empty line between the suggested `use` and the next itemOliver Schneider-2/+4
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-4/+4
Like #43008 (f668999), but _much more aggressive_.
2017-07-31fix `-Z treat-err-as-bug`Ariel Ben-Yehuda-4/+1
2017-07-17Add flag to hide code on inline suggestionsEsteban Küber-0/+1
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.
2017-07-06Remove unused code from librustc_errorsKevin Mehall-2/+2
2017-07-06Only underline suggestion if it is not the only code being shownEsteban Küber-6/+17
2017-07-02Revert "Change error count messages"Ariel Ben-Yehuda-1/+4
This reverts commit 5558c64f33446225739c1153b43d2e309bb4f50e.
2017-06-19Bump version and stage0 compilerAlex Crichton-4/+0
2017-06-12External spans: address review.Inokentiy Babushkin-2/+2
* 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.
2017-06-11Added consumption logic for external sources in FileMapInokentiy Babushkin-5/+6
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.
2017-06-11Improved lazy external source loading and inserted calls.Inokentiy Babushkin-1/+1
2017-06-10Added external crates' sources to FileMap.Inokentiy Babushkin-0/+1
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.
2017-05-31Use callsite's span for macro calls on suggestionEsteban Küber-0/+1
When suggesting an appropriate mutability for a macro call, use the call span instead of the expanded macro's span.
2017-05-30Add new error codeGuillaume Gomez-0/+6
2017-05-24Change error count messagesMichael Kohl-4/+1
See #33525 for details.
2017-05-19fix some clippy warnings in librustc_errorsAndre Bogus-2/+2
2017-05-13Auto merge of #41965 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-31/+75
Rollup of 15 pull requests - Successful merges: #41820, #41860, #41876, #41896, #41912, #41916, #41918, #41921, #41923, #41934, #41935, #41940, #41942, #41943, #41951 - Failed merges:
2017-05-11rustc: Remove #![unstable] annotationAlex Crichton-3/+4
These are now no longer necessary with `-Z force-unstable-if-unmarked`
2017-05-11Address PR reviewsOliver Schneider-5/+23
2017-05-10Example usage of multiple suggestionsOliver Schneider-1/+4
2017-05-10Refactor suggestion diagnostic API to allow for multiple suggestionsOliver Schneider-31/+54
2017-05-06Group "macro expansion" notes per call spanEsteban Küber-3/+5
2017-05-05Use diagnostics for trace_macro instead of printlnEsteban Küber-0/+6
2017-05-02Auto merge of #40851 - oli-obk:multisugg, r=jonathandturnerbors-0/+1
Minimize single span suggestions into a label changes ``` 14 | println!("☃{}", tup[0]); | ^^^^^^ | help: to access tuple elements, use tuple indexing syntax as shown | println!("☃{}", tup.0); ``` into ``` 14 | println!("☃{}", tup[0]); | ^^^^^^ to access tuple elements, use `tup.0` ``` Also makes suggestions explicit in the backend in preparation of adding multiple suggestions to a single diagnostic. Currently that's already possible, but results in a full help message + modified code snippet per suggestion, and has no rate limit (might show 100+ suggestions).
2017-04-27typeck: resolve type vars before calling `try_index_step`Ariel Ben-Yehuda-0/+3
`try_index_step` does not resolve type variables by itself and would fail otherwise. Also harden the failure path in `confirm` to cause less confusing errors.
2017-04-25Minimize single span suggestions into a noteOliver Schneider-0/+1
2017-04-11Highlight and simplify mismatched typesEsteban Küber-1/+1
Shorten mismatched types errors by replacing subtypes that are not different with `_`, and highlighting only the subtypes that are different. Given a file ```rust struct X<T1, T2> { x: T1, y: T2, } fn foo() -> X<X<String, String>, String> { X { x: X {x: "".to_string(), y: 2}, y: "".to_string()} } fn bar() -> Option<String> { "".to_string() } ``` provide the following output ```rust error[E0308]: mismatched types --> file.rs:6:5 | 6 | X { x: X {x: "".to_string(), y: 2}, y: "".to_string()} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found {integer} | = note: expected type `X<X<_, std::string::String>, _>` ^^^^^^^^^^^^^^^^^^^ // < highlighted found type `X<X<_, {integer}>, _>` ^^^^^^^^^ // < highlighted error[E0308]: mismatched types --> file.rs:6:5 | 10 | "".to_string() | ^^^^^^^^^^^^^^ expected struct `std::option::Option`, found `std::string::String` | = note: expected type `Option<std::string::String>` ^^^^^^^ ^ // < highlighted found type `std::string::String` ```
2017-03-29Merge `ExpnId` and `SyntaxContext`.Jeffrey Seyfried-3/+1
2017-02-25Fix suggestion span error with a line containing non-ASCIIssinkuu-1/+2
2017-02-02store typeck lints in the `TypeckTables`Niko Matsakis-3/+4
Otherwise they are a "hidden output"
2017-01-22Remove unused `extern crate`s.Jeffrey Seyfried-5/+0
2017-01-22Warn on unused `#[macro_use]` imports.Jeffrey Seyfried-2/+0