Skip to content

Tweak output of type params and constraints in the wrong order #70519

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

Merged
merged 6 commits into from
Apr 6, 2020

Conversation

estebank
Copy link
Contributor

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 29, 2020
@Centril Centril 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 Mar 29, 2020
When encountering constraints before type arguments or lifetimes,
suggest the correct order.
@estebank
Copy link
Contributor Author

One thing to keep in mind is that we suggest fixing the order, but we don't proactively fix it, leading to situations like the following:

error: generic arguments must come before the first constraint
  --> file33.rs:11:34
   |
11 | struct Bar<'a, A, F: Foo<T = (), A, 'a, 4>> {
   |                          ------  ^  ^^  ^ generic argument
   |                          |       |  |
   |                          |       |  generic argument
   |                          |       generic argument
   |                          the constraint is provided here
   |
help: move the constraint after the generic arguments
   |
11 | struct Bar<'a, A, F: Foo<'a, A, 4, T = ()>> {
   |                         ^^^^^^^^^^^^^^^^^^

error[E0747]: lifetime provided when a constant was expected
  --> file33.rs:11:37
   |
11 | struct Bar<'a, A, F: Foo<T = (), A, 'a, 4>> {
   |                                     ^^
   |
   = note: constant arguments must be provided before lifetime arguments

error: aborting due to 2 previous errors

@estebank estebank 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 Mar 29, 2020
@varkor
Copy link
Member

varkor commented Mar 29, 2020

One thing to keep in mind is that we suggest fixing the order, but we don't proactively fix it, leading to situations like the following:

I think this is acceptable: it's still clear, just a little repetitive.

@Centril Centril 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 3, 2020
estebank added 2 commits April 5, 2020 17:03
Using a single label for constraints and generic arguments.
@Centril
Copy link
Contributor

Centril commented Apr 6, 2020

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 6, 2020

📌 Commit 17a9523 has been approved by Centril

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 6, 2020
@bors
Copy link
Collaborator

bors commented Apr 6, 2020

⌛ Testing commit 17a9523 with merge d6ae20f50d7494dac10b3a779aa1014d7a40e0cf...

@Centril
Copy link
Contributor

Centril commented Apr 6, 2020

@bors retry

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 6, 2020
Rollup of 5 pull requests

Successful merges:

 - rust-lang#70519 (Tweak output of type params and constraints in the wrong order)
 - rust-lang#70704 (Make panic unwind the default for aarch64-*-windows-msvc targets)
 - rust-lang#70713 (Prefer sysroot from rustc in same directory as rust-gdb)
 - rust-lang#70739 (def_collector, visit_fn: account for no body)
 - rust-lang#70827 (Use smaller span for suggestion restricting lifetime)

Failed merges:

r? @ghost
@bors
Copy link
Collaborator

bors commented Apr 6, 2020

⌛ Testing commit 17a9523 with merge af89eb5...

@bors bors merged commit eea91c3 into rust-lang:master Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants