Skip to content

Improve dangerous_implicit_aurorefs diagnostic output #140768

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 2 commits into from
May 16, 2025

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented May 7, 2025

This PR greatly improves the dangerous_implicit_aurorefs lint diagnostic output.

Kind of related to #140721.

r? @jieyouxu (maybe)

@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 May 7, 2025
@jieyouxu
Copy link
Member

jieyouxu commented May 7, 2025

Not a good reviewer for this, maybe r? @RalfJung

@rustbot rustbot assigned RalfJung and unassigned jieyouxu May 7, 2025
@RalfJung
Copy link
Member

RalfJung commented May 8, 2025

I'm not really an expert for lint implementations, and hardly use these HIR APIs.
@rust-lang/wg-diagnostics could one of you take this?

Let's see if this works
r? diagnostics

@rustbot rustbot assigned compiler-errors and unassigned RalfJung May 8, 2025
@Urgau Urgau force-pushed the improv_autorefs-lint branch from e4fac05 to 5e5cacd Compare May 8, 2025 11:36
@fmease
Copy link
Member

fmease commented May 14, 2025

r? fmease
r=me with nits addressed

@rustbot

This comment was marked as resolved.

@fmease fmease assigned fmease and unassigned compiler-errors May 14, 2025
@fmease fmease 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 May 14, 2025
@Urgau Urgau force-pushed the improv_autorefs-lint branch from 5e5cacd to 9b3abe7 Compare May 14, 2025 21:54
@@ -362,6 +362,10 @@ lint_impl_trait_redundant_captures = all possible in-scope parameters are alread

lint_implicit_unsafe_autorefs = implicit autoref creates a reference to the dereference of a raw pointer
.note = creating a reference requires the pointer target to be valid and imposes aliasing requirements
.raw_ptr = this raw pointer has type `{$raw_ptr_ty}`
.autoref = autoref is being applied to this expression, resulting in: `{$autoref_ty}`
Copy link
Member

@fmease fmease May 15, 2025

Choose a reason for hiding this comment

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

We talked about rephrasing "autoref is being applied" to sth. along the lines of "references to this expression are implicitly created", "references are implicitly applied ...", ...

Is that still something we want to pursue?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I wanted to do that but given that the end result type is not going to have a visible reference I just removed the "autoref" note, and just show the deref one.

@Urgau Urgau 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 May 15, 2025
@fmease
Copy link
Member

fmease commented May 15, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 15, 2025

📌 Commit 9b3abe7 has been approved by fmease

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented May 15, 2025

🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 15, 2025
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label May 15, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 15, 2025
Improve `dangerous_implicit_aurorefs` diagnostic output

This PR *greatly* improves the `dangerous_implicit_aurorefs` lint diagnostic output.

Kind of related to rust-lang#140721.

r? `@jieyouxu` (maybe)
compiler-errors added a commit to compiler-errors/rust that referenced this pull request May 15, 2025
Improve `dangerous_implicit_aurorefs` diagnostic output

This PR *greatly* improves the `dangerous_implicit_aurorefs` lint diagnostic output.

Kind of related to rust-lang#140721.

r? ``@jieyouxu`` (maybe)
bors added a commit to rust-lang-ci/rust that referenced this pull request May 15, 2025
…mpiler-errors

Rollup of 14 pull requests

Successful merges:

 - rust-lang#139749 (docs(library/core/src/pin): fix typo "necessarily" -> "necessary")
 - rust-lang#140130 (Add LLDB providers for BTreeMap and BTreeSet)
 - rust-lang#140685 (Simplify `Vec::as_non_null` implementation and make it `const`)
 - rust-lang#140712 (normalization: avoid incompletely constraining GAT args)
 - rust-lang#140768 (Improve `dangerous_implicit_aurorefs` diagnostic output)
 - rust-lang#140834 (move (or remove) some impl Trait tests)
 - rust-lang#140910 (Remove `stable` attribute from wasi fs (read_exact|write_all)_at)
 - rust-lang#140947 (Flush errors before deep normalize in `dropck_outlives`)
 - rust-lang#140966 (Remove #![feature(let_chains)] from library and src/librustdoc)
 - rust-lang#140977 ([win] Use a dash instead of slash for linker to avoid breaking lld)
 - rust-lang#140990 (VxWorks: updates from recent libc versions)
 - rust-lang#141003 (Improve ternary operator recovery)
 - rust-lang#141013 (Implement methods to set STARTUPINFO flags for Command API on Windows)
 - rust-lang#141026 (rustc-dev-guide subtree update)

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

Rollup of 8 pull requests

Successful merges:

 - rust-lang#139749 (docs(library/core/src/pin): fix typo "necessarily" -> "necessary")
 - rust-lang#140685 (Simplify `Vec::as_non_null` implementation and make it `const`)
 - rust-lang#140712 (normalization: avoid incompletely constraining GAT args)
 - rust-lang#140768 (Improve `dangerous_implicit_aurorefs` diagnostic output)
 - rust-lang#140947 (Flush errors before deep normalize in `dropck_outlives`)
 - rust-lang#140966 (Remove #![feature(let_chains)] from library and src/librustdoc)
 - rust-lang#140990 (VxWorks: updates from recent libc versions)
 - rust-lang#141027 (remove `RustfmtState` to reduce `initial_rustfmt` complexity)

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

Rollup of 7 pull requests

Successful merges:

 - rust-lang#139749 (docs(library/core/src/pin): fix typo "necessarily" -> "necessary")
 - rust-lang#140685 (Simplify `Vec::as_non_null` implementation and make it `const`)
 - rust-lang#140712 (normalization: avoid incompletely constraining GAT args)
 - rust-lang#140768 (Improve `dangerous_implicit_aurorefs` diagnostic output)
 - rust-lang#140947 (Flush errors before deep normalize in `dropck_outlives`)
 - rust-lang#140990 (VxWorks: updates from recent libc versions)
 - rust-lang#141027 (remove `RustfmtState` to reduce `initial_rustfmt` complexity)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit f5fb0d3 into rust-lang:master May 16, 2025
6 checks passed
@rustbot rustbot added this to the 1.89.0 milestone May 16, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 16, 2025
Rollup merge of rust-lang#140768 - Urgau:improv_autorefs-lint, r=fmease

Improve `dangerous_implicit_aurorefs` diagnostic output

This PR *greatly* improves the `dangerous_implicit_aurorefs` lint diagnostic output.

Kind of related to rust-lang#140721.

r? ```@jieyouxu``` (maybe)
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-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.

7 participants