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

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

Closed
Mark-Simulacrum opened this issue Mar 26, 2020 · 13 comments · Fixed by #70768
Closed

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

Mark-Simulacrum opened this issue Mar 26, 2020 · 13 comments · Fixed by #70768
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. ICEBreaker-Cleanup-Crew Helping to "clean up" bugs with minimal examples and bisections P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Mark-Simulacrum
Copy link
Member

https://crater-reports.s3.amazonaws.com/beta-1.43-1/beta-2020-03-12/reg/pin-project-lite-0.1.4/log.txt

cc @Centril

@Mark-Simulacrum Mark-Simulacrum added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Mar 26, 2020
@Centril Centril added E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Mar 26, 2020
@Centril
Copy link
Contributor

Centril commented Mar 26, 2020

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
Copy link
Contributor

Centril commented Mar 26, 2020

@rustbot ping cleanup

@rustbot
Copy link
Collaborator

rustbot commented Mar 26, 2020

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

@rustbot rustbot added the ICEBreaker-Cleanup-Crew Helping to "clean up" bugs with minimal examples and bisections label Mar 26, 2020
@jonas-schievink jonas-schievink added C-bug Category: This is a bug. A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) labels Mar 26, 2020
@LeSeulArtichaut
Copy link
Contributor

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

@AminArria
Copy link
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
Copy link
Contributor

@rustbot modify labels: -E-needs-bisection

@rustbot rustbot removed the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Mar 26, 2020
@LeSeulArtichaut
Copy link
Contributor

LeSeulArtichaut commented Mar 26, 2020

@steffahn
Copy link
Member

steffahn commented Mar 26, 2020

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
Copy link
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

@rustbot rustbot removed the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Mar 26, 2020
@LeSeulArtichaut
Copy link
Contributor

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

@petrochenkov petrochenkov self-assigned this Mar 27, 2020
@LeSeulArtichaut
Copy link
Contributor

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

@spastorino
Copy link
Member

spastorino commented Apr 1, 2020

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

@petrochenkov
Copy link
Contributor

Fixed in #70768.

@petrochenkov petrochenkov removed their assignment Apr 4, 2020
@bors bors closed this as completed in d0dda18 Apr 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. ICEBreaker-Cleanup-Crew Helping to "clean up" bugs with minimal examples and bisections P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. 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.

9 participants