Skip to content

possible regression: expected value, found module self #50799

Closed
@ignatenkobrain

Description

@ignatenkobrain

serde 0.8 fails to build with

---- src/ser/mod.rs - ser::Serializer::serialize_bytes (line 175) stdout ----
	error[E0424]: expected value, found module `self`
 --> src/ser/mod.rs:176:22
  |
3 | let mut state = try!(self.serialize_seq(value));
  |                      ^^^^ `self` value is only available in methods with `self` parameter
error[E0425]: cannot find value `value` in this scope
 --> src/ser/mod.rs:176:41
  |
3 | let mut state = try!(self.serialize_seq(value));
  |                                         ^^^^^ not found in this scope
error[E0425]: cannot find value `value` in this scope
 --> src/ser/mod.rs:177:10
  |
4 | for b in value {
  |          ^^^^^ not found in this scope
error[E0424]: expected value, found module `self`
 --> src/ser/mod.rs:178:10
  |
5 |     try!(self.serialize_seq_elt(&mut state, b));
  |          ^^^^ `self` value is only available in methods with `self` parameter
error[E0424]: expected value, found module `self`
 --> src/ser/mod.rs:180:1
  |
7 | self.serialize_seq_end(state)
  | ^^^^ `self` value is only available in methods with `self` parameter
error[E0308]: mismatched types
 --> src/ser/mod.rs:176:17
  |
3 | let mut state = try!(self.serialize_seq(value));
  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `std::result::Result`
  |
  = note: expected type `()`
             found type `std::result::Result<_, _>`
  = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

This is coming from doctest, so I'm not sure if it's a regression or expected behavior:

    /// Enables serializers to serialize byte slices more compactly or more
    /// efficiently than other types of slices. If no efficient implementation
    /// is available, a reasonable implementation would be to forward to
    /// `serialize_seq`. If forwarded, the implementation looks usually just like this:
    /// ```rust
    /// let mut state = try!(self.serialize_seq(value));
    /// for b in value {
    ///     try!(self.serialize_seq_elt(&mut state, b));
    /// }
    /// self.serialize_seq_end(state)
    /// ```
    fn serialize_bytes(&mut self, value: &[u8]) -> Result<(), Self::Error>;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions