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

Remove suffix from MetaItemLit #120705

Closed
wants to merge 3 commits into from

Conversation

camsteffen
Copy link
Contributor

...as well as StrLit for which I believe it is always None. Otherwise, I believe the only functional change is in ast pretty printing where 1_u32 may change to 1u32.

@rustbot
Copy link
Collaborator

rustbot commented Feb 6, 2024

r? @davidtwco

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 6, 2024
@rustbot
Copy link
Collaborator

rustbot commented Feb 6, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@@ -1791,7 +1787,7 @@ impl StrLit {
StrStyle::Cooked => token::Str,
StrStyle::Raw(n) => token::StrRaw(n),
};
token::Lit::new(token_kind, self.symbol, self.suffix)
token::Lit::new(token_kind, self.symbol, None)
Copy link
Contributor

Choose a reason for hiding this comment

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

Whether this can be merged depends on the use of this function an its MetaItemLit equivalent.

Without this change the conversion "token -> ast -> token" was lossless for literals, but now it is lossy.

Copy link
Member

Choose a reason for hiding this comment

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

Both are used in macros.

@camsteffen
Copy link
Contributor Author

camsteffen commented Feb 6, 2024

I found a couple usages in rustfmt where unfortunately this may change behavior for a very specific case - formatting hex literals. I tried to verify this with a rustfmt test but ./x test src/tools/rustfmt doesn't seem to run the source/target tests?

Edit: Oh well I'll just commit the test.

@rustbot
Copy link
Collaborator

rustbot commented Feb 6, 2024

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

@Centri3
Copy link
Member

Centri3 commented Feb 6, 2024

I found a couple usages in rustfmt where unfortunately this may change behavior for a very specific case - formatting hex literals. I tried to verify this with a rustfmt test but ./x test src/tools/rustfmt doesn't seem to run the source/target tests?

Edit: Oh well I'll just commit the test.

clippy parses the suffix manually in cases where it's necessary from the literal's span. Not sure if rustfmt can/should do this tho - just the first thing that came to mind if it does change

@bors
Copy link
Contributor

bors commented Feb 15, 2024

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

@jieyouxu
Copy link
Member

jieyouxu commented Apr 8, 2024

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 8, 2024
@calebcartwright
Copy link
Member

I tried to verify this with a rustfmt test but ./x test src/tools/rustfmt doesn't seem to run the source/target tests?

It definitely should and has previously in my experience. If you want to confirm locally then doing something like adding a comment within any of the "before" files under source should trigger a failure

@Dylan-DPC
Copy link
Member

@camsteffen any updates on this? thanks

@oskgo
Copy link
Contributor

oskgo commented Jul 18, 2024

@camsteffen

Ping from triage: I'm closing this due to inactivity, Please reopen when you are ready to continue with this.
Note: if you are going to continue please open the PR BEFORE you push to it, else you won't be able to reopen - this is a quirk of github.
Thanks for your contribution.

@rustbot label: +S-inactive

@rustbot rustbot added the S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. label Jul 18, 2024
@Dylan-DPC Dylan-DPC closed this Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.