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

Use ordinal number in argument error #125042

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

long-long-float
Copy link
Contributor

@long-long-float long-long-float commented May 12, 2024

Add an ordinal number to two argument errors ("unexpected" and "missing") for ease of understanding error.

error[E0061]: this function takes 3 arguments but 2 arguments were supplied
  --> test.rs:11:5
   |
11 |     f(42, 'a');
   |     ^     --- 2nd argument of type `f32` is missing
   |
(snip)

error[E0061]: this function takes 3 arguments but 4 arguments were supplied
  --> test.rs:12:5
   |
12 |     f(42, 42, 1.0, 'a');
   |     ^   ----
   |         | |
   |         | unexpected 2nd argument of type `{integer}`
   |         help: remove the extra argument

To get an ordinal number, I copied ordinalize from other crate rustc_resolve because I think it is too much to link rustc_resolve for this small function. Please let me know if there is a better way.

@rustbot
Copy link
Collaborator

rustbot commented May 12, 2024

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 May 12, 2024
@rust-log-analyzer

This comment has been minimized.

@nnethercote
Copy link
Contributor

I think using #n instead of the ordinal number is better, as in #125105 :)

@long-long-float
Copy link
Contributor Author

long-long-float commented May 22, 2024

I think using #n instead of the ordinal number is better, as in #125105 :)

Yes, I will fix to use #n format because I don't have a strong reason to use ordinalize.

@rust-log-analyzer

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants