Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upUse different numbers of `#`s when expanding documentation comments #27499
Conversation
rust-highfive
assigned
huonw
Aug 3, 2015
This comment has been minimized.
This comment has been minimized.
|
r? @huonw (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
|
This solution seems ok since the pretty-printer isn't relied on for its fidelity, but an alternate approach would be to store this information somewhere so the roundtrip doesn't lose information. Edit: I think I misunderstood this patch. |
This comment has been minimized.
This comment has been minimized.
|
By looking at the test case exercising this with |
This comment has been minimized.
This comment has been minimized.
|
By stable rust source, you mean code will actually stop compiling? |
This comment has been minimized.
This comment has been minimized.
|
@huonw I don't know, maybe. The same way barosol can verify that the pretty printer (which is mostly not part of the Rust language itself) behaves this way via a test case, I'm imagining somebody might be able to write code that compiles and runs that can also detect this behavior - in which case the exact behavior requires more careful consideration than an implementation detail would. |
This comment has been minimized.
This comment has been minimized.
|
Yeah, I guess code could theoretically have an |
This comment has been minimized.
This comment has been minimized.
|
Yes, agree it's better, but not sure if it's the solution that we want to put in the spec. Maybe we can get some other eyes. |
brson
added
T-lang
I-needs-decision
labels
Aug 5, 2015
This comment has been minimized.
This comment has been minimized.
|
So, the thing is that the "encoding" of documentation comments in macros has already been changed heavily recently.
Therefore, the problems I think are:
|
This comment has been minimized.
This comment has been minimized.
|
@rust-lang/lang, this has been waiting on a decision for two (almost three) months now. |
This comment has been minimized.
This comment has been minimized.
|
nominating |
pnkfelix
added
the
I-nominated
label
Oct 28, 2015
This comment has been minimized.
This comment has been minimized.
|
Discussed at lang team meeting. Consensus was: I do think @brson raised a good point, but I also feel comfortable with this solution. It seems like a strict improvement on the status quo -- we desugar |
nikomatsakis
removed
I-needs-decision
I-nominated
labels
Oct 30, 2015
This comment has been minimized.
This comment has been minimized.
|
@barosl would you mind adding the comments that @nikomatsakis referred to, before we merge this? |
This comment has been minimized.
This comment has been minimized.
|
Ok, so I guess Also, do you think this PR itself is a breaking change? In that case, I will have to append |
This comment has been minimized.
This comment has been minimized.
|
@barosl I don't consider this a breaking change, personally. It seems POSSIBLE that someone is relying on this, but highly unlikely, so an annotation seems more likely to produce noise than be of use. But others may have another POV. |
This comment has been minimized.
This comment has been minimized.
|
I feel the same as @nikomatsakis |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Was there a decision on this? |
This comment has been minimized.
This comment has been minimized.
|
@durka yes: #27499 (comment) PR is considered OK. |
This comment has been minimized.
This comment has been minimized.
|
@barosl can you rebase this so we can FINALLY get it merged? :) |
barosl
force-pushed the
barosl:macro-doc-raw-str-hashes
branch
from
8597e59
to
928fdb2
Jan 18, 2016
barosl
force-pushed the
barosl:macro-doc-raw-str-hashes
branch
from
928fdb2
to
1a8cdc0
Jan 18, 2016
barosl
reviewed
Jan 18, 2016
| @@ -365,6 +365,9 @@ pub mod builtin { | |||
| /// stringification of all the tokens passed to the macro. No restrictions | |||
| /// are placed on the syntax of the macro invocation itself. | |||
| /// | |||
| /// Note that the expanded results of the input tokens may change in the | |||
| /// future. You should be careful if you rely on the output. | |||
| /// | |||
This comment has been minimized.
This comment has been minimized.
barosl
Jan 18, 2016
Author
Contributor
Rebased, sorry for the huge delay.
Also I added this comment. Please tell me if it lacks some information.
This comment has been minimized.
This comment has been minimized.
|
(ping) Does this just need a re-review to move forward? |
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@bors rollup |
barosl commentedAug 3, 2015
Any documentation comments that contain raw-string-looking sequences may pretty-print invalid code when expanding them, as the current logic always uses the
r"literal"form, without appending any#s.This commit calculates the minimum number of
#s required to wrap a comment correctly and appends#s appropriately.Fixes #27489.