Skip to content

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

Closed
@RalfJung

Description

@RalfJung
Member

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.tiyicn.workers.dev-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.tiyicn.workers.dev-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.

Activity

added
A-resolveArea: Name/path resolution done by `rustc_resolve` specifically
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
C-bugCategory: This is a bug.
on Jul 10, 2019
Mark-Simulacrum

Mark-Simulacrum commented on Jul 10, 2019

@Mark-Simulacrum
Member

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

petrochenkov

petrochenkov commented on Jul 10, 2019

@petrochenkov
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

petrochenkov commented on Jul 10, 2019

@petrochenkov
Contributor

Fixed in #62574.

gbenattar

gbenattar commented on Jul 11, 2019

@gbenattar

Can we get an update?

dtolnay

dtolnay commented on Jul 11, 2019

@dtolnay
Member

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.

33 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @pnkfelix@RalfJung@jonas-schievink@dtolnay@Mark-Simulacrum

    Issue actions

      serde no longer builds with latest rustc (master) · Issue #62562 · rust-lang/rust