about summary refs log tree commit diff
path: root/src/test/ui/binop
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-1595/+0
2022-12-13Stop pointing to operators if their libcore method source is not availableOli Scherer-52/+12
2022-12-13Inform the user which trait is meant in the diagnostic itself instead of ↵Oli Scherer-10/+10
relying on the span making it obvious
2022-12-13Make some diagnostics not depend on the source of what they reference being ↵Oli Scherer-66/+40
available
2022-12-05Tweak "the following other types implement trait"Esteban Küber-8/+3
When *any* of the suggested impls is an exact match, *only* show the exact matches. This is particularly relevant for integer types. fix fmt
2022-11-23Suggest `.clone()` or `ref binding` on E0382Esteban Küber-0/+4
2022-10-19Generalize call suggestion for unsatisfied predicateMichael Goulet-1/+1
2022-10-19Standardize arg suggestions between typeck and trait selectionMichael Goulet-1/+1
2022-09-26address reviewb-naber-8/+8
2022-09-08Avoid source-map call in operator errorMichael Goulet-1/+1
2022-09-04Rollup merge of #100647 - obeis:issue-99875, r=nagisaMatthias Krüger-1/+1
Make trait bound not satisfied specify kind Closes #99875
2022-08-29Make the trait bound is not satisfied specify kindObei Sideg-1/+1
2022-08-28More descriptive argument placeholdersMichael Goulet-2/+2
2022-08-28Suggest calling when operator types mismatchMichael Goulet-0/+5
2022-07-01Shorten def_span for more items.Camille GILLOT-95/+35
2022-06-28Remove redundant logic to suggest `as_ref`Michael Goulet-2/+14
2022-05-17Taking review into accountricked-twice-10/+4
2022-04-26Move some tests to more reasonable placesCaio-0/+43
2022-04-25Replace suggest_constraining_param with suggest_restricting_param_boundWill Crichton-0/+36
to fix incorrect suggestion for trait bounds involving binary operators. Fixes #93927, #92347, #93744.
2022-04-04Refer to the TraitRef::identity in the message to be clearerEsteban Kuber-4/+4
2022-04-04Dedup logic and improve output for other types that impl traitEsteban Kuber-17/+17
2022-04-04Fix list lengthEsteban Kuber-0/+20
2022-04-04Mention implementers of unsatisfied traitEsteban Kuber-0/+30
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-02-16Make implementation genericLucas Kent-8/+8
2021-12-14test should pass :sweat_smile:ouz-a-0/+1
2021-12-14Add regression test and commentouz-a-0/+8
2021-11-18Move some tests to more reasonable directoriesCaio-0/+136
2021-11-14Move some tests to more reasonable directoriesCaio-0/+72
2021-11-06Move some tests to more reasonable directoriesCaio-0/+30
2021-10-15Bless testsCameron Steffen-2/+2
2021-10-05Consider unfulfilled obligations in binop errorsEsteban Kuber-15/+198
When encountering a binop where the types would have been accepted, if all the predicates had been fulfilled, include information about the predicates and suggest appropriate `#[derive]`s if possible. Point at trait(s) that needs to be `impl`emented.
2021-09-25Use larger span for adjustments on method callsAaron Hill-1/+1
Currently, we use a relatively 'small' span for THIR expressions generated by an 'adjustment' (e.g. an autoderef, autoborrow, unsizing). As a result, if a borrow generated by an adustment ends up causing a borrowcheck error, for example: ```rust let mut my_var = String::new(); let my_ref = &my_var my_var.push('a'); my_ref; ``` then the span for the mutable borrow may end up referring to only the base expression (e.g. `my_var`), rather than the method call which triggered the mutable borrow (e.g. `my_var.push('a')`) Due to a quirk of the MIR borrowck implementation, this doesn't always get exposed in migration mode, but it does in many cases. This commit makes THIR building consistently use 'larger' spans for adjustment expressions The intent of this change it make it clearer to users when it's the specific way in which a variable is used (for example, in a method call) that produdes a borrowcheck error. For example, an error message claiming that a 'mutable borrow occurs here' might be confusing if it just points at a usage of a variable (e.g. `my_var`), when no `&mut` is in sight. Pointing at the entire expression should help to emphasize that the method call itself is responsible for the mutable borrow. In several cases, this makes the `#![feature(nll)]` diagnostic output match up exactly with the default (migration mode) output. As a result, several `.nll.stderr` files end up getting removed entirely.
2021-08-11Modify structured suggestion outputEsteban Küber-23/+23
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-06-16Update test stderr filesAris Merchant-5/+0
2021-05-12Show macro name in 'this error originates in macro' messageAaron Hill-2/+2
When there are multiple macros in use, it can be difficult to tell which one was responsible for producing an error.
2021-02-14Apply suggestionsBenoît du Garreau-2/+5
- Move `assert_failed` to core::panicking` - Make `assert_failed` use an enum instead of a string
2021-01-16Move some tests to more reasonable directories - 2Caio-0/+216
Address comments Update limits
2020-12-31Move binop-related testsYuki Okushi-0/+155
2020-12-21Move test from compile-fail to ui/binopDonough Liu-0/+57
2020-10-17Improve wording of "cannot multiply" type errorCamelid-2/+18
For example, if you had this code: fn foo(x: i32, y: f32) -> f32 { x * y } You would get this error: error[E0277]: cannot multiply `f32` to `i32` --> src/lib.rs:2:7 | 2 | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul<f32>` is not implemented for `i32` However, that's not usually how people describe multiplication. People usually describe multiplication like how the division error words it: error[E0277]: cannot divide `i32` by `f32` --> src/lib.rs:2:7 | 2 | x / y | ^ no implementation for `i32 / f32` | = help: the trait `Div<f32>` is not implemented for `i32` So that's what this change does. It changes this: error[E0277]: cannot multiply `f32` to `i32` --> src/lib.rs:2:7 | 2 | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul<f32>` is not implemented for `i32` To this: error[E0277]: cannot multiply `i32` by `f32` --> src/lib.rs:2:7 | 2 | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul<f32>` is not implemented for `i32`
2020-09-02pretty: trim paths of unique symbolsDan Aloni-4/+4
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-07-27mv std libs to library/mark-11/+11
2020-06-26Explain move errors that occur due to method calls involving `self`Aaron Hill-17/+74
This is a re-attempt of #72389 (which was reverted in #73594) Instead of using `ExpnKind::Desugaring` to represent operators, this PR checks the lang item directly.
2020-06-22Revert "Rollup merge of #72389 - Aaron1011:feature/move-fn-self-msg, ↵Aaron Hill-74/+17
r=nikomatsakis" This reverts commit 372cb9b69c76a042d0b9d4b48ff6084f64c84a2c, reversing changes made to 5c61a8dc34c3e2fc6d7f02cb288c350f0233f944.
2020-06-11Explain move errors that occur due to method calls involving `self`Aaron Hill-17/+74
2020-05-08Skip tests on emscriptenYuki Okushi-0/+2
2020-05-06Move tests from `test/run-fail` to UIYuki Okushi-0/+21
2020-03-29Tweak `suggest_constraining_type_param`Esteban Küber-88/+66
Some of the bound restriction structured suggestions were incorrect while others had subpar output.
2020-02-17Do not emit note suggesting to implement trait to foreign typeLeSeulArtichaut-6/+0
Update tests Extend to other operations Refractor check in a separate function Fix more tests
2020-02-09Improve reporting errors and suggestions for trait boundsPatryk Wychowaniec-66/+154