Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile fail stable #43949

Merged
merged 3 commits into from
Sep 15, 2017
Merged

Compile fail stable #43949

merged 3 commits into from
Sep 15, 2017

Conversation

GuillaumeGomez
Copy link
Member

@GuillaumeGomez GuillaumeGomez commented Aug 17, 2017

Since #30726, we never made the compile_fail flag nor the error code check stable. I think it's time to change this fact.

r? @alexcrichton

@Gankra
Copy link
Contributor

Gankra commented Aug 17, 2017

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
Copy link
Member Author

If there is a consensus for not stabilizing the error code check, I'll just remove the second commit.

@alexcrichton
Copy link
Member

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?

@kennytm
Copy link
Member

kennytm commented Aug 17, 2017

@GuillaumeGomez
Copy link
Member Author

Ok so I removed the error codes from the stabilization and added the doc for the compile_fail directive (and improved the doc a bit too).

@alexcrichton
Copy link
Member

Are there any tests for this in the src/test/rustdoc folder? I'd expect that if we had existing tests this'd remove the feature gates from those tests.

@alexcrichton
Copy link
Member

I'll I'm going to defer to @nrc for review as I think the dev-tools team will want to sign off on this.

r? @nrc

@rust-highfive rust-highfive assigned nrc and unassigned alexcrichton Aug 22, 2017
@GuillaumeGomez
Copy link
Member Author

The tests are literally all over the docs. Where would you want me to add them?

@alexcrichton
Copy link
Member

Can you add a unit test for this in src/test/rustdoc to ensure that it doesn't require a feature gate?

@arielb1 arielb1 added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 22, 2017
@GuillaumeGomez
Copy link
Member Author

Sure.

```text
/// Some documentation.
# fn foo() {}
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did these get indented?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be able to see the backticks when rendered.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: `

@nrc nrc added T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. I-nominated labels Aug 24, 2017
@nrc
Copy link
Member

nrc commented Aug 24, 2017

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

@QuietMisdreavus
Copy link
Member

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 carols10cents added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 28, 2017
@arielb1 arielb1 added S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 29, 2017
@GuillaumeGomez
Copy link
Member Author

I think I made the changes you required @QuietMisdreavus. Or did I miss anything?

@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that taking the ignore off of this keeps making the test fail, because it's a doc comment that doesn't document anything.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erf, good point!

@@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want me to put this change in another commit?

@GuillaumeGomez GuillaumeGomez force-pushed the compile_fail_stable branch 2 times, most recently from a2f7aa5 to 82c04af Compare September 2, 2017 20:03
@@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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."

Copy link
Member

@QuietMisdreavus QuietMisdreavus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More travis failures


```rust
let x = 5;
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!
/// ```
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Documentation comment that doesn't document anything"

Probably good to stick ignore on this one.

@GuillaumeGomez
Copy link
Member Author

Finally all good!

@QuietMisdreavus QuietMisdreavus mentioned this pull request Sep 7, 2017
@GuillaumeGomez
Copy link
Member Author

Any news in here?

@carols10cents
Copy link
Member

carols10cents commented Sep 11, 2017

ping the @rust-lang/dev-tools team for signoffs; here's some manual ticky boxes for you:

@killercup
Copy link
Member

Assuming all the stuff from #43949 (comment) is addressed (it appears so), LGTM.

@CAROLBOT reviewed

@michaelwoerister
Copy link
Member

@rfcbot reviewed

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Sep 14, 2017

📌 Commit ebc195d has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Sep 15, 2017

⌛ Testing commit ebc195d with merge fd4bef5...

bors added a commit that referenced this pull request Sep 15, 2017
…hton

Compile fail stable

Since #30726, we never made the `compile_fail` flag nor the error code check stable. I think it's time to change this fact.

r? @alexcrichton
@bors
Copy link
Contributor

bors commented Sep 15, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing fd4bef5 to master...

@bors bors merged commit ebc195d into rust-lang:master Sep 15, 2017
@GuillaumeGomez GuillaumeGomez deleted the compile_fail_stable branch September 15, 2017 12:56
@alexcrichton alexcrichton added the relnotes Marks issues that should be documented in the release notes of the next release. label Sep 15, 2017
@apiraino apiraino removed the S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). label May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Marks issues that should be documented in the release notes of the next release. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.