about summary refs log tree commit diff
path: root/src/librustc_errors
AgeCommit message (Collapse)AuthorLines
2017-08-26Auto merge of #44081 - est31:master, r=eddybbors-1/+3
Fix a byte/char confusion issue in the error emitter Fixes #44078. Fixes #44023. The start_col member is given in chars, while the code previously assumed it was given in bytes. The more basic issue #44080 doesn't get fixed.
2017-08-26Auto merge of #44071 - alexcrichton:no-cycles, r=nikomatsakisbors-12/+26
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-12/+26
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-25Fix a byte/char confusion issue in the error emitterest31-1/+3
Fixes #44078. Fixes #44023. The start_col member is given in chars, while the code previously assumed it was given in bytes. The more basic issue #44080 doesn't get fixed.
2017-08-24rustc: Capture diagnostics from all queriesAlex Crichton-6/+30
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-34/+6
rustc: Remove some dead code Extracted from https://github.com/rust-lang/rust/pull/43192 r? @eddyb
2017-08-21Auto merge of #43929 - oli-obk:use_placement, r=nrcbors-2/+4
Improve placement of `use` suggestions r? @nrc cc @estebank @Mark-Simulacrum fixes #42835 fixes #42548 fixes #43769
2017-08-19rustc: Remove some dead codeVadim Petrochenkov-34/+6
2017-08-18Add an additional empty line between the suggested `use` and the next itemOliver Schneider-2/+4
2017-08-17Rollup merge of #43891 - Fourchaux:master, r=steveklabnikCorey Farwell-5/+5
Fix typos & us spellings Fixing some typos and non en-US spellings. (Update of PR https://github.com/rust-lang/rust/pull/42812 )
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-18/+18
Like #43008 (f668999), but _much more aggressive_.
2017-08-15Fix typos & us spellingsFourchaux-5/+5
2017-07-31fix `-Z treat-err-as-bug`Ariel Ben-Yehuda-10/+7
2017-07-23Auto merge of #43096 - estebank:ascription-help, r=nikomatsakisbors-2/+27
Point at `:` when using it instead of `;` When triggering type ascription in such a way that we can infer a statement end was intended, add a suggestion for the change. Always point out the reason for the expectation of a type is due to type ascription. Fix #42057, #41928.
2017-07-18reorder span labelsgaurikholkar-2/+13
2017-07-17Add flag to hide code on inline suggestionsEsteban Küber-2/+27
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-17Change some helps to suggestionsOliver Schneider-1/+13
2017-07-06Remove unused code from librustc_errorsKevin Mehall-22/+4
2017-07-06Only underline suggestion if it is not the only code being shownEsteban Küber-18/+28
2017-07-06Add extra whitespace for suggestionsEsteban Küber-6/+31
2017-07-06Make suggestion include the line numberEsteban Küber-7/+11
When there're more than one suggestions in the same diagnostic, they are displayed in their own block, instead of inline. In order to reduce confusion, those blocks now display the line number.
2017-07-02Revert "Change error count messages"Ariel Ben-Yehuda-1/+4
This reverts commit 5558c64f33446225739c1153b43d2e309bb4f50e.
2017-06-24Suggest removal of semicolon (instead of being help)Esteban Küber-1/+6
2017-06-19Bump version and stage0 compilerAlex Crichton-4/+0
2017-06-18Auto merge of #42593 - ibabushkin:on-demand-external-source, r=eddybbors-11/+15
Implement lazy loading of external crates' sources. Fixes #38875 Fixes #38875. This is a follow-up to #42507. When a (now correctly translated) span from an external crate is referenced in a error, warning or info message, we still don't have the source code being referenced. Since stuffing the source in the serialized metadata of an rlib is extremely wasteful, the following scheme has been implemented: * File maps now contain a source hash that gets serialized as well. * When a span is rendered in a message, the source hash in the corresponding file map(s) is used to try and load the source from the corresponding file on disk. If the file is not found or the hashes don't match, the failed attempt is recorded (and not retried). * The machinery fetching source lines from file maps is augmented to use the lazily loaded external source as a secondary fallback for file maps belonging to external crates. This required a small change to the expected stderr of one UI test (it now renders a span, where previously was none). Further work can be done based on this - some of the machinery previously used to hide external spans is possibly obsolete and the hashing code can be reused in different places as well. r? @eddyb
2017-06-16Auto merge of #42690 - frewsxcv:rollup, r=frewsxcvbors-2/+5
Rollup of 5 pull requests - Successful merges: #42616, #42651, #42654, #42656, #42685 - Failed merges:
2017-06-15Position span label correctly when it isn't lastEsteban Küber-2/+5
2017-06-12External spans: address review.Inokentiy Babushkin-8/+5
* 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-11Suggest non-ambiguous comparison after castEsteban Küber-0/+4
``` warning: `<` is interpreted as a start of generic arguments for `usize`, not comparison --> $DIR/issue-22644.rs:16:33 | 16 | println!("{}", a as usize < b); | ^ expected one of `!`, `(`, `+`, `,`, `::`, or `>` here | help: if you want to compare the casted value then write | println!("{}", (a as usize) < b); ```
2017-06-11Added consumption logic for external sources in FileMapInokentiy Babushkin-7/+10
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-2/+5
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-06-04Auto merge of #42362 - estebank:type, r=arielb1bors-0/+8
Show trait method signature when impl differs When the trait's span is available, it is already being used, add a `note` for the cases where the span isn't available: <pre> error[E0053]: <b>method `fmt` has an incompatible type for trait</b> --> $DIR/trait_type.rs:17:4 | 17 | fn fmt(&self, x: &str) -> () { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability | = note: expected type `<b>fn(&MyType, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error></b>` found type `<b>fn(&MyType, &str)</b>` error[E0050]: <b>method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2</b> --> $DIR/trait_type.rs:21:11 | 21 | fn fmt(&self) -> () { } | ^^^^^ expected 2 parameters, found 1 | = note: `fmt` from trait: `<b>fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error></b>` error[E0186]: <b>method `fmt` has a `&self` declaration in the trait, but not in the impl</b> --> $DIR/trait_type.rs:25:4 | 25 | fn fmt() -> () { } | ^^^^^^^^^^^^^^^^^^ expected `&self` in impl | = note: `fmt` from trait: `<b>fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error></b>` error[E0046]: <b>not all trait items implemented, missing: `fmt`</b> --> $DIR/trait_type.rs:28:1 | 28 | impl std::fmt::Display for MyType4 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation | = note: `fmt` from trait: `<b>fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error></b>` </code></pre> Fix #28011.
2017-06-04Show trait method signature when impl differsEsteban Küber-0/+8
When the trait's span is available, it is already being used, add a `note` for the cases where the span isn't available: ``` error[E0053]: method `fmt` has an incompatible type for trait --> $DIR/trait_type.rs:17:4 | 17 | fn fmt(&self, x: &str) -> () { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability | = note: expected type `fn(&MyType, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` found type `fn(&MyType, &str)` error[E0050]: method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2 --> $DIR/trait_type.rs:21:11 | 21 | fn fmt(&self) -> () { } | ^^^^^ expected 2 parameters, found 1 | = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` error[E0186]: method `fmt` has a `&self` declaration in the trait, but not in the impl --> $DIR/trait_type.rs:25:4 | 25 | fn fmt() -> () { } | ^^^^^^^^^^^^^^^^^^ expected `&self` in impl | = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` error[E0046]: not all trait items implemented, missing: `fmt` --> $DIR/trait_type.rs:28:1 | 28 | impl std::fmt::Display for MyType4 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation | = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` ```
2017-05-31Use callsite's span for macro calls on suggestionEsteban Küber-5/+4
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-8/+6
2017-05-13Auto merge of #41965 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-88/+157
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-12Rollup merge of #41942 - tommyip:master, r=Mark-SimulacrumMark Simulacrum-1/+4
Fix unexpected panic with the -Z treat-err-as-bug option This fix an issue where the compiler panics even if there is no error when passed with the `-Z treat-err-as-bug` option. Fixes #35886. r? @Mark-Simulacrum
2017-05-12Rollup merge of #41934 - est31:remove_unused_macros, r=nagisaMark Simulacrum-15/+0
Remove unused macros from the codebase Thanks to the lint I've implemented in #41907 I've found some unused macros inside the rustc codebase.
2017-05-12Fix unexpected panic with the -Z treat-err-as-bug optionTommy Ip-1/+4
This fix an issue where the compiler panics even if there is no error when passed with the `-Z treat-err-as-bug` option. Fixes #35886.
2017-05-12Remove some unused macros from the rust codebaseest31-15/+0
Removes unused macros from: * libcore * libcollections The last use of these two macros was removed in commit b64c9d56700e2c41207166fe8709711ff02488ff when the char_range_at_reverse function was been removed. * librustc_errors Their last use was removed by commits 2f2c3e178325dc1837badcd7573c2c0905fab979 and 11dc974a38fd533aa692cea213305056cd3a6902. * libsyntax_ext * librustc_trans Also, put the otry macro in back/msvc/mod.rs under the same cfg argument as the places that use it.
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-35/+54
2017-05-10Example usage of multiple suggestionsOliver Schneider-10/+23
2017-05-10Refactor suggestion diagnostic API to allow for multiple suggestionsOliver Schneider-67/+116