Skip to content

regression: local ambiguity: multiple parsing options: built-in NTs lifetime  #70446

Closed

Activity

added
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Mar 26, 2020
added
E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
on Mar 26, 2020
Centril

Centril commented on Mar 26, 2020

@Centril
Contributor

Possibly accidentally injected by #70074.
Would be good to find out why this is happening, so let's @rustbot ping cleanup
and see if we can bisect / shrink the problem down to something usable for finding a fix.

Centril

Centril commented on Mar 26, 2020

@Centril
Contributor

@rustbot ping cleanup

rustbot

rustbot commented on Mar 26, 2020

@rustbot
Collaborator

Hey Cleanup Crew ICE-breakers! This bug has been identified as a good
"Cleanup ICE-breaking candidate". In case it's useful, here are some
instructions for tackling these sorts of bugs. Maybe take a look?
Thanks! <3

cc @AminArria @chrissimpkins @contrun @DutchGhost @elshize @ethanboxx @h-michael @HallerPatrick @hdhoang @hellow554 @imtsuki @jakevossen5 @kanru @KarlK90 @LeSeulArtichaut @MAdrianMattocks @matheus-consoli @mental32 @nmccarty @Noah-Kennedy @pard68 @PeytonT @pierreN @Redblueflame @RobbieClarken @RobertoSnap @robjtede @SarthakSingh31 @senden9 @shekohex @sinato @spastorino @turboladen @woshilapin @yerke

added
C-bugCategory: This is a bug.
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
on Mar 26, 2020
LeSeulArtichaut

LeSeulArtichaut commented on Mar 26, 2020

@LeSeulArtichaut
Contributor

Failed to confirm that #70074 is the cause:
tested 342c5f33d097b2dc07a2dbc0ca45a37379d2ff60, got Yes
Seems like it regressed prior to 342c5f3

AminArria

AminArria commented on Mar 26, 2020

@AminArria
Contributor
searched nightlies: from nightly-2020-02-26 to nightly-2020-03-04
regressed nightly: nightly-2020-02-29
searched commits: from https://github.com/rust-lang/rust/commit/6d69caba110c0c2fb90180df1cbc8be5033b91d4 to https://github.com/rust-lang/rust/commit/0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb
regressed commit: https://github.com/rust-lang/rust/commit/0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb

For code I used:

use pin_project_lite::pin_project;

pin_project! {
    pub struct Struct<T: 'static> {
        field: T
    }
}


fn main() {

}
LeSeulArtichaut

LeSeulArtichaut commented on Mar 26, 2020

@LeSeulArtichaut
Contributor

@rustbot modify labels: -E-needs-bisection

removed
E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
on Mar 26, 2020
LeSeulArtichaut

LeSeulArtichaut commented on Mar 26, 2020

@LeSeulArtichaut
Contributor
steffahn

steffahn commented on Mar 26, 2020

@steffahn
Member

Reduced example:

macro_rules! m {
          (          $(: $p:path)? : $l:lifetime)
    => {m!{@internal $(: $p     )? : $l         }};

          (@internal $(: $p:path)? : $l:lifetime) => {};
}

m! {: 'static}

fn main() {}

(Playground)

Errors:

   Compiling playground v0.0.1 (/playground)
error: local ambiguity: multiple parsing options: built-in NTs lifetime ('l') or path ('p').
 --> src/main.rs:3:38
  |
3 |     => {m!{@internal $(: $p     )? : $l         }};
  |                                      ^^
...
8 | m! {: 'static}
  | -------------- in this macro invocation
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

error: could not compile `playground`.

To learn more, run the command again with --verbose.

LeSeulArtichaut

LeSeulArtichaut commented on Mar 26, 2020

@LeSeulArtichaut
Contributor

Split the macro in two parts to make it easier to follow, and removed the special lifetime 'static:

macro_rules! foo {
    ($(: $p:path)?  $(: $l:lifetime)? ) => { bar! {$(: $p)?  $(: $l)?  } };
}

macro_rules! bar {
    ($(: $p:path)?  $(: $l:lifetime)? ) => {};
}

foo! {: 'a }

(Playground)

Error:

error: local ambiguity: multiple parsing options: built-in NTs lifetime ('l') or path ('p').
  --> src/lib.rs:2:66
   |
2  |     ($(: $p:path)?  $(: $l:lifetime)? ) => { bar! {$(: $p)?  $(: $l)?  } };
   |                                                                  ^^
...
10 | foo! {: 'a }
   | ------------ in this macro invocation
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

I think we can now @rustbot modify labels: -E-needs-mcve

removed
E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
on Mar 26, 2020
LeSeulArtichaut

LeSeulArtichaut commented on Mar 26, 2020

@LeSeulArtichaut
Contributor

I believe that the most probable culprit is #69384, cc @petrochenkov

self-assigned this
on Mar 27, 2020
LeSeulArtichaut

LeSeulArtichaut commented on Mar 27, 2020

@LeSeulArtichaut
Contributor

#69384 is indeed the culprit, I can reproduce the bug on b2605c1

spastorino

spastorino commented on Apr 1, 2020

@spastorino
Member

This was briefly discussed during pre-triage. Assigning P-high for now until we have a better understanding of what's going on.

petrochenkov

petrochenkov commented on Apr 4, 2020

@petrochenkov
Contributor

Fixed in #70768.

removed their assignment
on Apr 4, 2020
added a commit that references this issue on Apr 5, 2020

Rollup merge of rust-lang#70768 - petrochenkov:macambig, r=Centril,ma…

d0dda18
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, ..)C-bugCategory: This is a bug.ICEBreaker-Cleanup-CrewHelping to "clean up" bugs with minimal examples and bisectionsP-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @spastorino@Centril@jonas-schievink@AminArria@steffahn

      Issue actions

        regression: local ambiguity: multiple parsing options: built-in NTs lifetime · Issue #70446 · rust-lang/rust