about summary refs log tree commit diff
path: root/src/test/ui/binop
AgeCommit message (Collapse)AuthorLines
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
2019-12-12Update testsLeSeulArtichaut-3/+3
2019-12-12Update UI test expectationsLeSeulArtichaut-3/+3
2019-11-28Deduplicate type param constraint suggestion codeEsteban Küber-22/+22
2019-11-28Use structured suggestion when requiring `Copy` constraint in type paramEsteban Küber-34/+34
2019-11-18Surround types with backticks in type errorsEsteban Küber-4/+4
2019-11-18Remove E0308 note when primary label has all infoEsteban Küber-6/+0
2019-06-03Update tests for changes to cannot move errorsMatthew Jasper-6/+6
2019-04-22Remove double trailing newlinesvarkor-1/+0
2019-04-22update tests for migrate mode by defaultMatthew Jasper-415/+122
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-2/+2
2019-03-27Better diagnostic for binary operation on BoxedValueshgallagher1993-6/+12
2019-03-11Update NLL testsVadim Petrochenkov-38/+38
2019-03-11Update testsVadim Petrochenkov-38/+38
2019-01-24Fix --compare-mode=nll testsEsteban Küber-4/+261
2018-12-31Improve type mismatch error messagesYuning Zhang-2/+2
Replace "integral variable" with "integer" and replace "floating-point variable" with "floating-point number" to make the message less confusing.
2018-12-25Remove licensesMark Rousskov-113/+43
2018-11-05Make `ui/binop-move-semantics.rs` robust w.r.t. NLL.Felix S. Klock II-4/+30
2018-10-29Don't emit cannot move errors twice in migrate modeMatthew Jasper-13/+1
2018-10-17Update output for borrowck=migrate compare mode.David Wood-1/+13
This commit updates the test output for the updated NLL compare mode that uses `-Z borrowck=migrate` rather than `-Z borrowck=mir`. The previous commit changes `compiletest` and this commit only updates `.nll.stderr` files.
2018-10-03Clearer later use messages for callsMatthew Jasper-2/+2
Give a special message when the later use is from a call. Use the span of the callee instead of the whole expression. For conflicting borrow messages say that the later use is of the first borrow.
2018-08-14Merged migrated compile-fail tests and ui tests. Fixes #46841.David Wood-0/+651