Unit variant of externally tagged enum cannot be deserialized from the string
token by itself. It is ContentDeserializer + serde_test::Deserializer that makes
this possible, because serde_test::Deserializer produces Content::Str() from
Token::BorrowedStr() and ContentDeserializer produces unit variant from Content::Str().
The following tokens all produces Content::String(variant):
- Token::String(variant)
- Token::Str(variant)
- Token::UnitVariant { variant, .. }
Token::BorrowedStr(variant) produces Content::Str(variant) that was the real purpose to
use it in test in #933. This actually makes this test testing `Content` rather than type itself.
Correct way to represent enum one of:
- [xxxVariant { .. }]
- [Enum { .. }, xxxVariant { variant, .. }]
- [Enum { .. }, String(variant), <variant content>]
- [Enum { .. }, Str(variant), <variant content>]
- [Enum { .. }, BorrowedStr(variant), <variant content>]
error: the feature `lang_items` is internal to the compiler or standard library
--> src/main.rs:1:12
|
1 | #![feature(lang_items, start)]
| ^^^^^^^^^^
|
= note: using it is strongly discouraged
= note: `#[deny(internal_features)]` on by default
These are previous names of the `__private` module -- first
`serde::export` then `serde::private` then `serde::__private` -- in all
cases marked `doc(hidden)` and documented as not public API. Leaving a
tombstone made rustc give a better diagnostic "module is private" rather
than "unresolved import". But the rename to `__private` was 2.5 years
ago in dd1f4b483e so it's unlikely anyone
is still benefiting from the tombstone at this point.
In 1.72+, this is fixed by https://github.com/rust-lang/rust/pull/112086.
error[E0659]: `core` is ambiguous
--> serde/src/lib.rs:227:13
|
227 | pub use core::ffi::CStr;
| ^^^^ ambiguous name
|
= note: ambiguous because of multiple potential import sources
= note: `core` could refer to a built-in crate
= help: use `::core` to refer to this crate unambiguously
note: `core` could also refer to the module defined here
--> serde/src/lib.rs:166:5
|
166 | / mod core {
167 | | #[cfg(not(feature = "std"))]
168 | | pub use core::*;
169 | | #[cfg(feature = "std")]
170 | | pub use std::*;
171 | | }
| |_____^
= help: use `self::core` to refer to this module unambiguously