Skip to content

Do not yeet unsafe<> from type when formatting unsafe binder #137769

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 1, 2025

Conversation

compiler-errors
Copy link
Member

Unsafe binders are types like unsafe<'a, 'b> Ty<'a, 'b>. However, users can also specify unsafe binder types with no bound vars, like unsafe<> Ty.

When I added nightly formatting for unsafe binders, I didn't consider this, so on nightly we are stripping the unsafe<> part, which gives us back Ty which is a different type!

This PR fixes that.

r? @ytmimi

@rustbot
Copy link
Collaborator

rustbot commented Feb 28, 2025

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 28, 2025
@compiler-errors
Copy link
Member Author

Cannot remember if you have r+, so

@bors delegate=ymtimi

@bors
Copy link
Collaborator

bors commented Feb 28, 2025

✌️ @ymtimi, you can now approve this pull request!

If @compiler-errors told you to "r=me" after making some further change, please make that change, then do @bors r=@compiler-errors

@compiler-errors compiler-errors changed the title Do not yeet unsafe<> from type Do not yeet unsafe<> from type when formatting unsafe binder Feb 28, 2025
@ytmimi
Copy link
Contributor

ytmimi commented Feb 28, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Feb 28, 2025

@ytmimi: 🔑 Insufficient privileges: Not in reviewers

@compiler-errors
Copy link
Member Author

:/// I typoed your name in the delegate. sorry!

@bors r=ytmimi

@bors
Copy link
Collaborator

bors commented Feb 28, 2025

📌 Commit 5bf2237 has been approved by ytmimi

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 Feb 28, 2025
@ytmimi
Copy link
Contributor

ytmimi commented Feb 28, 2025

All good. This was a nice and simple PR!

@ytmimi
Copy link
Contributor

ytmimi commented Feb 28, 2025

Do you know who I need to reach out to in order to get the right privileges to approve PRs?

@compiler-errors
Copy link
Member Author

cc @calebcartwright

T-rustfmt should definitely have bors permissions in this repo, at least with the understanding that the permissions will only be used for rustfmt subtree syncs and the occasional in-tree rustfmt PR.

You should open a teams PR that adds these lines to rustfmt.toml:

[permissions]
bors.rust.review = true

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 1, 2025
…r=ytmimi

Do not yeet `unsafe<>` from type when formatting unsafe binder

Unsafe binders are types like `unsafe<'a, 'b> Ty<'a, 'b>`. However, users can also specify unsafe binder types with no bound vars, like `unsafe<> Ty`.

When I added nightly formatting for unsafe binders, I didn't consider this, so on nightly we are stripping the `unsafe<>` part, which gives us back `Ty` which is a different type!

This PR fixes that.

r? `@ytmimi`
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 1, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#136503 (Tweak output of const panic diagnostic)
 - rust-lang#137390 (tests: fix up new test for nocapture -> capture(none) change)
 - rust-lang#137617 (Introduce `feature(generic_const_parameter_types)`)
 - rust-lang#137719 (Add missing case explanation for doc inlined re-export of doc hidden item)
 - rust-lang#137763 (Use `mk_ty_from_kind` a bit less, clean up lifetime handling in borrowck)
 - rust-lang#137769 (Do not yeet `unsafe<>` from type when formatting unsafe binder)
 - rust-lang#137776 (Some `rustc_transmute` cleanups)
 - rust-lang#137800 (Remove `ParamEnv::without_caller_bounds`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b7853ef into rust-lang:master Mar 1, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 1, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 1, 2025
Rollup merge of rust-lang#137769 - compiler-errors:empty-unsafe-fmt, r=ytmimi

Do not yeet `unsafe<>` from type when formatting unsafe binder

Unsafe binders are types like `unsafe<'a, 'b> Ty<'a, 'b>`. However, users can also specify unsafe binder types with no bound vars, like `unsafe<> Ty`.

When I added nightly formatting for unsafe binders, I didn't consider this, so on nightly we are stripping the `unsafe<>` part, which gives us back `Ty` which is a different type!

This PR fixes that.

r? ``@ytmimi``
# for free to join this conversation on GitHub. Already have an account? # 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.

4 participants