about summary refs log tree commit diff
path: root/src/test/ui/block-result
AgeCommit message (Collapse)AuthorLines
2021-02-21Do not suggest `;` if expression is side effect freeEsteban Küber-3/+1
When a tail expression isn't unit, we previously always suggested adding a trailing `;` to turn it into a statement. This suggestion isn't appropriate for any expression that doesn't have side-effects, as the user will have likely wanted to call something else or do something with the resulting value, instead of just discarding it.
2021-02-21reword `;` suggestions to have consistent wordingEsteban Küber-1/+1
2020-09-28pretty.rs: Update Closure and Generator printAman Arora-1/+1
Co-authored-by: Dhruv Jauhar <dhruvjhr@gmail.com> Co-authored-by: Logan Mosier <logmosier@gmail.com>
2020-09-02pretty: trim paths of unique symbolsDan Aloni-9/+9
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-08-22Use smaller def span for functionsAaron Hill-9/+6
Currently, the def span of a funtion encompasses the entire function signature and body. However, this is usually unnecessarily verbose - when we are pointing at an entire function in a diagnostic, we almost always want to point at the signature. The actual contents of the body tends to be irrelevant to the diagnostic we are emitting, and just takes up additional screen space. This commit changes the `def_span` of all function items (freestanding functions, `impl`-block methods, and `trait`-block methods) to be the span of the signature. For example, the function ```rust pub fn foo<T>(val: T) -> T { val } ``` now has a `def_span` corresponding to `pub fn foo<T>(val: T) -> T` (everything before the opening curly brace). Trait methods without a body have a `def_span` which includes the trailing semicolon. For example: ```rust trait Foo { fn bar(); }``` the function definition `Foo::bar` has a `def_span` of `fn bar();` This makes our diagnostic output much shorter, and emphasizes information that is relevant to whatever diagnostic we are reporting. We continue to use the full span (including the body) in a few of places: * MIR building uses the full span when building source scopes. * 'Outlives suggestions' use the full span to sort the diagnostics being emitted. * The `#[rustc_on_unimplemented(enclosing_scope="in this scope")]` attribute points the entire scope body. * The 'unconditional recursion' lint uses the full span to show additional context for the recursive call. All of these cases work only with local items, so we don't need to add anything extra to crate metadata.
2020-07-02Audit uses of `span_suggestion_short`Yuki Okushi-12/+27
2020-04-24update_testsflip1995-2/+8
2020-04-11rustc: Add a warning count upon completionRoccoDev-1/+1
2020-03-12update testsMark Mansi-1/+1
2020-01-08Unify output of "variant not found" errorsEsteban Küber-2/+2
2019-12-30MatchExpressionArmPattern: Use more generic wording.Mazdak Farrokhzad-1/+1
The existing wording was inappropriate for e.g. `if let Ok(_) = expr { .. }`. The diagnostic would leak the fact that we desugar to a `match`.
2019-11-18Surround types with backticks in type errorsEsteban Küber-18/+18
2019-11-18Remove E0308 note when primary label has all infoEsteban Küber-42/+1
2019-11-18review comments: tweak prefix stringsEsteban Küber-28/+28
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-19/+19
2019-08-09review comments: typo and rewordingEsteban Küber-5/+5
2019-08-09review comment: review wording or missing return errorEsteban Küber-5/+5
2019-08-09Tweak wording of fn without explicit returnEsteban Küber-5/+5
2019-08-09Change wording for function without return valueEsteban Küber-5/+5
Fix #62677
2019-07-17normalize use of backticks in compiler messages for librustc/lintSamy Kacimi-1/+1
https://github.com/rust-lang/rust/issues/60532
2019-07-06Make WhileTrue into an EarlyLintPass lint.Mazdak Farrokhzad-1/+9
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-2/+2
2019-04-09improve unknown enum variant errorsAndy Russell-1/+1
2019-03-11Update testsVadim Petrochenkov-13/+13
2019-03-02Suggest removal of `&` when borrowing macro and appropriateEsteban Küber-1/+4
Fix #58815.
2019-01-20Use structured suggestion in stead of notesEsteban Küber-3/+1
2019-01-12Reword label as per review commentEsteban Küber-1/+1
2019-01-12Point at the match discriminant when arm pattern has a type mismatchEsteban Küber-0/+2
2018-12-30Tweak E0308 error for clarityEsteban Küber-5/+5
2018-12-30Point at function name spanEsteban Küber-5/+15
2018-12-30Point at the return type span on type mismatch due to missing returnEsteban Küber-44/+30
Do not point at the entire block span on fn return type mismatches caused by missing return.
2018-12-25Remove licensesMark Rousskov-138/+18
2018-12-24make non_camel_case_types an early lintAndy Russell-2/+2
2018-11-10in which the E0618 "expected function" diagnostic gets a makeoverZack M. Davis-2/+10
Now the main span focuses on the erroneous not-a-function callee, while showing the entire call expression is relegated to a secondary span. In the case where the erroneous callee is itself a call, we point out the definition, and, if the call expression spans multiple lines, tentatively suggest a semicolon (because we suspect that the "outer" call is actually supposed to be a tuple). The new `bug!` assertion is, in fact, safe (`confirm_builtin_call` is only called by `check_call`, which is only called with a first arg of kind `ExprKind::Call` in `check_expr_kind`). Resolves #51055.
2018-10-23fix typos in various placesMatthias Krüger-1/+1
2018-03-14update testsGuillaume Gomez-14/+14
2018-02-26Update UI testsVadim Petrochenkov-4/+4
2018-02-26Update UI testsVadim Petrochenkov-40/+40
2018-02-25Update ui testsGuillaume Gomez-0/+14
2018-01-15Further tweaks to the outputEsteban Küber-1/+1
- Properly address Variant Ctors - Show signature if span of trait method without `self` is not available
2017-12-14Remove NOTE/HELP annotations from UI testsVadim Petrochenkov-10/+10
2017-11-24Merge cfail and ui tests into ui testsOliver Schneider-6/+5
2017-11-18move the signature into the closure typeNiko Matsakis-12/+1
2017-09-21Add suggestions for misspelled method namesThomas Jespersen-0/+2
Use the syntax::util::lev_distance module to provide suggestions when a named method cannot be found. Part of #30197
2017-08-09Readd backticks around ()Esteban Küber-4/+4
2017-08-08Only refer to return type when it matchesEsteban Küber-4/+4
2017-07-25Point at return type always when type mismatch against itEsteban Küber-0/+9
Before this, the diagnostic errors would only point at the return type when changing it would be a possible solution to a type error. Add a label to the return type without a suggestion to change in order to make the source of the expected type obvious. Follow up to #42850, fixes #25133, fixes #41897.
2017-07-21Adjust new suggestions to the suggestion guidelinesOliver Schneider-2/+2
2017-07-06Only underline suggestion if it is not the only code being shownEsteban Küber-2/+6
2017-07-02report the total number of errors on compilation failureAriel Ben-Yehuda-12/+12
Prior to this PR, when we aborted because a "critical pass" failed, we displayed the number of errors from that critical pass. While that's the number of errors that caused compilation to abort in *that place*, that's not what people really want to know. Instead, always report the total number of errors, and don't bother to track the number of errors from the last pass that failed. This changes the compiler driver API to handle errors more smoothly, and therefore is a compiler-api-[breaking-change]. Fixes #42793.