about summary refs log tree commit diff
path: root/src/librustc_errors/diagnostic.rs
AgeCommit message (Collapse)AuthorLines
2018-05-20introducing `span_suggestion_short_with_applicability`Zack M. Davis-0/+17
Some would argue that this 40-character method name is ludicrously unwieldy (even ironic), but it's the unique continuation of the precedent set by the other suggestion methods. (And there is some hope that someday we'll just fold `Applicability` into the signature of the "basic" method `span_suggestion`.) This is in support of #50723.
2018-04-25Approximate -> ApplicabilityManish Goregaokar-10/+10
2018-04-24Use enum for approximate suggestionsManish Goregaokar-7/+10
2018-01-29Add approximate suggestions for rustfixManish Goregaokar-0/+37
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
2018-01-22Only emit expanded diagnostic information onceEsteban Küber-1/+5
2018-01-03Only bump error count when we are sure that the diagnostic is not a repetition.Rafael Fernández López-3/+0
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
2017-11-16Remove left over dead code from suggestion diagnostic refactoringOliver Schneider-4/+3
2017-11-03Refactor internal suggestion APIOliver Schneider-10/+17
2017-11-02Make the difference between lint codes and error codes explicitOliver Schneider-3/+9
2017-10-26Auto merge of #45519 - michaelwoerister:dedup-errors, r=arielb1bors-2/+2
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-2/+2
2017-10-24Update docs for Diagnostic::span_suggestion(s)Oliver Schneider-0/+2
2017-09-29fix comment typo, `CodeSuggestion` path in doc commentZack M. Davis-2/+2
`CodeSuggestion` doesn't live in the `diagnostic` module.
2017-08-28Initial diagnostic API for proc-macros.Sergio Benitez-1/+1
This commit introduces the ability to create and emit `Diagnostic` structures from proc-macros, allowing for proc-macro authors to emit warning, error, note, and help messages just like the compiler does.
2017-08-19rustc: Remove some dead codeVadim Petrochenkov-12/+0
2017-08-17Rollup merge of #43891 - Fourchaux:master, r=steveklabnikCorey Farwell-2/+2
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-9/+9
Like #43008 (f668999), but _much more aggressive_.
2017-08-15Fix typos & us spellingsFourchaux-2/+2
2017-07-23Auto merge of #43096 - estebank:ascription-help, r=nikomatsakisbors-0/+18
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-17Add flag to hide code on inline suggestionsEsteban Küber-0/+18
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-0/+12
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-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-11Address PR reviewsOliver Schneider-2/+9
2017-05-10Refactor suggestion diagnostic API to allow for multiple suggestionsOliver Schneider-6/+12
2017-05-08Remove need for &format!(...) or &&"" dances in `span_label` callsOliver Schneider-3/+2
2017-04-25Minimize single span suggestions into a noteOliver Schneider-14/+10
2017-04-11Highlight and simplify mismatched typesEsteban Küber-12/+60
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-02-02store typeck lints in the `TypeckTables`Niko Matsakis-2/+2
Otherwise they are a "hidden output"
2017-01-17Teach Diagnostics to highlight textEsteban Küber-7/+49
2016-11-01pacify the mercilous tidyNiko Matsakis-0/+10
2016-11-01improve early lint to use multispan from diagnosticNiko Matsakis-2/+2
2016-11-01compare-method lintNiko Matsakis-8/+2
2016-11-01retool EarlyLint to track a DiagnosticNiko Matsakis-0/+8
2016-11-01separate Diagnostic from DiagnosticBuilderNiko Matsakis-0/+190