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

feat: omit suffixes in const generics (e.g. 1_i32) #99393

Conversation

Logarithmus
Copy link
Contributor

Closes #99255

@rust-highfive
Copy link
Collaborator

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

Please see the contribution instructions for more information.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 18, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 18, 2022
@rust-log-analyzer

This comment has been minimized.

@Logarithmus Logarithmus force-pushed the feature/99255-omit-const-generic-suffixes branch 2 times, most recently from b7be558 to c39826e Compare July 18, 2022 23:36
@rust-log-analyzer

This comment has been minimized.

@Logarithmus
Copy link
Contributor Author

Logarithmus commented Jul 19, 2022

@petrochenkov CI finally passed
bors r?

@petrochenkov
Copy link
Contributor

This PR removes types from const generic arguments not only in type mismatch errors (where types are the same), but in pretty much all pretty-printed types.

The result seems fine though (except for inferred constants maybe, like _: usize -> _).
We should be able to add an extra flag to FmtPrinterData if we need to restore the types in some locations in the future.

r=me after squashing commits into one.
@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 Jul 19, 2022
@Logarithmus
Copy link
Contributor Author

Logarithmus commented Jul 20, 2022

@petrochenkov what should I do now? Add this extra flag to struct FmtPrinterData? Should I add it to FmtPrinter::new(..) as well? Should I revert to the old behavior for cases like Blah<{_: usize}>?

r=me after squashing commits into one

What does it mean? Why should I squash the commits manually?

@petrochenkov
Copy link
Contributor

what should I do now? Add this extra flag to struct FmtPrinterData?

No, the PR seems fine as is.

What does it mean?

It means I (or someone else on my behalf) will approve this PR after the commits are squashed.

@Logarithmus
Copy link
Contributor Author

@petrochenkov but bors squashes automatically...

@petrochenkov
Copy link
Contributor

petrochenkov commented Jul 20, 2022

Why should I squash the commits manually?

Squashing can actually be made by the merge bot, but the commit messages are suboptimal.
So I always ask people to clean up the history manually if possible.
@bors r+ squash

@bors
Copy link
Contributor

bors commented Jul 20, 2022

📌 Commit 8530407 has been approved by petrochenkov

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 20, 2022
@Logarithmus
Copy link
Contributor Author

@petrochenkov I've thought bors uses PR body as a commit message. In fact, that's the behavior observed here: rust-lang/rust-analyzer#12778

@Logarithmus
Copy link
Contributor Author

@petrochenkov after merging to master, will this feature make it into the next stable (1.63)? Who decides what goes to stable and what not?

@petrochenkov
Copy link
Contributor

I've thought bors uses PR body as a commit message

If it's true that's good, I tried bors squash once (?) when it was introduced and, IIRC, it did something wrong back then.

Who decides what goes to stable and what not?

Time?
Everything is merged into nightly (that's future 1.64 currently), unless specifically backported to beta or (rarely) stable, but this PR doesn't look like a typical backport candidate.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 20, 2022
…t-generic-suffixes, r=petrochenkov

feat: omit suffixes in const generics (e.g. `1_i32`)

Closes rust-lang#99255
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jul 21, 2022
…t-generic-suffixes, r=petrochenkov

feat: omit suffixes in const generics (e.g. `1_i32`)

Closes rust-lang#99255
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jul 21, 2022
…t-generic-suffixes, r=petrochenkov

feat: omit suffixes in const generics (e.g. `1_i32`)

Closes rust-lang#99255
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jul 21, 2022
…t-generic-suffixes, r=petrochenkov

feat: omit suffixes in const generics (e.g. `1_i32`)

Closes rust-lang#99255
@compiler-errors
Copy link
Member

In fact, that's the behavior observed here: rust-lang/rust-analyzer#12778

Bors uses the PR body in the description of the merge commit that it pushes to master, but that is still a merge commit with the unsquashed set of commits as the commit parent.

As you can see in the rollup attempts opened since this PR was r+'ed, bors didn't squash anything. I think bors squash only does it's thing if it this PR is not rolled up.

Anyways, in the future, I don't think it's necessary to include three more "test: XYZ" commits on top of the commit that does the actual change.

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jul 22, 2022
…t-generic-suffixes, r=petrochenkov

feat: omit suffixes in const generics (e.g. `1_i32`)

Closes rust-lang#99255
@Logarithmus Logarithmus force-pushed the feature/99255-omit-const-generic-suffixes branch from 8530407 to ef620c3 Compare July 22, 2022 06:46
@rustbot
Copy link
Collaborator

rustbot commented Jul 22, 2022

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@Logarithmus Logarithmus force-pushed the feature/99255-omit-const-generic-suffixes branch from ef620c3 to 9428f2a Compare July 22, 2022 06:46
@Logarithmus
Copy link
Contributor Author

@compiler-errors I've squashed the commits

@oli-obk
Copy link
Contributor

oli-obk commented Jul 22, 2022

Thanks!

@bors r=petrochenkov

@bors
Copy link
Contributor

bors commented Jul 22, 2022

📌 Commit 9428f2a has been approved by petrochenkov

It is now in the queue for this repository.

bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 22, 2022
Rollup of 6 pull requests

Successful merges:

 - rust-lang#98174 (Rename `<*{mut,const} T>::as_{const,mut}` to `cast_`)
 - rust-lang#98868 (Fix unreachable coverage generation for inlined functions)
 - rust-lang#99393 (feat: omit suffixes in const generics (e.g. `1_i32`))
 - rust-lang#99423 (Group CSS font rule)
 - rust-lang#99539 (Improve suggestions for returning binding)
 - rust-lang#99579 (Add same warning to Result::expect as Result::unwrap)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@Logarithmus
Copy link
Contributor Author

@petrochenkov I see the rollup is merged. What should I do now?

@RalfJung
Copy link
Member

RalfJung commented Jul 22, 2022

You should never push to a branch that is in an open rollup. Now you'll have to make a new PR with the bits that you pushed since the rollup was created.

@RalfJung
Copy link
Member

@bors r-

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 22, 2022
@Logarithmus
Copy link
Contributor Author

Logarithmus commented Jul 22, 2022

@RalfJung I changed nothing, just squashed the commits as I've been told by @compiler-errors. Can I just close this PR now?

@RalfJung
Copy link
Member

RalfJung commented Jul 22, 2022

Yeah if everything landed you can close the PR. @compiler-errors didn't actually ask you to squash this PR, so I guess there was some miscommunication here. (They just said "in the future, I don't think it's necessary to include [...]" but they didn't say "please squash this PR", as far as I can see.) Generally, don't touch the PR after it has been r+ed. :)

Looks like squashing and rollups don't work together, I'll report that as a bug for bors.

@Logarithmus
Copy link
Contributor Author

Merged in rust-lang-ci@e7a9c11

@Logarithmus Logarithmus deleted the feature/99255-omit-const-generic-suffixes branch July 22, 2022 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

Omit suffixes (e. g. 1_i32) in const generic compilation errors
9 participants