-
Notifications
You must be signed in to change notification settings - Fork 13.4k
added --no-run option for rustdoc #83857
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
Changes from all commits
db6a916
0f3efe2
a6bf81b
72f534a
b08b484
08c7f97
3ad3597
4770446
202659a
3273d2f
03c710b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// test the behavior of the --no-run flag without the --test flag | ||
|
||
// compile-flags:-Z unstable-options --no-run --test-args=--test-threads=1 | ||
ABouttefeux marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// error-pattern: the `--test` flag must be passed | ||
|
||
pub fn f() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
error: the `--test` flag must be passed to enable `--no-run` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// test the behavior of the --no-run flag | ||
|
||
// check-pass | ||
// compile-flags:-Z unstable-options --test --no-run --test-args=--test-threads=1 | ||
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR" | ||
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" | ||
|
||
/// ``` | ||
/// let a = true; | ||
/// ``` | ||
/// ```should_panic | ||
/// panic!() | ||
/// ``` | ||
/// ```ignore (incomplete-code) | ||
/// fn foo() { | ||
/// ``` | ||
/// ```no_run | ||
/// loop { | ||
/// println!("Hello, world"); | ||
/// } | ||
/// ``` | ||
/// fails to compile | ||
/// ```compile_fail | ||
/// let x = 5; | ||
/// x += 2; // shouldn't compile! | ||
/// ``` | ||
/// Ok the test does not run | ||
/// ``` | ||
/// panic!() | ||
/// ``` | ||
/// Ok the test does not run | ||
/// ```should_panic | ||
/// loop { | ||
/// println!("Hello, world"); | ||
/// panic!() | ||
/// } | ||
/// ``` | ||
pub fn f() {} |
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,12 @@ | ||||||||||||||||
|
||||||||||||||||
running 7 tests | ||||||||||||||||
test $DIR/no-run-flag.rs - f (line 11) ... ok | ||||||||||||||||
test $DIR/no-run-flag.rs - f (line 14) ... ignored | ||||||||||||||||
test $DIR/no-run-flag.rs - f (line 17) ... ok | ||||||||||||||||
test $DIR/no-run-flag.rs - f (line 23) ... ok | ||||||||||||||||
test $DIR/no-run-flag.rs - f (line 28) ... ok | ||||||||||||||||
test $DIR/no-run-flag.rs - f (line 32) ... ok | ||||||||||||||||
test $DIR/no-run-flag.rs - f (line 8) ... ok | ||||||||||||||||
Comment on lines
+3
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it didn't run why is it "ok"? IIRC that is the same as test passing right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so adding the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ping @CraftSpider @jyn514 should we have a different text? "ok" may be confusing since it didn't run. Also note that we may also want a different color or the same color as "ignored". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm. I don't think 'ignored' is quite right, but 'ok' is also a bit confusing. If we can make it something new, maybe something like 'built' or 'checked'? If not, I think 'ok' is more accurate than 'ignored'. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After investigations I think that in order to do so, I have to modify the lib test. This will also affect all tests and not just doctests. Do you think this is a worthwhile investment and should this be in a different PR ? Anyway I would be interested in implementing that but the scope is a bit bigger than I anticipated. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I agree that is confusing. Maybe a error should be raised if no_run is active and not I assume that in the original issue the final goal would be to be able to generate bin (with Or maybe a another possible case would be to unify the behavior of Now if the explicit goal is to harmonize with regular test the output should just be empty. I am new contributing for rust so I am not quite sure of what to do to solve this issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think we should give a hard error here; if people meant to run the test they can add See Lines 587 to 593 in 202659a
I think all your other changes can go in a follow-up PR, I don't think we should be changing libtest here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok thank you. I have not change libtest yet I will work on that too :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please do not change libtest in this pr. I am not a maintainer and don't know who to ask to approve; finding out will delay landing this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry I was not clear. I will do another PR for libtest |
||||||||||||||||
|
||||||||||||||||
test result: ok. 6 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME | ||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.