Skip to content

Use verbose span suggestion for type const#154293

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
reddevilmidzy:type-diag
Mar 24, 2026
Merged

Use verbose span suggestion for type const#154293
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
reddevilmidzy:type-diag

Conversation

@reddevilmidzy
Copy link
Copy Markdown
Member

close: #154214

r? fmease

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 24, 2026

HIR ty lowering was modified

cc @fmease

@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 Mar 24, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 24, 2026

fmease is currently at their maximum review capacity.
They may take a while to respond.

Copy link
Copy Markdown
Member

@fmease fmease Mar 24, 2026

Choose a reason for hiding this comment

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

Ignoring the .stderr file, this test also passes on branch main including rustfix, so it's easy for someone else to accidentally --bless your changes away again the future, so it's not a super robust regression test. I'm inclined to say that this test isn't really necessary.

As you know the main reason we're changing this from an inline to a verbose suggestion is avoiding the help message add `type` before `const` for `X`: `type` as it looks confusingly similar to add `type` before `const X: type` IIUC.

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.

Got it, that makes sense.

if def_id.is_local() {
let name = tcx.def_path_str(def_id);
err.span_suggestion(
err.span_suggestion_verbose(
Copy link
Copy Markdown
Member

@fmease fmease Mar 24, 2026

Choose a reason for hiding this comment

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

Instead of a regression test, if you want to you can a short comment explaining why the suggestion is meant to be verbose (but you really don't need to).

In case you do want to a add a comment: I'm thinking of sth. like

Suggested change
err.span_suggestion_verbose(
// Verbose since an inline suggestion would look too confusing. See #154214.
err.span_suggestion_verbose(

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.

Thanks! I’ll skip the comment for now since the change is pretty small and clear.

@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 Mar 24, 2026
@reddevilmidzy
Copy link
Copy Markdown
Member Author

@rustbot ready

@rustbot rustbot 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 Mar 24, 2026
Copy link
Copy Markdown
Member

@fmease fmease left a comment

Choose a reason for hiding this comment

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

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 24, 2026

📌 Commit e039838 has been approved by fmease

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 Mar 24, 2026
rust-bors bot pushed a commit that referenced this pull request Mar 24, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #152710 (Unalign `PackedFingerprint` on all hosts, not just x86 and x86-64)
 - #153874 (constify const Fn*: Destruct)
 - #154097 (improve validation error messages: show surrounding type)
 - #154277 (use `minicore` more in testing inline assembly)
 - #154293 (Use verbose span suggestion for type const)
@rust-bors rust-bors bot merged commit 9396ab2 into rust-lang:main Mar 24, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 24, 2026
@reddevilmidzy reddevilmidzy deleted the type-diag branch March 24, 2026 23:03
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Mar 25, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#152710 (Unalign `PackedFingerprint` on all hosts, not just x86 and x86-64)
 - rust-lang/rust#153874 (constify const Fn*: Destruct)
 - rust-lang/rust#154097 (improve validation error messages: show surrounding type)
 - rust-lang/rust#154277 (use `minicore` more in testing inline assembly)
 - rust-lang/rust#154293 (Use verbose span suggestion for type const)
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.

Diagnosis improvement in cases where type is not written in mGCA

3 participants