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

serde no longer builds with latest rustc (master) #62562

Closed
RalfJung opened this issue Jul 10, 2019 · 10 comments · Fixed by #62574
Closed

serde no longer builds with latest rustc (master) #62562

RalfJung opened this issue Jul 10, 2019 · 10 comments · Fixed by #62574
Assignees
Labels
A-resolve Area: Name resolution C-bug Category: This is a bug. P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@RalfJung
Copy link
Member

RalfJung commented Jul 10, 2019

Looks like something that landed in the commit range 0b680cf...d4e1565 broke building serde:

error[E0433]: failed to resolve: unresolved import
   --> /home/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_derive-1.0.94/src/internals/ast.rs:142:44
    |
142 |     variants: &'a Punctuated<syn::Variant, Token![,]>,
    |                                            ^^^^^^^^^
    |                                            |
    |                                            unresolved import
    |                                            help: a similar path exists: `syn::token`
    |
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error[E0433]: failed to resolve: unresolved import
   --> /home/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_derive-1.0.94/src/internals/ast.rs:187:40
    |
187 |     fields: &'a Punctuated<syn::Field, Token![,]>,
    |                                        ^^^^^^^^^
    |                                        |
    |                                        unresolved import
    |                                        help: a similar path exists: `syn::token`
    |
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

I would try to reproduce locally but rustup-toolchain-install-master takes many hours to download rustc+libstd currently. (This bug is not yet on nightly, just in master.)

Here's a prior succeeding build for reference.

@jonas-schievink jonas-schievink added A-resolve Area: Name resolution I-nominated regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Jul 10, 2019
@Mark-Simulacrum
Copy link
Member

This is #62393 almost certainly. @petrochenkov plans to investigate.

@petrochenkov
Copy link
Contributor

Minimized and reproduced.

#62393 broke something unexpected - macro encoding in metadata, which is also done through pretty-printing at the moment (note that this is not a proper way to encode macro definitions, we don't have cross-crate hygiene due to this).

Nested macros in particular become broken in metadata:

macro_rules! generate_exported { () => {
    #[macro_export]
    macro_rules! exported {
        () => ($crate::S)
    }
}}

generate_exported!();

I still need to investigate why exactly this happens though, printing for metadata is done by tts_to_string which was supposed to print $crate as $crate without any conversions.

@petrochenkov
Copy link
Contributor

Fixed in #62574.

@gbenattar
Copy link

gbenattar commented Jul 11, 2019

Can we get an update?

@dtolnay
Copy link
Member

dtolnay commented Jul 11, 2019

It will take a day or two for the bug to be fixed in nightly. I would recommend using an older nightly for now; nightly-2019-07-10 or older should work.

@AlterionX
Copy link

serde-rs/serde#1568 actually, one more day before that, nightly-2019-07-09

@dtolnay
Copy link
Member

dtolnay commented Jul 11, 2019

nightly-2019-07-10 does work. The version reported by the compiler binary is off by one. The first broken nightly is nightly-2019-07-11 which contains "rustc 1.38.0-nightly (cd2cd4c 2019-07-10)".

@AlterionX
Copy link

Ah, okay, my bad.

@pnkfelix
Copy link
Member

triage: P-high, has PR (#62574), assigning to @petrochenkov and removing nomination.

@pnkfelix pnkfelix added P-high High priority and removed I-nominated labels Jul 11, 2019
SimonSapin added a commit to SimonSapin/rust that referenced this issue Jul 11, 2019
This branch is based before rust-lang#62574,
so that rust-lang#62562 can be reproduced.
This should succeed when merged into `master`.
@dtolnay
Copy link
Member

dtolnay commented Jul 11, 2019

Pinning for visibility until a new nightly is out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Name resolution C-bug Category: This is a bug. P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants