Skip to content

regression 1.52 - proc-macro-hack panic #84136

Closed
@Mark-Simulacrum

Description

@Mark-Simulacrum
Member

proc-macro-hack is panicking[1] on beta 1.52 in some cases where it wasn't before:

My guess is this might have something to do with the usize-suffixed tuple indices, but I'm not sure. It seems to be new behavior on beta; I don't know whether this is caused by any of the recently landed macro-related patches, but it seems not impossible.

[1]: This is my belief, as it's the only repository in the dependency tree to contain the 'source.starts_with(prefix)' string in its source code (based on cargo vendor).

cc @Aaron1011 @petrochenkov @dtolnay

edit - some more cases:

Activity

added
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
on Apr 12, 2021
added this to the 1.52.0 milestone on Apr 12, 2021
added
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Apr 12, 2021
Aaron1011

Aaron1011 commented on Apr 12, 2021

@Aaron1011
Member

It looks like the pretty-printing assumptions made by an older version of proc-macro-back have stopped holding. Running cargo update -p proc-macro-hack in one of the failing crates fixed the panic for me.

Mark-Simulacrum

Mark-Simulacrum commented on Apr 12, 2021

@Mark-Simulacrum
MemberAuthor

This seems pretty widespread (edit: 57 cases, of which 10 are crates.io crates) - I found at least 5-6 more repositories in crater, though not too many actual crates. Is there an easy way for us to continue having the same pretty printing? I know we don't generally guarantee stability there, and it looks like there's a pretty easy upgrade path, so if not that seems OK (but we'll want to mention it in release notes).

dtolnay

dtolnay commented on Apr 12, 2021

@dtolnay
Member

dtolnay/proc-macro-hack@4df5a94 fixed the whitespace sensitivity for 0.4.3. I have not looked at the build logs but it sounds like the failures are things pinned to an old patch version of 0.4? If so, I would be inclined to close this.

Mark-Simulacrum

Mark-Simulacrum commented on Apr 12, 2021

@Mark-Simulacrum
MemberAuthor

Yeah, things using 0.4.1 - 57 repositories is not small, and most of these are just tiny self-projects I suspect, so I agree that we can likely close if there's not a trivial fix (probably not, based on the scope of the breakage).

petrochenkov

petrochenkov commented on Apr 12, 2021

@petrochenkov
Contributor

I remember fixing this in the past by tweaking pretty-printing (#63897), not sure what change caused pretty-printing to change again.

apiraino

apiraino commented on Apr 14, 2021

@apiraino
Contributor

Removing I-prioritize as these panics seems to be solved by upgrading the library (but in case it helps, let's assign a priority).

@rustbot label -I-prioritize

removed
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Apr 14, 2021

10 remaining items

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.relnotesMarks issues that should be documented in the release notes of the next release.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Aaron1011@dtolnay@pietroalbini@Mark-Simulacrum@petrochenkov

        Issue actions

          regression 1.52 - proc-macro-hack panic · Issue #84136 · rust-lang/rust