about summary refs log tree commit diff
path: root/tests/ui/variance
AgeCommit message (Collapse)AuthorLines
2025-09-29Make replacement suggestion `_` in type verboseEsteban Küber-4/+7
``` error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/in-signature.rs:6:21 | LL | fn arr_fn() -> [u8; _] { | ^ not allowed in type signatures | help: replace with the correct return type | LL - fn arr_fn() -> [u8; _] { LL + fn arr_fn() -> [u8; 3] { | ```
2025-06-30Check variances in the non-hir wfcheckerOli Scherer-8/+8
2025-06-09Make E0621 missing lifetime suggestion verboseEsteban Küber-3/+5
``` error[E0621]: explicit lifetime required in the type of `x` --> $DIR/42701_one_named_and_one_anonymous.rs:10:9 | LL | &*x | ^^^ lifetime `'a` required | help: add explicit lifetime `'a` to the type of `x` | LL | fn foo2<'a>(a: &'a Foo, x: &'a i32) -> &'a i32 { | ++ ```
2025-04-08UI tests: add missing diagnostic kinds where possibleVadim Petrochenkov-16/+16
2025-03-22Make UniqueArc invariant for soundnessFrank King-1/+43
2025-01-11Make UniqueRc invariant for soundnessFrank Steffahn-0/+42
2025-01-06`best_blame_constraint`: prioritize blaming interesting-seeming constraintsdianne-3/+3
2025-01-06`best_blame_constraint`: don't filter constraints by sup SCCdianne-5/+5
The SCCs of the region graph are not a reliable heuristic to use for blaming an interesting constraint for diagnostics. For region errors, if the outlived region is `'static`, or the involved types are invariant in their lifetiems, there will be cycles in the constraint graph containing both the target region and the most interesting constraints to blame. To get better diagnostics in these cases, this commit removes that heuristic.
2024-10-15Don't report bivariance error when nesting a struct with field errors into ↵Michael Goulet-0/+22
another struct
2024-08-23Print the generic parameter along with the variance in dumps.Camille GILLOT-64/+64
2024-07-26Peel off explicit (or implicit) deref before suggesting clone on move error ↵Michael Goulet-7/+6
in borrowck
2024-07-26Remove logic to suggest clone of function outputMichael Goulet-3/+7
2024-07-17Account for structs that have unused params in nested types in fieldsMichael Goulet-1/+18
2024-07-17Account for self ty aliasMichael Goulet-5/+19
2024-07-17Mention that type parameters are used recursivelyMichael Goulet-5/+7
2024-04-27tests: remove some trailing wsklensy-1/+1
2024-04-24Mention when type parameter could be `Clone`Esteban Küber-3/+12
``` 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-14Don't leak unnameable types in -> _ recoverMichael Goulet-0/+25
2024-04-11Mention when the type of the moved value doesn't implement `Clone`Esteban Küber-0/+18
2024-04-11When possible, suggest cloning the result of a call instead of an argumentEsteban Küber-4/+58
``` error[E0505]: cannot move out of `a` because it is borrowed --> $DIR/variance-issue-20533.rs:28:14 | LL | let a = AffineU32(1); | - binding `a` declared here LL | let x = foo(&a); | -- borrow of `a` occurs here LL | drop(a); | ^ move out of `a` occurs here LL | drop(x); | - borrow later used here | help: consider cloning the value if the performance cost is acceptable | LL | let x = foo(&a).clone(); | ++++++++ ```
2024-04-11Fix accuracy of `T: Clone` check in suggestionEsteban Küber-18/+0
2024-04-11Account for unops when suggesting cloningEsteban Küber-6/+9
2024-04-11Suggest `.clone()` when moved while borrowedEsteban Küber-0/+15
2024-03-21Provide structured suggestion for unconstrained generic constantEsteban Küber-1/+4
``` error: unconstrained generic constant --> $DIR/const-argument-if-length.rs:18:10 | LL | pad: [u8; is_zst::<T>()], | ^^^^^^^^^^^^^^^^^^^ | help: try adding a `where` bound | LL | pub struct AtLeastByte<T: ?Sized> where [(); is_zst::<T>()]: { | ++++++++++++++++++++++++++ ``` Detect when the constant expression isn't `usize` and suggest casting: ``` error: unconstrained generic constant --> f300.rs:6:10 | 6 | bb::<{!N}>(); | ^^^^ -Ztrack-diagnostics: created at compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs:3539:36 | help: try adding a `where` bound | 5 | fn b<const N: bool>() where [(); {!N} as usize]: { | ++++++++++++++++++++++++++ ``` Fix #122395.
2024-03-11Revert "Auto merge of #122140 - oli-obk:track_errors13, r=davidtwco"Oli Scherer-68/+68
This reverts commit 65cd843ae06ad00123c131a431ed5304e4cd577a, reversing changes made to d255c6a57c393db6221b1ff700daea478436f1cd.
2024-03-11Merge various rustc_attr based testsOli Scherer-68/+68
2024-03-07Merge `check_mod_impl_wf` and `check_mod_type_wf`Oli Scherer-11/+98
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-4/+4
2024-02-01Improve the diagnostics for unused generic parametersLeón Orell Valerian Liehr-27/+27
2023-11-24Show number in error message even for one errorNilstrieb-8/+8
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-04-02Move some UI tests into subdirectoriesjyn-0/+35
to avoid going over the existing limit now that the ui-fulldeps tests have been moved to ui.
2023-01-27internally change regions to be covariantAli MJ Al-Nasrawy-26/+26
2023-01-25Rollup merge of #106897 - estebank:issue-99430, r=davidtwcoMatthias Krüger-0/+6
Tweak E0597 CC #99430
2023-01-18remove error code from `#[rustc_variance]` and document its remainsEzra Shaw-41/+32
2023-01-15Tweak E0597Esteban Küber-0/+6
CC #99430
2023-01-11Move /src/test to /testsAlbert Larsan-0/+1810