Use verbose span suggestion for type const#154293
Use verbose span suggestion for type const#154293rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
|
HIR ty lowering was modified cc @fmease |
|
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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
| err.span_suggestion_verbose( | |
| // Verbose since an inline suggestion would look too confusing. See #154214. | |
| err.span_suggestion_verbose( |
There was a problem hiding this comment.
Thanks! I’ll skip the comment for now since the change is pretty small and clear.
faeac8d to
e039838
Compare
|
@rustbot ready |
…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)
…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)
close: #154214
r? fmease