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

Maybe Regression: failing to parse serde macros #76520

Closed
elichai opened this issue Sep 9, 2020 · 2 comments
Closed

Maybe Regression: failing to parse serde macros #76520

elichai opened this issue Sep 9, 2020 · 2 comments
Labels
C-bug Category: This is a bug.

Comments

@elichai
Copy link
Contributor

elichai commented Sep 9, 2020

I'm not sure if this is a regression in nightly, or older serde_derive code did something weird that broke under a new compiler, but this code compiles on stable but fails on nightly:

lib.rs:

extern crate serde;
#[macro_use]
extern crate serde_derive;
use serde::Serializer;

pub fn serialize<S: Serializer>(_: &(), _: S) -> Result<S::Ok, S::Error> {
    panic!("");
}

#[derive(Serialize, Deserialize)]
struct Test {
    #[serde(serialize_with = "::serialize")]
    pub amt: (),
}

Cargo.toml:

[package]
name = "newweird"
version = "0.1.0"

[dependencies]
serde = { version = "1" }
serde_derive = { version = "<1.0.99" }

output:

$ rustc --version
$ cargo check
    Checking serde v1.0.115
    Checking newweird v0.1.0 (/home/elichai2/gits/newweird)
    Finished dev [unoptimized + debuginfo] target(s) in 3.52s

$ rustc +nightly --version
rustc 1.48.0-nightly (5099914a1 2020-09-08)
$ cargo +nightly check
    Checking serde v1.0.115
    Checking newweird v0.1.0 (/home/elichai2/gits/newweird)
error: failed to parse path: "::serialize"
  --> src/lib.rs:12:30
   |
12 |     #[serde(serialize_with = "::serialize")]
   |                              ^^^^^^^^^^^^^

error: aborting due to previous error

error: could not compile `newweird`.

To learn more, run the command again with --verbose.
@ehuss
Copy link
Contributor

ehuss commented Sep 9, 2020

I suspect this is the same as #76399.

@elichai
Copy link
Contributor Author

elichai commented Sep 11, 2020

It seems that #76556 fixed this (I no longer get those errors)

@elichai elichai closed this as completed Sep 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants