@@ -3766,6 +3766,45 @@ extern "platform-intrinsic" {
3766
3766
```
3767
3767
"## ,
3768
3768
3769
+ E0513 : r##"
3770
+ The type of the variable couldn't be found out.
3771
+
3772
+ Erroneous code example:
3773
+
3774
+ ```compile_fail,E0513
3775
+ use std::mem;
3776
+
3777
+ unsafe {
3778
+ let size = mem::size_of::<u32>();
3779
+ mem::transmute_copy::<u32, [u8; size]>(&8_8);
3780
+ // error: no type for local variable
3781
+ }
3782
+ ```
3783
+
3784
+ To fix this error, please use a constant size instead of `size`. To make
3785
+ this error more obvious, you could run:
3786
+
3787
+ ```compile_fail,E0080
3788
+ use std::mem;
3789
+
3790
+ unsafe {
3791
+ mem::transmute_copy::<u32, [u8; mem::size_of::<u32>()]>(&8_8);
3792
+ // error: constant evaluation error
3793
+ }
3794
+ ```
3795
+
3796
+ So now, you can fix your code by setting the size directly:
3797
+
3798
+ ```
3799
+ use std::mem;
3800
+
3801
+ unsafe {
3802
+ mem::transmute_copy::<u32, [u8; 4]>(&8_8);
3803
+ // `u32` is 4 bytes so we replace the `mem::size_of` call with its size
3804
+ }
3805
+ ```
3806
+ "## ,
3807
+
3769
3808
E0516 : r##"
3770
3809
The `typeof` keyword is currently reserved but unimplemented.
3771
3810
Erroneous code example:
@@ -4064,7 +4103,6 @@ register_diagnostics! {
4064
4103
E0399 , // trait items need to be implemented because the associated
4065
4104
// type `{}` was overridden
4066
4105
E0436 , // functional record update requires a struct
4067
- E0513 , // no type for local variable ..
4068
4106
E0521 , // redundant default implementations of trait
4069
4107
E0533 , // `{}` does not name a unit variant, unit struct or a constant
4070
4108
E0562 , // `impl Trait` not allowed outside of function
0 commit comments