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 upCompile fail stable #43949
Conversation
rust-highfive
assigned
alexcrichton
Aug 17, 2017
GuillaumeGomez
force-pushed the
GuillaumeGomez:compile_fail_stable
branch
from
1c52987
to
a81681c
Aug 17, 2017
This comment has been minimized.
This comment has been minimized.
|
I'm a big fan of having "this doesn't compile" on stable, but as per our historical gripes with compile-fail tests, I'm not sure if we should allow stable code to check error codes, since I'm like 99.9% sure those aren't stable (in that something may stop compiling for a different reason). |
GuillaumeGomez
referenced this pull request
Aug 17, 2017
Closed
Add a cfail mode for doc comments #24565
This comment has been minimized.
This comment has been minimized.
|
If there is a consensus for not stabilizing the error code check, I'll just remove the second commit. |
This comment has been minimized.
This comment has been minimized.
|
Has this been discussed for stabilization? Was this discussed with @rust-lang/dev-tools? I would personally still be against stabilizing error codes, and do we have sufficient documentation to stabilize this feature as well? |
This comment has been minimized.
This comment has been minimized.
|
cc #42288 for documentation (https://github.com/rust-lang/rust/blob/master/src/doc/rustdoc/src/documentation-tests.md) |
GuillaumeGomez
force-pushed the
GuillaumeGomez:compile_fail_stable
branch
from
a81681c
to
a52176f
Aug 22, 2017
This comment has been minimized.
This comment has been minimized.
|
Ok so I removed the error codes from the stabilization and added the doc for the |
This comment has been minimized.
This comment has been minimized.
|
Are there any tests for this in the |
This comment has been minimized.
This comment has been minimized.
rust-highfive
assigned
nrc
and unassigned
alexcrichton
Aug 22, 2017
This comment has been minimized.
This comment has been minimized.
|
The tests are literally all over the docs. Where would you want me to add them? |
This comment has been minimized.
This comment has been minimized.
|
Can you add a unit test for this in |
arielb1
added
the
S-waiting-on-review
label
Aug 22, 2017
This comment has been minimized.
This comment has been minimized.
|
Sure. |
frewsxcv
reviewed
Aug 23, 2017
| ```text | ||
| /// Some documentation. | ||
| # fn foo() {} | ||
| ``` |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
QuietMisdreavus
Aug 24, 2017
Member
But that's not the point. The point is to show what happens when you hide a line with #, not to highlight the text differently.
This comment has been minimized.
This comment has been minimized.
QuietMisdreavus
Aug 24, 2017
Member
also it caused a travis failure:
[01:04:47] ---- /checkout/src/doc/rustdoc/src/documentation-tests.md - Documentation_tests (line 68) stdout ----
[01:04:47] error: unknown start of token: `
steveklabnik
referenced this pull request
Aug 23, 2017
Closed
Add dev-tools peer groups to rfcbot #153
nrc
added
T-dev-tools
I-nominated
labels
Aug 24, 2017
This comment has been minimized.
This comment has been minimized.
|
I don't think we can yet get an auto-rfc-bot thing for the dev-tools/docs team, so manually. I propose we should accept this (stabilise the flag) - seems like a fairly harmless feature that has not changed in the last 1.5 years and is considered useful by some people. Please sign off - @michaelwoerister @killercup @QuietMisdreavus @steveklabnik @jonathandturner @japaric |
This comment has been minimized.
This comment has been minimized.
|
I approve this change. In the docs team meeting yesterday, we mentioned that it might be prudent to include a note in the documentation stating that "this code doesn't compile" isn't guaranteed to be stable from release to release. Language features like NLL, struct field init shorthand, using a nightly feature without a feature flag (if it's stabilized as-is), etc, can make code that was previously broken start compiling. Making it explicit that some things may change between releases would be helpful in terms of cutting down on "where is this documented" questions. |
carols10cents
added
S-waiting-on-author
and removed
S-waiting-on-review
labels
Aug 28, 2017
arielb1
added
S-waiting-on-team
and removed
S-waiting-on-author
labels
Aug 29, 2017
GuillaumeGomez
force-pushed the
GuillaumeGomez:compile_fail_stable
branch
from
a52176f
to
e8da3e1
Sep 1, 2017
This comment has been minimized.
This comment has been minimized.
|
I think I made the changes you required @QuietMisdreavus. Or did I miss anything? |
GuillaumeGomez
force-pushed the
GuillaumeGomez:compile_fail_stable
branch
from
e8da3e1
to
56fb9ef
Sep 2, 2017
QuietMisdreavus
reviewed
Sep 2, 2017
| @@ -136,7 +149,7 @@ explanation. | |||
| Another case where the use of `#` is handy is when you want to ignore | |||
| error handling. Lets say you want the following, | |||
|
|
|||
| ```rust,ignore | |||
| ```rust | |||
This comment has been minimized.
This comment has been minimized.
QuietMisdreavus
Sep 2, 2017
Member
Note that taking the ignore off of this keeps making the test fail, because it's a doc comment that doesn't document anything.
This comment has been minimized.
This comment has been minimized.
| @@ -233,6 +246,16 @@ not actually pass as a test. | |||
| # fn foo() {} | |||
| ``` | |||
|
|
|||
| `compile_fail` tells `rustdoc` that the compilation should fail. If it | |||
| compiles, then the test will fail. | |||
This comment has been minimized.
This comment has been minimized.
QuietMisdreavus
Sep 2, 2017
Member
Still looking for a note here about how things may start compiling in later releases.
| @@ -16,6 +16,19 @@ The basic idea is this: | |||
| The triple backticks start and end code blocks. If this were in a file named `foo.rs`, | |||
| running `rustdoc --test foo.rs` will extract this example, and then run it as a test. | |||
|
|
|||
| Please note that by default, if no language is set for the block code, `rustdoc` | |||
| assumes it is `Rust` code. So the following: | |||
This comment has been minimized.
This comment has been minimized.
QuietMisdreavus
Sep 2, 2017
Member
This block doesn't seem related to the rest of this PR? Like, it's worth noting, but it's not part of "making compile_fail stable".
This comment has been minimized.
This comment has been minimized.
GuillaumeGomez
force-pushed the
GuillaumeGomez:compile_fail_stable
branch
2 times, most recently
from
a2f7aa5
to
82c04af
Sep 2, 2017
QuietMisdreavus
reviewed
Sep 2, 2017
| @@ -233,6 +246,17 @@ not actually pass as a test. | |||
| # fn foo() {} | |||
| ``` | |||
|
|
|||
| `compile_fail` tells `rustdoc` that the compilation should fail. If it | |||
| compiles, then the test will fail. However please note that a code | |||
| failing with the current rustc version may works in a future release. | |||
This comment has been minimized.
This comment has been minimized.
QuietMisdreavus
Sep 2, 2017
Member
Light phrasing nit: "However please note that code failing with the current Rust release may work in a future release, as new features are added."
GuillaumeGomez
force-pushed the
GuillaumeGomez:compile_fail_stable
branch
from
82c04af
to
a6ab711
Sep 2, 2017
QuietMisdreavus
reviewed
Sep 2, 2017
|
More travis failures |
|
|
||
| ```rust | ||
| let x = 5; | ||
| ``` |
This comment has been minimized.
This comment has been minimized.
QuietMisdreavus
Sep 2, 2017
Member
Don't indent these docblocks. It's treating the ``` as part of the doctest and failing to parse it.
| /// let x = 5; | ||
| /// x += 2; // shouldn't compile! | ||
| /// ``` | ||
| ``` |
This comment has been minimized.
This comment has been minimized.
QuietMisdreavus
Sep 2, 2017
Member
"Documentation comment that doesn't document anything"
Probably good to stick ignore on this one.
GuillaumeGomez
added some commits
Aug 22, 2017
GuillaumeGomez
force-pushed the
GuillaumeGomez:compile_fail_stable
branch
from
a6ab711
to
ebc195d
Sep 3, 2017
This comment has been minimized.
This comment has been minimized.
|
Finally all good! |
This comment has been minimized.
This comment has been minimized.
|
Any news in here? |
This comment has been minimized.
This comment has been minimized.
|
ping the @rust-lang/dev-tools team for signoffs; here's some manual ticky boxes for you: |
This comment has been minimized.
This comment has been minimized.
|
Assuming all the stuff from #43949 (comment) is addressed (it appears so), LGTM. @carolbot reviewed |
This comment has been minimized.
This comment has been minimized.
|
@rfcbot reviewed |
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
added a commit
that referenced
this pull request
Sep 15, 2017
This comment has been minimized.
This comment has been minimized.
|
|
GuillaumeGomez commentedAug 17, 2017
•
edited
Since #30726, we never made the
compile_failflag nor the error code check stable. I think it's time to change this fact.r? @alexcrichton