diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/cast/issue-84213.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0605.stderr | 7 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-22289.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-22312.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-2995.stderr | 7 | ||||
| -rw-r--r-- | src/test/ui/mismatched_types/cast-rfc0401.stderr | 7 |
6 files changed, 22 insertions, 7 deletions
diff --git a/src/test/ui/cast/issue-84213.stderr b/src/test/ui/cast/issue-84213.stderr index a76aac58013..3c43427fa17 100644 --- a/src/test/ui/cast/issue-84213.stderr +++ b/src/test/ui/cast/issue-84213.stderr @@ -4,7 +4,7 @@ error[E0605]: non-primitive cast: `Something` as `*const Something` LL | let _pointer_to_something = something as *const Something; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid cast | -help: borrow the value for the cast to be valid +help: consider borrowing the value | LL | let _pointer_to_something = &something as *const Something; | ^ @@ -15,7 +15,7 @@ error[E0605]: non-primitive cast: `Something` as `*mut Something` LL | let _mut_pointer_to_something = something as *mut Something; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid cast | -help: borrow the value for the cast to be valid +help: consider borrowing the value | LL | let _mut_pointer_to_something = &mut something as *mut Something; | ^^^^ diff --git a/src/test/ui/error-codes/E0605.stderr b/src/test/ui/error-codes/E0605.stderr index 43269c095d6..6314e7a3a8a 100644 --- a/src/test/ui/error-codes/E0605.stderr +++ b/src/test/ui/error-codes/E0605.stderr @@ -8,7 +8,12 @@ error[E0605]: non-primitive cast: `*const u8` as `&u8` --> $DIR/E0605.rs:6:5 | LL | v as &u8; - | ^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object + | ^^^^^^^^ invalid cast + | +help: consider borrowing the value + | +LL | &*v as &u8; + | ^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-22289.stderr b/src/test/ui/issues/issue-22289.stderr index 60027853609..f90e89efb4a 100644 --- a/src/test/ui/issues/issue-22289.stderr +++ b/src/test/ui/issues/issue-22289.stderr @@ -4,7 +4,7 @@ error[E0605]: non-primitive cast: `i32` as `&(dyn Any + 'static)` LL | 0 as &dyn std::any::Any; | ^^^^^^^^^^^^^^^^^^^^^^^ invalid cast | -help: borrow the value for the cast to be valid +help: consider borrowing the value | LL | &0 as &dyn std::any::Any; | ^ diff --git a/src/test/ui/issues/issue-22312.stderr b/src/test/ui/issues/issue-22312.stderr index 823ffc6de6d..47ee544c02a 100644 --- a/src/test/ui/issues/issue-22312.stderr +++ b/src/test/ui/issues/issue-22312.stderr @@ -4,7 +4,7 @@ error[E0605]: non-primitive cast: `Self` as `&dyn Index<usize, Output = <Self as LL | let indexer = &(*self as &dyn Index<usize, Output = <Self as Index<usize>>::Output>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid cast | -help: borrow the value for the cast to be valid +help: consider borrowing the value | LL | let indexer = &(&*self as &dyn Index<usize, Output = <Self as Index<usize>>::Output>); | ^ diff --git a/src/test/ui/issues/issue-2995.stderr b/src/test/ui/issues/issue-2995.stderr index 9f5968399a3..b08fe8c7352 100644 --- a/src/test/ui/issues/issue-2995.stderr +++ b/src/test/ui/issues/issue-2995.stderr @@ -2,7 +2,12 @@ error[E0605]: non-primitive cast: `*const isize` as `&isize` --> $DIR/issue-2995.rs:2:22 | LL | let _q: &isize = p as &isize; - | ^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object + | ^^^^^^^^^^^ invalid cast + | +help: consider borrowing the value + | +LL | let _q: &isize = &*p as &isize; + | ^^ error: aborting due to previous error diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index 388c978d038..6a97d1ee3b8 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -24,7 +24,12 @@ error[E0605]: non-primitive cast: `*const u8` as `&u8` --> $DIR/cast-rfc0401.rs:29:13 | LL | let _ = v as &u8; - | ^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object + | ^^^^^^^^ invalid cast + | +help: consider borrowing the value + | +LL | let _ = &*v as &u8; + | ^^ error[E0605]: non-primitive cast: `*const u8` as `E` --> $DIR/cast-rfc0401.rs:30:13 |
