Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible regression: expected value, found module self #50799

Closed
ignatenkobrain opened this issue May 16, 2018 · 2 comments
Closed

possible regression: expected value, found module self #50799

ignatenkobrain opened this issue May 16, 2018 · 2 comments

Comments

@ignatenkobrain
Copy link

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>;
@ishitatsuyuki
Copy link
Contributor

Duplicate of #28712.

Working as intended.

@SergioBenitez
Copy link
Contributor

SergioBenitez commented May 16, 2018

This is not a duplicate of #28712. They aren't related, except that the code block should be separated for rustdoc to run it.

Nonetheless, that code block isn't valid Rust, so it won't compile regardless. That is, the error message is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants