about summary refs log tree commit diff
path: root/tests/ui/binop
AgeCommit message (Collapse)AuthorLines
2025-07-04Rollup merge of #143299 - Kivooeo:tf24, r=tgross35Jubilee-0/+15
`tests/ui`: A New Order [24/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? `@tgross35`
2025-07-05cleaned up some testsKivooeo-3/+2
2025-07-05moved & deleted testsKivooeo-0/+76
opeq.rs was removed as duplicating test logic in other tests
2025-07-05cleaned up some testsKivooeo-1/+10
2025-07-01moved testsKivooeo-0/+6
2025-06-22Implement DesugaringKind::FormatLiteralmejrs-2/+1
2025-04-30compiletest: Make diagnostic kind mandatory on line annotationsVadim Petrochenkov-5/+7
2025-04-19tests: adjust some `augmented-assignment*` testsJieyou Xu-0/+193
- `tests/ui/augmented-assignment-feature-gate-cross.rs`: - This was *originally* to feature-gate overloaded OpAssign cross-crate, but now let's keep it as a smoke test. - Renamed as `augmented-assignment-cross-crate.rs`. - Relocated under `tests/ui/binop/`. - `tests/ui/augmented-assignments.rs`: - Documented test intent. - Moved under `tests/ui/borrowck/`. - `tests/ui/augmented-assignment-rpass.rs`: - Renamed to drop the `-rpass` suffix, since this was leftover from when `run-pass` test suite was a thing. - Moved under `tests/ui/binop/`.
2025-04-03compiletest: Require `//~` annotations even if `error-pattern` is specifiedVadim Petrochenkov-7/+4
2025-02-21More sophisticated span trimmingMichael Goulet-3/+2
2025-02-10Show diff suggestion format on verbose replacementEsteban Küber-2/+3
``` error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 | LL | let _ = 2.l; | ^ | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | LL - let _ = 2.l; LL + let _ = 2.0f64; | ```
2025-02-06Remove some unnecessary parens in `assert!` conditionsEsteban Küber-22/+22
While working on #122661, some of these started triggering our "unnecessary parens" lints due to a change in the `assert!` desugaring. A cursory search identified a few more. Some of these have been carried from before 1.0, were a bulk rename from the previous name of `assert!` left them in that state. I went and removed as many of these unnecessary parens as possible in order to have fewer annoyances in the future if we make the lint smarter.
2025-01-23tests: use `needs-subprocess` instead of `ignore-{wasm32,emscripten,sgx}`许杰友 Jieyou Xu (Joe)-2/+2
2024-12-07Mention type parameter in more cases and don't suggest ~const bound already ↵Esteban Küber-13/+13
there
2024-12-07Use trait name instead of full constraint in suggestion messageEsteban Küber-1/+1
``` help: consider restricting type parameter `T` with traits `Copy` and `Trait` | LL | fn duplicate_custom<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) { | ++++++++++++++ ``` ``` help: consider restricting type parameter `V` with trait `Copy` | LL | fn index<'a, K, V: std::marker::Copy>(map: &'a HashMap<K, V>, k: K) -> &'a V { | +++++++++++++++++++ ```
2024-12-07reword trait bound suggestion message to include the boundsEsteban Küber-23/+23
2024-12-02Allow fn pointers comparisons lint in UI testsUrgau-0/+3
2024-10-29Remove detail from label/note that is already available in other noteEsteban Küber-8/+8
Remove the "which is required by `{root_obligation}`" post-script in "the trait `X` is not implemented for `Y`" explanation in E0277. This information is already conveyed in the notes explaining requirements, making it redundant while making the text (particularly in labels) harder to read. ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ``` vs the prior ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ```
2024-09-22Don't call const normalize in error reportingMichael Goulet-28/+28
2024-07-26Peel off explicit (or implicit) deref before suggesting clone on move error ↵Michael Goulet-2/+2
in borrowck
2024-06-25Change E0369 diagnostic give note information for foreign items.surechen-0/+96
Make it easy for developers to understand why the binop cannot be applied. fixes #125631
2024-06-12Spell out other trait diagnosticAlex Macleod-32/+32
2024-05-23Only suppress binop error in favor of semicolon suggestion if we're in an ↵Michael Goulet-0/+43
assignment statement
2024-04-24Mention when type parameter could be `Clone`Esteban Küber-0/+181
``` error[E0382]: use of moved value: `t` --> $DIR/use_of_moved_value_copy_suggestions.rs:7:9 | LL | fn duplicate_t<T>(t: T) -> (T, T) { | - move occurs because `t` has type `T`, which does not implement the `Copy` trait ... LL | (t, t) | - ^ value used here after move | | | value moved here | help: if `T` implemented `Clone`, you could clone the value --> $DIR/use_of_moved_value_copy_suggestions.rs:4:16 | LL | fn duplicate_t<T>(t: T) -> (T, T) { | ^ consider constraining this type parameter with `Clone` ... LL | (t, t) | - you could clone this value help: consider restricting type parameter `T` | LL | fn duplicate_t<T: Copy>(t: T) -> (T, T) { | ++++++ ``` The `help` is new. On ADTs, we also extend the output with span labels: ``` error[E0507]: cannot move out of static item `FOO` --> $DIR/issue-17718-static-move.rs:6:14 | LL | let _a = FOO; | ^^^ move occurs because `FOO` has type `Foo`, which does not implement the `Copy` trait | note: if `Foo` implemented `Clone`, you could clone the value --> $DIR/issue-17718-static-move.rs:1:1 | LL | struct Foo; | ^^^^^^^^^^ consider implementing `Clone` for this type ... LL | let _a = FOO; | --- you could clone this value help: consider borrowing here | LL | let _a = &FOO; | + ```
2024-04-12Auto merge of #123736 - compiler-errors:multiply-on-rhs, r=estebankbors-0/+24
Don't delay a bug if we suggest adding a semicolon to the RHS of an assign operator It only makes sense to delay a bug based on the assumption that "[we] defer to the later error produced by `check_lhs_assignable`" *if* the expression we're erroring actually is an LHS; otherwise, we should still report the error since it's both useful and required. Fixes #123722
2024-04-10Handle more cases of value suggestionsEsteban Küber-4/+4
2024-04-10Don't delay a bug if we suggest adding a semicolon to the RHS of an assign ↵Michael Goulet-0/+24
operator
2024-04-09Tweak value suggestions in `borrowck` and `hir_analysis`Esteban Küber-4/+4
Unify the output of `suggest_assign_value` and `ty_kind_suggestion`. Ideally we'd make these a single function, but doing so would likely require modify the crate dependency tree.
2024-03-28Add basic trait impls for `f16` and `f128`Trevor Gross-3/+3
Split off part of <https://github.com/rust-lang/rust/pull/122470> so the compiler doesn't ICE because it expects primitives to have some minimal traits. Fixes <https://github.com/rust-lang/rust/issues/123074>
2024-03-27Use `TraitRef::to_string` sorting in favor of `TraitRef::ord`, as the latter ↵Oli Scherer-33/+33
compares `DefId`s which we need to avoid
2024-03-11Revert "Auto merge of #122140 - oli-obk:track_errors13, r=davidtwco"Oli Scherer-26/+26
This reverts commit 65cd843ae06ad00123c131a431ed5304e4cd577a, reversing changes made to d255c6a57c393db6221b1ff700daea478436f1cd.
2024-03-11Run a single huge `par_body_owners` instead of many small ones after each other.Oli Scherer-26/+26
This improves parallel rustc parallelism by avoiding the bottleneck after each individual `par_body_owners` (because it needs to wait for queries to finish, so if there is one long running one, a lot of cores will be idle while waiting for the single query).
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-22/+22
2024-02-09Move some testsCaio-0/+30
2024-02-08Continue to borrowck even if there were previous errorsOli Scherer-6/+33
2024-01-30Provide more context on derived obligation error primary labelEsteban Küber-8/+8
Expand the primary span of E0277 when the immediate unmet bound is not what the user wrote: ``` error[E0277]: the trait bound `i32: Bar` is not satisfied --> f100.rs:6:6 | 6 | <i32 as Foo>::foo(); | ^^^ the trait `Bar` is not implemented for `i32`, which is required by `i32: Foo` | help: this trait has no implementations, consider adding one --> f100.rs:2:1 | 2 | trait Bar {} | ^^^^^^^^^ note: required for `i32` to implement `Foo` --> f100.rs:3:14 | 3 | impl<T: Bar> Foo for T {} | --- ^^^ ^ | | | unsatisfied trait bound introduced here ``` Fix #40120.
2024-01-12Fix ICE when suggesting dereferencing binop operandssjwang05-1/+30
2024-01-03Make `derive(Trait)` suggestion more accurateEsteban Küber-5/+0
Only suggest `derive(PartialEq)` when both LHS and RHS types are the same, otherwise the suggestion is not useful.
2023-12-16Provide better suggestions for T == &T and &T == Tsjwang05-13/+364
2023-11-24Show number in error message even for one errorNilstrieb-13/+13
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-13Suggest lhs deref for binopssjwang05-0/+30
2023-11-06Silence redundant error on typo resulting on binopEsteban Küber-18/+15
2023-10-27Detect misparsed binop caused by missing semiEsteban Küber-0/+40
When encountering ```rust foo() *bar = baz; ``` We currently emit potentially two errors, one for the return type of `foo` not being multiplyiable by the type of `bar`, and another for `foo() * bar` not being assignable. We now check for this case and suggest adding a semicolon in the right place. Fix #80446.
2023-08-01Improve diagnostic for wrong borrow on binary operationsUrgau-0/+190
2023-07-10Do not set up wrong span for adjustmentsMichael Goulet-1/+1
2023-06-27Don't sort strings right after we just sorted by typesMichael Goulet-26/+26
2023-04-27Provide RHS type hint when reporting operator errorMichael Goulet-32/+98
2023-04-12Tweak output for 'add line' suggestionEsteban Küber-6/+12
2023-01-30Improved wording of error messages of missing remainder implementationsMatthias Kaak-5/+5
2023-01-27Fixed confusement between mod and remainderMatthias Kaak-5/+5