about summary refs log tree commit diff
path: root/src/test/ui/block-result
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-397/+0
2022-10-04slightly improve no return for returning function errorRageking8-5/+5
2022-08-26Rollup merge of #99064 - lyming2007:issue-97687-fix, r=estebankYuki Okushi-1/+1
distinguish the method and associated function diagnostic information Methods are defined within the context of a struct and their first parameter is always self Associated functions don’t take self as a parameter ``` modified: compiler/rustc_typeck/src/check/method/suggest.rs modified: src/test/ui/auto-ref-slice-plus-ref.stderr modified: src/test/ui/block-result/issue-3563.stderr modified: src/test/ui/issues/issue-28344.stderr modified: src/test/ui/suggestions/dont-suggest-pin-array-dot-set.stderr modified: src/test/ui/suggestions/suggest-methods.stderr modified: src/test/ui/traits/trait-upcasting/subtrait-method.stderr ```
2022-08-18Reword "Required because of the requirements on the impl of ..."Andy Wang-1/+1
2022-07-08distinguish the method and associated function diagnostic informationYiming Lei-1/+1
Methods are defined within the context of a struct and their first parameter is always self Associated functions don’t take self as a parameter modified: compiler/rustc_typeck/src/check/method/suggest.rs modified: src/test/ui/auto-ref-slice-plus-ref.stderr modified: src/test/ui/block-result/issue-3563.stderr modified: src/test/ui/issues/issue-28344.stderr modified: src/test/ui/suggestions/dont-suggest-pin-array-dot-set.stderr modified: src/test/ui/suggestions/suggest-methods.stderr modified: src/test/ui/traits/trait-upcasting/subtrait-method.stderr
2022-07-07Shorten span for closures.Camille GILLOT-1/+1
2022-06-16diagnostics: fix trailing spaceklensy-1/+1
2022-04-10only suggest removing semicolon when expr implements traitMichael Goulet-5/+5
2022-04-04Mention implementers of unsatisfied traitEsteban Kuber-2/+1
When encountering an unsatisfied trait bound, if there are no other suggestions, mention all the types that *do* implement that trait: ``` error[E0277]: the trait bound `f32: Foo` is not satisfied --> $DIR/impl_wf.rs:22:6 | LL | impl Baz<f32> for f32 { } | ^^^^^^^^ the trait `Foo` is not implemented for `f32` | = help: the following other types implement trait `Foo`: Option<T> i32 str note: required by a bound in `Baz` --> $DIR/impl_wf.rs:18:31 | LL | trait Baz<U: ?Sized> where U: Foo { } | ^^^ required by this bound in `Baz` ``` Mention implementers of traits in `ImplObligation`s. Do not mention other `impl`s for closures, ranges and `?`.
2022-03-27Change wording of missing return type suggestionEsteban Kuber-1/+1
2021-10-15Bless testsCameron Steffen-4/+26
2021-08-11Modify structured suggestion outputEsteban Küber-4/+5
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-07-30Use multispan suggestions more oftenEsteban Küber-4/+5
* Use more accurate span for `async move` suggestion * Use more accurate span for deref suggestion * Use `multipart_suggestion` more often
2021-04-06Point at `impl` and type defs introducing requirements on E0277Esteban Küber-1/+5
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