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

syntax: Remove warning for unnecessary path disambiguators #57565

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
7 participants
@petrochenkov
Copy link
Contributor

petrochenkov commented Jan 13, 2019

rustfmt is now stable and it removes unnecessary turbofishes, so removing the warning as discussed in #43540 (where it was introduced).
One hardcoded warning less.

Closes #58055

r? @nikomatsakis

@petrochenkov petrochenkov force-pushed the petrochenkov:turbowarn branch from 5431e7b to 9f66ed6 Jan 13, 2019

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Jan 15, 2019

@rfcbot fcp merge

There used to be a hard-coded warning for unnecessary :: in a path (e.g., Vec::<u32> as a type). As @petrochenkov notes, this is no longer needed, since rustfmt will silently normalize this. In general, I favor using rustfmt over warnings to try and push minor stylistic nits -- far less annoying. But in this particular case, it would also be good, because this warning appears so early we can't easily use the standard lint system, so it cannot be "allowed" or "denied" etc. Therefore, I am in favor of merging this PR and removing the warning.

@rfcbot

This comment has been minimized.

Copy link

rfcbot commented Jan 15, 2019

Team member @nikomatsakis has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Jan 15, 2019

I feel that this style is distinctly unidiomatic and would therefore fit well into nonstandard_style; however, if that is exceedingly difficult to do well in the compiler (e.g. it would slow things down or incur very ugly hacks) I could be swayed to not lint anymore. Feels like a good topic to discuss on Thursday.

@terylmiller

This comment has been minimized.

Remove path

@Centril Centril removed the I-nominated label Jan 17, 2019

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Jan 17, 2019

@petrochenkov question -- can we set a flag in the resulting AST to indicate that an unnecessary :: was present, in which case we could make a "true lint", right?

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Jan 17, 2019

I'm still happy for rustfmt to silently normalize, but @cramertj feels like there is value in having a "teachable moment" here -- but it'd be nice if it were rustfix'able or something like that. I can certainly see that.

@petrochenkov

This comment has been minimized.

Copy link
Contributor Author

petrochenkov commented Jan 17, 2019

can we set a flag in the resulting AST to indicate that an unnecessary :: was present

Ugh, we can but that would at least increase the size of every path segment in AST.

The hardcoded warning can be converted into a lint without extending AST, but it will be attached to the crate root and only could be allowed/denyed at crate granularity.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Jan 18, 2019

The hardcoded warning can be converted into a lint without extending AST, but it will be attached to the crate root and only could be allowed/denyed at crate granularity.

Sure, but that seems pretty surprising. I guess it could be considered a long-standing bug.

Presumably we could do something where we record the span, too, and try to reproduce the node-id from that.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Jan 18, 2019

To be clear, I don't know that it's worth the effort.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Jan 18, 2019

Particularly not if we adopt the "remove turbofish" RFC, in which case... nobody would likely think to add :: in the first place.

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 21, 2019

☔️ The latest upstream changes (presumably #57792) made this pull request unmergeable. Please resolve the merge conflicts.

@rfcbot

This comment has been minimized.

Copy link

rfcbot commented Jan 26, 2019

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot

This comment has been minimized.

Copy link

rfcbot commented Feb 5, 2019

The final comment period, with a disposition to merge, as per the review above, is now complete.

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