Stream: t-compiler/help

Topic: `span_help` appears on separate line


Camelid (Jun 14 2020 at 20:05, on Zulip):

I switched over from using span_suggestion to span_help, but now the message appears on a separate line:

error: the `att_syntax` option was already provided
  --> rust-issue-73193.rs:10:21
   |
10 |             options(att_syntax),
   |                     ^^^^^^^^^^
   |
help: remove this option
  --> rust-issue-73193.rs:10:21
   |
10 |             options(att_syntax),
   |                     ^^^^^^^^^^

Previously (with span_suggestion) it looked like:

error: the `att_syntax` option was already provided
  --> rust-issue-73193.rs:10:21
   |
10 |             options(att_syntax),
   |                     ^^^^^^^^^^ help: remove this option
Camelid (Jun 14 2020 at 20:15, on Zulip):

Why is that happening and is there a way to get it to appear in one message like how it was with span_suggestion?

Camelid (Jun 15 2020 at 19:09, on Zulip):

@Amanieu suggested using span_label instead, which has almost the same output as before

mark-i-m (Jun 15 2020 at 23:31, on Zulip):

cc @Esteban Küber ^^?

Esteban Küber (Jun 15 2020 at 23:34, on Zulip):

Yes, you seem to be wanting span_label. Why is it no longer a structured suggestion? Inaccurate span?

Camelid (Jun 16 2020 at 02:57, on Zulip):

@Esteban Küber Because I thought it was machine-applicable, but it's actually not because it would change options(att_syntax, att_syntax, nomem) into options(att_syntax, , nomem) :(

Esteban Küber (Jun 16 2020 at 18:31, on Zulip):

If you can get access to the span of the comma you can do span.to(comma.span)

Esteban Küber (Jun 16 2020 at 18:31, on Zulip):

And make it a verbose or tool only suggestion

Esteban Küber (Jun 16 2020 at 18:32, on Zulip):

Otherwise a span label can be enough

Esteban Küber (Jun 16 2020 at 18:32, on Zulip):

If you have access to the spa. Of nomem you can instead use .until(sp)

Esteban Küber (Jun 16 2020 at 18:33, on Zulip):

@Camelid ^

Camelid (Jun 16 2020 at 18:40, on Zulip):

@Esteban Küber I'm actually going back to using span_suggestion with Applicability::Unspecified. Unfortunately, I think it would be hard to get access to the span of the comma, and I think it might be too complicated for an error that probably won't occur too often.

Camelid (Jun 16 2020 at 18:40, on Zulip):

What did you mean by "Of nomem you can instead use .until(sp)"?

Amanieu (Jun 16 2020 at 18:54, on Zulip):

@Camelid Maybe try using the look_ahead method on the parser to see if the next token is a comma and then include that in the span?

Camelid (Jun 16 2020 at 18:57, on Zulip):

@Amanieu Okay, I'll look into that

Last update: Sep 27 2020 at 14:30UTC