Skip to content

Improve dangerous_implicit_aurorefs diagnostic output - #140768

Merged
bors merged 2 commits into
rust-lang:masterfrom
Urgau:improv_autorefs-lint
May 16, 2025
Merged

Improve dangerous_implicit_aurorefs diagnostic output#140768
bors merged 2 commits into
rust-lang:masterfrom
Urgau:improv_autorefs-lint

Conversation

@Urgau

@Urgau Urgau commented May 7, 2025

Copy link
Copy Markdown
Member

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

jieyouxu commented May 7, 2025

Copy link
Copy Markdown
Member

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

@rustbot rustbot assigned RalfJung and unassigned jieyouxu May 7, 2025
@RalfJung

ghost commented May 8, 2025

Copy link
Copy Markdown
Member

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
Comment thread tests/ui/lint/implicit_autorefs.stderr Outdated
Comment thread compiler/rustc_lint/src/lints.rs Outdated
@Urgau
Urgau force-pushed the improv_autorefs-lint branch from e4fac05 to 5e5cacd Compare May 8, 2025 11:36
Comment thread compiler/rustc_lint/src/autorefs.rs Outdated
Comment thread compiler/rustc_lint/src/autorefs.rs Outdated
Comment thread compiler/rustc_lint/messages.ftl Outdated
Comment thread tests/ui/lint/implicit_autorefs.stderr Outdated
@fmease

ghost commented May 14, 2025

Copy link
Copy Markdown
Member

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
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}`

ghost May 15, 2025

Copy link
Copy Markdown
Member

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?

ghost May 15, 2025

Copy link
Copy Markdown
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

ghost commented May 15, 2025

Copy link
Copy Markdown
Member

@bors r+ rollup

@bors

ghost commented May 15, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 9b3abe7 has been approved by fmease

It is now in the queue for this repository.

@bors

ghost commented May 15, 2025

Copy link
Copy Markdown
Collaborator

🌲 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
@bors
bors merged commit f5fb0d3 into rust-lang:master May 16, 2025
@rustbot rustbot added this to the 1.89.0 milestone May 16, 2025
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