Skip to content

Temporarily accept [i|u][32|size] suffixes on a tuple index and warn - #60186

Merged
bors merged 2 commits into
rust-lang:masterfrom
estebank:accept-suffix
Apr 24, 2019
Merged

bors merged 2 commits into
rust-lang:masterfrom
estebank:accept-suffix

Conversation

@estebank

@estebank estebank commented Apr 22, 2019 •

Copy link
Copy Markdown
Contributor

Fix #60138.

#59553 will need to be kept open to track the change back to rejecting this code a few versions down thee line.

@estebank estebank added I-nominated beta-nominated Nominated for backporting to the compiler in the beta channel. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 22, 2019
@rust-highfive

Copy link
Copy Markdown
Contributor

r? @petrochenkov

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 22, 2019
@estebank

Copy link
Copy Markdown
Contributor Author

I tried checking for only spans coming through the macro system, but because the error is pointing at the span for the proc macro itself, it is a regular span and we have no way to differentiate from regular field access.

The warning is unsilenceable on purpose.

@estebank

Copy link
Copy Markdown
Contributor Author

@nikomatsakis nikomatsakis left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

r=me if we link to the new issue I just filed

);
err.note(&format!(
"`{}` is *temporarily* accepted on tuple index fields as it was \
incorrectly accepted on stable for a few releases",

ghost Apr 23, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This affects my opinion, by the way -- what is the range of time in which it was accepted? I was assuming it has been accepted forever.

ghost Apr 23, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bisected (using godbolt) to 1.27 being the point at which it was allowed;
Test program:

fn main() {
    let x = (0,);
    x.0usize;
}

err.help(
"on proc macros, you'll want to use `syn::Index::from` or \
`proc_macro::Literal::*_unsuffixed` for code that will desugar \
to tuple field access",

ghost Apr 23, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 to giving some explicit help here!

Comment thread src/libsyntax/parse/parser.rs Outdated
@Centril

ghost commented Apr 23, 2019

Copy link
Copy Markdown
Contributor

r? @nikomatsakis

@estebank

ghost commented Apr 23, 2019

Copy link
Copy Markdown
Contributor Author

@bors r=nikomatsakis

@bors

ghost commented Apr 23, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit 4c01573 has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 23, 2019
@bors
bors merged commit 4c01573 into rust-lang:master Apr 24, 2019
@nagisa nagisa added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Apr 25, 2019
@emilyalbini emilyalbini removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Apr 26, 2019
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. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

suffixes on a tuple index are invalid

8 participants