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

Prevent where < ident > from parsing. #38268

Merged
merged 4 commits into from
Dec 24, 2016

Conversation

withoutboats
Copy link
Contributor

In order to be forward compatible with where<'a> syntax for higher
rank parameters, prevent potential conflicts with UFCS from parsing
correctly for the near term.

In order to be forward compatible with `where<'a>` syntax for higher
rank parameters, prevent potential conflicts with UFCS from parsing
correctly for the near term.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@withoutboats
Copy link
Contributor Author

This is my first PR to rustc! 🎉

I think this is correct, though I don't have any idea at all what error message to issue in this case.

See also rust-lang/rfcs#1598 for background on this change. cc @rust-lang/lang

r? @eddyb

@rust-highfive rust-highfive assigned eddyb and unassigned nikomatsakis Dec 9, 2016
*t == token::Gt || *t == token::Comma || *t == token::Colon
});
if gt_comma_or_colon {
return Err(self.fatal("TODO How to even explain this error?"));
Copy link
Contributor

@petrochenkov petrochenkov Dec 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a recoverable error, no need to return Err.
self.err("syntax `where<T>` is reserved for future use"); would be more appropriate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consume tokens until the the next Gt in that case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, if it's indeed <A>::B: Tr (more likely), then it'll parse successfully without consuming extra tokens, otherwise (less likely) it doesn't matter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But don't we want it to parse as ::B: Tr1? I suppose it doesn't matter much since it errors anyway.

@eddyb
Copy link
Member

eddyb commented Dec 10, 2016

LGTM, I'll start a crater run.

@eddyb eddyb added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Dec 10, 2016
@eddyb
Copy link
Member

eddyb commented Dec 10, 2016

@brson Looks like crater is busted again, build completes successfully but then:

mv: cannot stat 'rust/dist/rustc-*-x86_64-unknown-linux-gnu.tar.gz': No such file or directory

@withoutboats
Copy link
Contributor Author

Any update on crater?

This wants to land before the next beta is cut.

@eddyb
Copy link
Member

eddyb commented Dec 16, 2016

@withoutboats If you rebase I could try again, but I didn't hear back from @brson on this.

@withoutboats
Copy link
Contributor Author

Cool, I'll rebase when I get home tonight

@brson
Copy link
Contributor

brson commented Dec 16, 2016

@eddyb This is because of the change to rustbuild. Also changes to cargo's release process broke crater. So crater can neither build custom rustc nor install the latest cargo nightlies atm. I can't get to it this week I'm afraid, but next.

@brson
Copy link
Contributor

brson commented Dec 22, 2016

I'll crater.

@withoutboats
Copy link
Contributor Author

oops i forgot to rebase this, let me know if thats a problem

@brson
Copy link
Contributor

brson commented Dec 23, 2016

Crater says: https://gist.github.com/anonymous/4ad4a0abf91b713fa58d7771ad281de0

Looks like no regressions, 1 false positive.

@brson brson added the relnotes Marks issues that should be documented in the release notes of the next release. label Dec 23, 2016
@withoutboats
Copy link
Contributor Author

Awesome, what are the steps to landing & backporting this to 1.15 beta?

@aturon
Copy link
Member

aturon commented Dec 23, 2016

Since @eddyb already reviewed, it's ready for bors! I'll also nominate for backport.

@bors r=eddyb

@bors
Copy link
Contributor

bors commented Dec 23, 2016

📌 Commit 14e4b00 has been approved by eddyb

@aturon aturon added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Dec 23, 2016
@bors
Copy link
Contributor

bors commented Dec 24, 2016

⌛ Testing commit 14e4b00 with merge 8d65c8d...

bors added a commit that referenced this pull request Dec 24, 2016
…ddyb

Prevent where < ident > from parsing.

In order to be forward compatible with `where<'a>` syntax for higher
rank parameters, prevent potential conflicts with UFCS from parsing
correctly for the near term.
@bors bors merged commit 14e4b00 into rust-lang:master Dec 24, 2016
@nikomatsakis
Copy link
Contributor

Why do we want this on 1.15 beta?

@eddyb
Copy link
Member

eddyb commented Dec 30, 2016

Because in 1.15, one of my PRs made it so where <T>::Assoc: ... worked just as well as the form without <>, as HIR no longer distinguishes between the two - this information should've been in the description.

@nikomatsakis nikomatsakis added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Dec 30, 2016
@nikomatsakis
Copy link
Contributor

OK, marking as beta-accepted. cc @rust-lang/compiler

@nikomatsakis nikomatsakis mentioned this pull request Jan 6, 2017
17 tasks
@alexcrichton alexcrichton removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jan 6, 2017
bors added a commit that referenced this pull request Jan 14, 2018
syntax: Rewrite parsing of impls

Properly parse impls for the never type `!`
Recover from missing `for` in `impl Trait for Type`
Prohibit inherent default impls and default impls of auto traits (#37653 (comment), #37653 (comment))
Change wording in more diagnostics to use "auto traits"
Fix some spans in diagnostics
Some other minor code cleanups in the parser
Disambiguate generics and qualified paths in impls (parse `impl <Type as Trait>::AssocTy { ... }`)
Replace the future-compatibility hack from #38268 with actually parsing generic parameters
Add a test for #46438
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. relnotes Marks issues that should be documented in the release notes of the next release. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants