Skip to content

Fix ICE in named_arguments_used_positionally lint - #99263

Merged
bors merged 2 commits into
rust-lang:masterfrom
compiler-errors:issue-99261
Jul 16, 2022
Merged

bors merged 2 commits into
rust-lang:masterfrom
compiler-errors:issue-99261

Conversation

@compiler-errors

@compiler-errors compiler-errors commented Jul 15, 2022 •

Copy link
Copy Markdown
Contributor

Fixes #99261
Fixes #99289
Fixes #99284
Fixes #99273
Fixes #99297
Fixes #99271
Fixes #99327
Fixes #99330

This match pattern:

 FormatSpec { width: Count::CountIsName(s, _), .. }
| FormatSpec { precision: Count::CountIsName(s, _), .. }

does not account for when both width and precision are both Count::CountIsName, so split the check for these two fields into two separate if let.

Also, remove any future potential for ICEs by removing the index operator altogether.


It is still suspicious that this indexing was broken and caused the ICE, as opposed to just causing a spurious lint message.

cc @PrestonFrom, who may be familiar with this code because of implementing the lint this touches, perhaps you'd like to look into why named arguments in FormatSpec.precision seem to have indices that don't correspond to a span in Context.arg_spans?

Edit: Opened #99265 to track a (related?) incorrect argument indexing issue.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 15, 2022
@rust-highfive

Copy link
Copy Markdown
Contributor

r? @jackh726

(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 Jul 15, 2022
@PrestonFrom

Copy link
Copy Markdown
Contributor

@compiler-errors Thank you for fixing this! Sorry I missed this case, but I have a slight suspicion of why the indices don't match. I'll look into that -- should I create an issue for it?

@compiler-errors

Copy link
Copy Markdown
Contributor Author

Yeah, the more issues the merrier. I'll probably only be working on getting this ICE closed out, in case you want some follow-up work 😀

@PrestonFrom

Copy link
Copy Markdown
Contributor

@compiler-errors Thank you! I have opened #99266 and will look into it.

@kyrias kyrias mentioned this pull request Jul 15, 2022
@lqd

lqd commented Jul 15, 2022

Copy link
Copy Markdown
Member

There seems to be a few duplicates of #99261, so this fixes an issue that a number of projects are hitting on nightly (by depending on the popular crate time).

@HTGAzureX1212

Copy link
Copy Markdown
Contributor

Just a heads up, #99271 is also a duplicate.

@jyn514

jyn514 commented Jul 16, 2022

Copy link
Copy Markdown
Member

@bors p=20 (should land before rollups)

@jyn514 jyn514 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.

r=me unless you want approval from someone familiar with this specific lint

@compiler-errors

Copy link
Copy Markdown
Contributor Author

Thanks @jyn514, I think this change is self-contained enough that your review is sufficient.

@bors r=jyn514

Anyways if someone else does have comments on the approach in this PR, happy to follow up, but I want to fix these ICEs given the number of bugs filed.

@bors

bors commented Jul 16, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 2902b92 has been approved by jyn514

It is now in the queue for this repository.

@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 Jul 16, 2022
@bors

bors commented Jul 16, 2022

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 2902b92 with merge 5635158...

@BlackDex

Copy link
Copy Markdown

All the dupes i could find (Including the one i just created my self, sorry).
Original: #99261
Duplicates: #99271, #99273, #99289, #99297, #99326, #99327 and #99330

@bors

bors commented Jul 16, 2022

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: jyn514
Pushing 5635158 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 16, 2022
@bors
bors merged commit 5635158 into rust-lang:master Jul 16, 2022
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (5635158): comparison url.

Instruction count

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

Max RSS (memory usage)

Results
  • Primary benchmarks: mixed results
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
5.3% 5.3% 1
Regressions 😿
(secondary)
2.0% 2.0% 1
Improvements 🎉
(primary)
-2.4% -2.4% 1
Improvements 🎉
(secondary)
-2.6% -3.5% 2
All 😿🎉 (primary) 1.5% 5.3% 2

Cycles

Results
  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
3.7% 3.7% 1
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-4.5% -4.5% 1
All 😿🎉 (primary) N/A N/A 0

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Footnotes

  1. the arithmetic mean of the percent change ↩ ↩2

  2. number of relevant changes ↩ ↩2

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

Labels

merged-by-bors This PR was explicitly merged by bors. 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