Skip to content

Commit e70a1d2

Browse files
committed
Document RustcEncodable/RustcDecodable
1 parent 7ffa639 commit e70a1d2

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

src/rust-2024/prelude.md

+27-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ More information may be found in the tracking issue at <https://github.com/rust-
77

88
- The [`Future`] and [`IntoFuture`] traits are now part of the prelude.
99
- This might make calls to trait methods ambiguous which could make some code fail to compile.
10+
- `RustcEncodable` and `RustcDecodable` have been removed from the prelude.
1011

1112
[`Future`]: ../../std/future/trait.Future.html
1213
[`IntoFuture`]: ../../std/future/trait.IntoFuture.html
@@ -26,10 +27,24 @@ However, adding a _trait_ to the prelude can break existing code in a subtle way
2627
For example, a call to `x.poll()` which comes from a `MyPoller` trait might fail to compile if `std`'s `Future` is also imported, because the call to `poll` is now ambiguous and could come from either trait.
2728

2829
As a solution, Rust 2024 will use a new prelude.
29-
It's identical to the current one, except for two new additions:
30+
It's identical to the current one, except for the following changes:
3031

31-
- [`std::future::Future`][`Future`]
32-
- [`std::future::IntoFuture`][`IntoFuture`]
32+
- Added:
33+
- [`std::future::Future`][`Future`]
34+
- [`std::future::IntoFuture`][`IntoFuture`]
35+
- Removed:
36+
- `RustcEncodable`
37+
- `RustcDecodable`
38+
39+
### `RustcEncodable` and `RustcDecodable` removal
40+
41+
`RustcEncodable` and `RustcDecodable` are two undocumented derive macros that have been removed from the prelude.
42+
These were deprecated before Rust 1.0, but remained within the standard library prelude.
43+
The 2024 Edition has removed these from the prelude since they are not expected to be used.
44+
45+
If in the unlikely case there is a project still using these, it is recommended to switch to a serialization library, such as those found on [crates.io].
46+
47+
[crates.io]: https://crates.io/categories/encoding
3348

3449
## Migration
3550

@@ -67,3 +82,12 @@ fn main() {
6782
<_ as MyPoller>::poll(&core::pin::pin!(async {}));
6883
}
6984
```
85+
86+
#### `RustcEncodable` and `RustcDecodable`
87+
88+
It is strongly recommended that you migrate to a different serialization library if you are still using these.
89+
However, these derive macros are still available in the standard library, they are just required to be imported from the older prelude now:
90+
91+
```rust,edition2021
92+
use core::prelude::v1::{RustcDecodable, RustcEncodable};
93+
```

0 commit comments

Comments
 (0)