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

Lint against Symbol::intern on a string literal #133545

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

clubby789
Copy link
Contributor

Disabled in tests where this doesn't make much sense

@rustbot
Copy link
Collaborator

rustbot commented Nov 27, 2024

r? @Nadrieril

rustbot has assigned @Nadrieril.
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 Nov 27, 2024
@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Nov 27, 2024

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Nov 27, 2024
@jieyouxu
Copy link
Member

r? jieyouxu

@rustbot rustbot assigned jieyouxu and unassigned Nadrieril Nov 27, 2024
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks, I concur with previous remarks that this is should not be universally applied.

compiler/rustc_hir_analysis/src/collect/generics_of.rs Outdated Show resolved Hide resolved
compiler/rustc_metadata/src/creader.rs Show resolved Hide resolved
compiler/rustc_metadata/src/rmeta/decoder.rs Outdated Show resolved Hide resolved
compiler/rustc_resolve/src/late/diagnostics.rs Outdated Show resolved Hide resolved
compiler/rustc_resolve/src/lib.rs Outdated Show resolved Hide resolved
@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 Nov 28, 2024
@clubby789
Copy link
Contributor Author

Reverted the cases where this is less than helpful, but I've left the others to match the existing symbol naming rules.

Then again, it looks like the rule isn't very consistently applied (there's a few symbols with dashes which don't contain _dash_), so if you feel strongly about the mentioned cases we can adjust them

@jieyouxu
Copy link
Member

In my opinion, if the sym names derived from strictly following the sym naming rules turns out to be less readable, then:

(1) Either we don't make it a sym,
(2) Or we don't strictly follow the naming rules.

For stuff like <xxx> becoming lt_xxx_rt, I think that's significantly worse readability wise if we convert them into sym and strictly follow said sym naming rules. The c-variadic case I don't think is as problematic, but it might be less obvious than actually c-variadic as-is.

@clubby789
Copy link
Contributor Author

Switched to only passing the -D from bootstrap if we're not running a test command

@clubby789 clubby789 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 Dec 2, 2024
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks!

@jieyouxu
Copy link
Member

jieyouxu commented Dec 2, 2024

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 2, 2024

📌 Commit 71b698c has been approved by jieyouxu

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 Dec 2, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 3, 2024
…youxu

Lint against Symbol::intern on a string literal

Disabled in tests where this doesn't make much sense
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 3, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#133089 (Stabilize noop_waker)
 - rust-lang#133522 (Don't suggest restricting bound with unstable traits on stable and mention it's unstable on nightly)
 - rust-lang#133545 (Lint against Symbol::intern on a string literal)
 - rust-lang#133558 (Structurally resolve in `probe_adt`)
 - rust-lang#133753 (Reduce false positives on some common cases from if-let-rescope lint)
 - rust-lang#133762 (stabilize const_{size,align}_of_val)
 - rust-lang#133777 (document -Zrandomize-layout in the unstable book)
 - rust-lang#133779 (Use correct `hir_id` for array const arg infers)

r? `@ghost`
`@rustbot` modify labels: rollup
jhpratt added a commit to jhpratt/rust that referenced this pull request Dec 3, 2024
…youxu

Lint against Symbol::intern on a string literal

Disabled in tests where this doesn't make much sense
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 3, 2024
…youxu

Lint against Symbol::intern on a string literal

Disabled in tests where this doesn't make much sense
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 3, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#133522 (Don't suggest restricting bound with unstable traits on stable and mention it's unstable on nightly)
 - rust-lang#133545 (Lint against Symbol::intern on a string literal)
 - rust-lang#133558 (Structurally resolve in `probe_adt`)
 - rust-lang#133753 (Reduce false positives on some common cases from if-let-rescope lint)
 - rust-lang#133762 (stabilize const_{size,align}_of_val)
 - rust-lang#133777 (document -Zrandomize-layout in the unstable book)
 - rust-lang#133779 (Use correct `hir_id` for array const arg infers)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 3, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#132612 (Gate async fn trait bound modifier on `async_trait_bounds`)
 - rust-lang#133545 (Lint against Symbol::intern on a string literal)
 - rust-lang#133558 (Structurally resolve in `probe_adt`)
 - rust-lang#133696 (stabilize const_collections_with_hasher and build_hasher_default_const_new)
 - rust-lang#133753 (Reduce false positives on some common cases from if-let-rescope lint)
 - rust-lang#133762 (stabilize const_{size,align}_of_val)
 - rust-lang#133777 (document -Zrandomize-layout in the unstable book)
 - rust-lang#133779 (Use correct `hir_id` for array const arg infers)
 - rust-lang#133796 (Update the definition of `borrowing_sub`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 453a1a8 into rust-lang:master Dec 3, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 3, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 3, 2024
Rollup merge of rust-lang#133545 - clubby789:symbol-intern-lit, r=jieyouxu

Lint against Symbol::intern on a string literal

Disabled in tests where this doesn't make much sense
bjorn3 pushed a commit to bjorn3/rust that referenced this pull request Dec 6, 2024
…youxu

Lint against Symbol::intern on a string literal

Disabled in tests where this doesn't make much sense
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Dec 11, 2024
…ing-literal, r=jieyouxu

allow `symbol_intern_string_literal` lint in test modules

Since rust-lang#133545, `x check compiler --stage 1` no longer works because compiler test modules trigger `symbol_intern_string_literal` lint errors. Bootstrap shouldn't control when to ignore or enable this lint in the compiler tree (using `Kind != Test` was ineffective for obvious reasons).

Also, conditionally adding this rustflag invalidates the build cache between `x test` and other commands.

This PR removes the `Kind` check from bootstrap and handles it directly in the compiler tree in a more natural way.
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Dec 12, 2024
…ing-literal, r=jieyouxu

allow `symbol_intern_string_literal` lint in test modules

Since rust-lang#133545, `x check compiler --stage 1` no longer works because compiler test modules trigger `symbol_intern_string_literal` lint errors. Bootstrap shouldn't control when to ignore or enable this lint in the compiler tree (using `Kind != Test` was ineffective for obvious reasons).

Also, conditionally adding this rustflag invalidates the build cache between `x test` and other commands.

This PR removes the `Kind` check from bootstrap and handles it directly in the compiler tree in a more natural way.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 12, 2024
…ing-literal, r=jieyouxu

allow `symbol_intern_string_literal` lint in test modules

Since rust-lang#133545, `x check compiler --stage 1` no longer works because compiler test modules trigger `symbol_intern_string_literal` lint errors. Bootstrap shouldn't control when to ignore or enable this lint in the compiler tree (using `Kind != Test` was ineffective for obvious reasons).

Also, conditionally adding this rustflag invalidates the build cache between `x test` and other commands.

This PR removes the `Kind` check from bootstrap and handles it directly in the compiler tree in a more natural way.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 12, 2024
Rollup merge of rust-lang#134173 - onur-ozkan:allow-symbol-intern-string-literal, r=jieyouxu

allow `symbol_intern_string_literal` lint in test modules

Since rust-lang#133545, `x check compiler --stage 1` no longer works because compiler test modules trigger `symbol_intern_string_literal` lint errors. Bootstrap shouldn't control when to ignore or enable this lint in the compiler tree (using `Kind != Test` was ineffective for obvious reasons).

Also, conditionally adding this rustflag invalidates the build cache between `x test` and other commands.

This PR removes the `Kind` check from bootstrap and handles it directly in the compiler tree in a more natural way.
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. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.

8 participants