1
Fork 0

Use short ty string for move errors

```
error[E0382]: use of moved value: `x`
  --> bay.rs:14:14
   |
12 | fn foo(x: D) {
   |        - move occurs because `x` has type `(((..., ..., ..., ...), ..., ..., ...), ..., ..., ...)`, which does not implement the `Copy` trait
13 |     let _a = x;
   |              - value moved here
14 |     let _b = x; //~ ERROR use of moved value
   |              ^ value used here after move
   |
   = note: the full type name has been written to 'bay.long-type-14349227078439097973.txt'
   = note: consider using `--verbose` to print the full type name to the console
help: consider cloning the value if the performance cost is acceptable
   |
13 |     let _a = x.clone();
   |               ++++++++
```
This commit is contained in:
Esteban Küber 2025-01-24 17:49:25 +00:00
parent 99768c80a1
commit 91b759354c
9 changed files with 93 additions and 8 deletions

View file

@ -459,17 +459,24 @@ pub(crate) enum OnClosureNote<'a> {
}
#[derive(Subdiagnostic)]
pub(crate) enum TypeNoCopy<'a, 'tcx> {
#[note(borrowck_long_type_full_path)]
#[note(borrowck_long_type_consider_verbose)]
pub(crate) struct LongTypePath {
pub(crate) path: String,
}
#[derive(Subdiagnostic)]
pub(crate) enum TypeNoCopy<'a> {
#[label(borrowck_ty_no_impl_copy)]
Label {
is_partial_move: bool,
ty: Ty<'tcx>,
ty: String,
place: &'a str,
#[primary_span]
span: Span,
},
#[note(borrowck_ty_no_impl_copy)]
Note { is_partial_move: bool, ty: Ty<'tcx>, place: &'a str },
Note { is_partial_move: bool, ty: String, place: &'a str },
}
#[derive(Diagnostic)]