Skip to content

Implement PROBLEMATIC_CONSTS generalization - #115253

Merged
bors merged 25 commits into
rust-lang:masterfrom
donno2048:patch-1
Apr 19, 2024
Merged

Implement PROBLEMATIC_CONSTS generalization #115253
bors merged 25 commits into
rust-lang:masterfrom
donno2048:patch-1

Conversation

@donno2048

@donno2048donno2048 commented Aug 26, 2023

Copy link
Copy Markdown
Contributor

View all comments

Better handling for problematic consts

The new PROBLEMATIC_CONSTS was generated using this code:

fromfunctoolsimportreducedefgenerate_problems(consts: list, letter_digit: dict):
forconstinconsts:
problem=reduce(lambdastring, rep: string.replace(*reversed(rep)), ['%X'%const, *letter_digit.items()])
indexes= [indexforindex, cinenumerate(problem) ifcinletter_digit.keys()]
foriinrange(1<<len(indexes)):
yieldint(''.join(letter_digit[c] ifindexinindexesand (i>>indexes.index(index)) &1elsecforindex, cinenumerate(problem)), 0x10)
problems=generate_problems(
[
# Old PROBLEMATIC_CONSTS:184594741, 2880289470, 2881141438, 2965027518, 2976579765, 3203381950, 3405691582, 3405697037,
3735927486, 3735932941, 4027431614, 4276992702,
# Some more that I've found195934910, 252707358, 762133, 179681982, 173390526
],
{
'A': '4',
'B': '8',
'E': '3',
}
)
# print(list(problems)) # won't use that to print formattedfromitertoolsimportislicewhilelen(cur_problems:=list(islice(problems, 8))):
print(' ', end='')
print(*cur_problems, sep=', ', end='')
print(',')

@rustbot

Copy link
Copy Markdown
Collaborator

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

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbotrustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Aug 26, 2023
@rust-log-analyzer

This comment has been minimized.

@dtolnaydtolnay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

Would it be possible to keep just the short list of root problematic consts, and then put your generate_problems logic into tidy, instead of expanding it all out like this?

That would be much more easily auditable.

@donno2048

Copy link
Copy Markdown
ContributorAuthor

@dtolnay I thought because the list is static it'd be better to make it hardcoded, wouldn't it?

@dtolnay

Copy link
Copy Markdown
Member

I don't know a reason that it would need to be static.

@rust-log-analyzer

This comment has been minimized.

Comment threadsrc/tools/tidy/src/style.rs Outdated
Comment threadsrc/tools/tidy/src/style.rs Outdated
Comment threadsrc/tools/tidy/src/style.rs Outdated
Comment threadsrc/tools/tidy/src/style.rs
@dtolnaydtolnay assigned dtolnay and unassigned joshtriplettSep 17, 2023
dtolnay
dtolnay previously requested changes Sep 17, 2023
Comment threadsrc/tools/tidy/src/style.rs Outdated
@rust-log-analyzer

This comment has been minimized.

@dtolnaydtolnay 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 Sep 17, 2023
@rust-log-analyzer

This comment has been minimized.

@donno2048

This comment was marked as off-topic.

@donno2048

Copy link
Copy Markdown
ContributorAuthor

But also correct me if I'm wrong, but without using the generate_problems function the (PROBLEMATIC_CONSTS.iter().map(u32::to_string)) won't work as expected

@donno2048donno2048 changed the title Add more PROBLEMATIC_CONSTSImplement PROBLEMATIC_CONSTS generalization Sep 27, 2023
@dtolnay

Copy link
Copy Markdown
Member

Yes, good point. The regex approach (.replace("a", "[aA4]") etc.) results in not finding capitalization variations for values that are problematic in hex but written as decimal in the source code.

I don't know the importance of looking for the decimal converted values.

I have assigned back to @joshtriplett who created this lint originally.

@dtolnay
dtolnay removed their request for review September 27, 2023 23:49
@donno2048

Copy link
Copy Markdown
ContributorAuthor

I think if we are ignoring some cases of (PROBLEMATIC_CONSTS.iter().map(u32::to_string)) we should remove it completely

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@donno2048

Copy link
Copy Markdown
ContributorAuthor

@rustbot review

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

@albertlarsan68albertlarsan68 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for the PR!

@albertlarsan68

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Apr 19, 2024

Copy link
Copy Markdown
Collaborator

📌 Commit e2ab540 has been approved by albertlarsan68

It is now in the queue for this repository.

@borsbors 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 19, 2024
@bors

bors commented Apr 19, 2024

Copy link
Copy Markdown
Collaborator

⌛ Testing commit e2ab540 with merge 43a0686...

@bors

bors commented Apr 19, 2024

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: albertlarsan68
Pushing 43a0686 to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Apr 19, 2024
@bors
bors merged commit 43a0686 into rust-lang:masterApr 19, 2024
@rustbotrustbot added this to the 1.79.0 milestone Apr 19, 2024
@donno2048
donno2048 deleted the patch-1 branch April 19, 2024 12:05
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (43a0686): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

meanrangecount
Regressions ❌
(primary)
0.2%[0.2%, 0.2%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)0.2%[0.2%, 0.2%]2

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 671.432s -> 673.234s (0.27%)
Artifact size: 315.27 MiB -> 315.21 MiB (-0.02%)

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

Labels

A-testsuiteArea: The testsuite used to check the correctness of rustcmerged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@donno2048@rustbot@rust-log-analyzer@dtolnay@joshtriplett@albertlarsan68@bors@rust-timer@Mark-Simulacrum