Michael Goulet
b09c177743
Don't leak unnameable types in -> _ recover
2024-04-14 11:43:05 -04:00
Esteban Küber
d97d2fe744
Mention when the type of the moved value doesn't implement Clone
2024-04-11 16:41:42 +00:00
Esteban Küber
a1a3abb08f
When possible, suggest cloning the result of a call instead of an argument
...
```
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-11 16:41:41 +00:00
Esteban Küber
5a7caa3174
Fix accuracy of T: Clone check in suggestion
2024-04-11 16:41:41 +00:00
Esteban Küber
bce78102c3
Account for unops when suggesting cloning
2024-04-11 16:41:41 +00:00
Esteban Küber
fa2fc3ab96
Suggest .clone() when moved while borrowed
2024-04-11 16:41:41 +00:00
Esteban Küber
6b24fdf811
Provide structured suggestion for unconstrained generic constant
...
```
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-21 00:03:59 +00:00
Oli Scherer
96d24f2dd1
Revert "Auto merge of #122140 - oli-obk:track_errors13, r=davidtwco"
...
This reverts commit 65cd843ae0 , reversing
changes made to d255c6a57c .
2024-03-11 21:28:16 +00:00
Oli Scherer
e2e751e76d
Merge various rustc_attr based tests
2024-03-11 08:48:03 +00:00
Oli Scherer
8206cffc48
Merge check_mod_impl_wf and check_mod_type_wf
2024-03-07 06:27:09 +00:00
许杰友 Jieyou Xu (Joe)
ec2cc761bc
[AUTO-GENERATED] Migrate ui tests from // to //@ directives
2024-02-16 20:02:50 +00:00
León Orell Valerian Liehr
02320b502d
Improve the diagnostics for unused generic parameters
2024-02-01 16:18:03 +01:00
Nilstrieb
41e8d152dc
Show number in error message even for one error
...
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24 19:15:52 +01:00
jyn
01b75e20f2
Move some UI tests into subdirectories
...
to avoid going over the existing limit now that the ui-fulldeps tests have
been moved to ui.
2023-04-02 19:42:30 -04:00
Ali MJ Al-Nasrawy
381187dc76
internally change regions to be covariant
2023-01-27 04:04:22 +03:00
Matthias Krüger
9e3f330656
Rollup merge of #106897 - estebank:issue-99430, r=davidtwco
...
Tweak E0597
CC #99430
2023-01-25 22:19:52 +01:00
Ezra Shaw
708861e5b7
remove error code from #[rustc_variance] and document its remains
2023-01-18 21:10:27 +13:00
Esteban Küber
656db98bd9
Tweak E0597
...
CC #99430
2023-01-15 19:46:20 +00:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests
2023-01-11 09:32:08 +00:00