File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
src/librustc_error_codes/error_codes Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 1- This error indicates that a pointer to a trait type cannot be implicitly
2- dereferenced by a pattern. Every trait defines a type, but because the
3- size of trait implementers isn't fixed, this type has no compile-time size.
4- Therefore, all accesses to trait types must be through pointers. If you
5- encounter this error you should try to avoid dereferencing the pointer.
1+ A trait type has been dereferenced.
2+
3+ Erroneous code example:
64
75``` compile_fail,E0033
86# trait SomeTrait { fn method_one(&self){} fn method_two(&self){} }
@@ -17,7 +15,13 @@ trait_obj.method_one();
1715trait_obj.method_two();
1816```
1917
18+ A pointer to a trait type cannot be implicitly dereferenced by a pattern. Every
19+ trait defines a type, but because the size of trait implementers isn't fixed,
20+ this type has no compile-time size. Therefore, all accesses to trait types must
21+ be through pointers. If you encounter this error you should try to avoid
22+ dereferencing the pointer.
23+
2024You can read more about trait objects in the [ Trait Objects] section of the
2125Reference.
2226
23- [ Trait Objects ] : https://doc.rust-lang.org/reference/types.html#trait-objects
27+ [ Trait Objects ] : https://doc.rust-lang.org/reference/types.html#trait-objects
You can’t perform that action at this time.
0 commit comments