Skip to content

Comments

Rename rustc::pass_by_value lint as rustc::disallowed_pass_by_ref.#153029

Open
nnethercote wants to merge 1 commit intorust-lang:mainfrom
nnethercote:disallowed-pass-by-ref
Open

Rename rustc::pass_by_value lint as rustc::disallowed_pass_by_ref.#153029
nnethercote wants to merge 1 commit intorust-lang:mainfrom
nnethercote:disallowed-pass-by-ref

Conversation

@nnethercote
Copy link
Contributor

The name pass_by_value is completely wrong. The lint actually checks for the use of pass by reference for types marked with rustc_pass_by_value.

The hardest part of this was choosing the new name. The disallowed_ part of the name closely matches the following clippy lints:

  • disallowed_macros
  • disallowed_methods
  • disallowed_names
  • disallowed_script_idents
  • disallowed_types

The pass_by_value part of the name aligns with the following clippy lints:

  • needless_pass_by_value
  • needless_pass_by_ref_mut
  • trivially_copy_pass_by_ref
  • large_types_passed_by_value (less so)

r? @Urgau

@rustbot
Copy link
Collaborator

rustbot commented Feb 23, 2026

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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 Feb 23, 2026
@nnethercote nnethercote changed the title Rename pass_by_value lint as disallowed_pass_by_ref. Rename rustc::pass_by_value lint as rustc::disallowed_pass_by_ref. Feb 23, 2026
@nnethercote
Copy link
Contributor Author

BTW, I'm not 100% certain about how I handled bootstrapping. It seems reasonable but I couldn't find any other examples in the code that looked quite the same as what I did.

Copy link
Member

@Urgau Urgau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine.

Regarding the lint name in the face of our guidelines, and in particular rule 2, I'm wondering if it shouldn't be named: rustc::disallowed_pass_by_ref_types.

Though that seems a bit long, maybe we can just remove the pass part and have rustc::disallowed_by_ref_types. What do you think?

View changes since this review

@nnethercote
Copy link
Contributor Author

I think the pass is more useful than the types. And I like the idea of being consistent with existing lint names, even if that goes against the guidelines.

@Urgau
Copy link
Member

Urgau commented Feb 24, 2026

I'm fine with that.

@Urgau
Copy link
Member

Urgau commented Feb 24, 2026

@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 24, 2026

📌 Commit d60e15f has been approved by Urgau

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 24, 2026
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Feb 24, 2026
…, r=Urgau

Rename `rustc::pass_by_value` lint as `rustc::disallowed_pass_by_ref`.

The name `pass_by_value` is completely wrong. The lint actually checks for the use of pass by reference for types marked with `rustc_pass_by_value`.

The hardest part of this was choosing the new name. The `disallowed_` part of the name closely matches the following clippy lints:
- `disallowed_macros`
- `disallowed_methods`
- `disallowed_names`
- `disallowed_script_idents`
- `disallowed_types`

The `pass_by_value` part of the name aligns with the following clippy lints:
- `needless_pass_by_value`
- `needless_pass_by_ref_mut`
- `trivially_copy_pass_by_ref`
- `large_types_passed_by_value` (less so)

r? @Urgau
@nnethercote
Copy link
Contributor Author

For the record: @Urgau and I had a private discussion about the names. We both liked disallowed, I have a strong preference to keep pass (it mirrors rustc_pass_by_value, for example). We considered disallowed_pass_by_ref and disallowed_pass_by_ref_types, but decided that the types didn't really add anything other than extra characters.

rust-bors bot pushed a commit that referenced this pull request Feb 25, 2026
Rollup of 8 pull requests

Successful merges:

 - #149169 (ptr::replace: make calls on ZST null ptr not UB)
 - #150562 (Fix doc link used in suggestion for pinning self)
 - #152679 (rustc_expand: improve diagnostics for non-repeatable metavars)
 - #153017 (Implement debuginfo for unsafe binder types)
 - #152868 (delete some very old trivial `Box` tests)
 - #152922 (rustc_public: Make fields that shouldn't be exposed visible only in `rustc_public`)
 - #153029 (Rename `rustc::pass_by_value` lint as `rustc::disallowed_pass_by_ref`.)
 - #153051 (Migration of `LintDiagnostic` - part 3)
@jhpratt
Copy link
Member

jhpratt commented Feb 25, 2026

@bors r-

#153059 (comment)

@rust-bors rust-bors bot 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 Feb 25, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 25, 2026

Commit d60e15f has been unapproved.

This PR was contained in a rollup (#153059), which was also unapproved.

The name `pass_by_value` is completely wrong. The lint actually checks
for the use of pass by reference for types marked with
`rustc_pass_by_value`.

The hardest part of this was choosing the new name. The `disallowed_`
part of the name closely matches the following clippy lints:
- `disallowed_macros`
- `disallowed_methods`
- `disallowed_names`
- `disallowed_script_idents`
- `disallowed_types`

The `pass_by_value` part of the name aligns with the following clippy
lints:
- `needless_pass_by_value`
- `needless_pass_by_ref_mut`
- `trivially_copy_pass_by_ref`
- `large_types_passed_by_value` (less so)
@nnethercote nnethercote force-pushed the disallowed-pass-by-ref branch from d60e15f to 8eed8bd Compare February 25, 2026 04:10
@nnethercote
Copy link
Contributor Author

I added a temporary //@ ignore-stage1 to the failing test. This should be enough to fix the problem.

@bors r=Urgau

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 25, 2026

📌 Commit 8eed8bd has been approved by Urgau

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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

Development

Successfully merging this pull request may close these issues.

4 participants