Stream: t-compiler/help

Topic: How do I make a `note` come before `help`?


Joshua Nelson (Aug 06 2020 at 20:38, on Zulip):

Right now I call note() then span_suggestion(). But the suggestion still comes first. Is there a way to re-order them?
https://github.com/rust-lang/rust/pull/75079#discussion_r465453234

Yuki Okushi (Aug 06 2020 at 20:42, on Zulip):

I think you can use span_note and help instead

Joshua Nelson (Aug 06 2020 at 20:42, on Zulip):

let me try that, thanks :)

Joshua Nelson (Aug 06 2020 at 20:56, on Zulip):

hmm, then it's not a suggestion anymore, so you can't use cargo fix

Joshua Nelson (Aug 06 2020 at 20:57, on Zulip):

let me try help and span_suggestion

Joshua Nelson (Aug 06 2020 at 20:59, on Zulip):

nope

error: incompatible link kind for `f`
  --> src/test/rustdoc-ui/intra-links-disambiguator-mismatch.rs:64:14
   |
64 | /// Link to [const@f]
   |              ^^^^^^^ help: to link to the function, use its disambiguator: `f()`
   |
   = help: this link resolved to a function, which is not a constant
Yuki Okushi (Aug 06 2020 at 21:04, on Zulip):

ah, you're using span_suggestion, I missed that sorry!
so I think span_suggestion is still useful here? suggestions without span are unclear a bit

Joshua Nelson (Aug 06 2020 at 21:05, on Zulip):

right, but then it's the wrong order :(

Yuki Okushi (Aug 06 2020 at 21:05, on Zulip):

hmm, current message is fine for me, why do you want to re-order?

Joshua Nelson (Aug 06 2020 at 21:05, on Zulip):

because it doesn't say that it's a constant before changing it

Joshua Nelson (Aug 06 2020 at 21:06, on Zulip):

I guess it's not a big deal

Yuki Okushi (Aug 06 2020 at 21:06, on Zulip):

so adding span_note then span_suggestion works here?

Joshua Nelson (Aug 06 2020 at 21:08, on Zulip):

(rebuilding, one sec)

Joshua Nelson (Aug 06 2020 at 21:09, on Zulip):

nope

error: incompatible link kind for `f`
  --> src/test/rustdoc-ui/intra-links-disambiguator-mismatch.rs:64:14
   |
64 | /// Link to [const@f]
   |              ^^^^^^^ help: to link to the function, use its disambiguator: `f()`
   |
note: this link resolved to a function, which is not a constant
  --> src/test/rustdoc-ui/intra-links-disambiguator-mismatch.rs:64:14
   |
64 | /// Link to [const@f]
   |              ^^^^^^^
Joshua Nelson (Aug 06 2020 at 21:09, on Zulip):

and it also prints the span twice which is slightly less clear

Joshua Nelson (Aug 06 2020 at 21:09, on Zulip):

I'll just keep it as-is

Yuki Okushi (Aug 06 2020 at 21:11, on Zulip):

ugh, sorry I couldn't help you :(

Joshua Nelson (Aug 06 2020 at 21:12, on Zulip):

it's ok, it still looks decent :)

Joshua Nelson (Aug 06 2020 at 21:12, on Zulip):

I spent a long time on it last night haha https://github.com/rust-lang/rust/pull/75079#discussion_r465452985

Josh Triplett (Aug 11 2020 at 22:05, on Zulip):

@Joshua Nelson Could you extend the actual error message to say something like incompatible link kind for `f` (function, not const)?

Joshua Nelson (Aug 11 2020 at 22:32, on Zulip):

Probably, I was just going to let it go though haha

Josh Triplett (Aug 12 2020 at 03:49, on Zulip):

I really like the amount of effort that Rust goes to to make clear error messages, and I appreciated the effort you were going to, so I figured I'd try to find a solution. ;)

Last update: Jan 22 2021 at 13:15UTC