-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Add option to display warnings in rustdoc #41678
Changes from 1 commit
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 |
---|---|---|
|
@@ -150,7 +150,7 @@ pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches, | |
/// Run any tests/code examples in the markdown file `input`. | ||
pub fn test(input: &str, cfgs: Vec<String>, libs: SearchPaths, externs: Externs, | ||
mut test_args: Vec<String>, maybe_sysroot: Option<PathBuf>, | ||
render_type: RenderType) -> isize { | ||
render_type: RenderType, display_warnings: bool) -> isize { | ||
let input_str = match load_string(input) { | ||
Ok(s) => s, | ||
Err(LoadStringError::ReadFail) => return 1, | ||
|
@@ -166,6 +166,9 @@ pub fn test(input: &str, cfgs: Vec<String>, libs: SearchPaths, externs: Externs, | |
old_find_testable_code(&input_str, &mut collector, DUMMY_SP); | ||
find_testable_code(&input_str, &mut collector, DUMMY_SP); | ||
test_args.insert(0, "rustdoctest".to_string()); | ||
if display_warnings { | ||
test_args.insert(1, "--display-stdout".to_string()); | ||
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. How come this was added? I thought rustc output went to stderr? 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. The name of the tag is up to debate. I'm using it to make the difference between warnings and errors, but it's clearly misleading. What name should we give it? 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 I may not even understand what this is doing. What is it doing? 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 for now, when running 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. Then why not call it 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. @GuillaumeGomez that's not too helpful of a description, though? You're basically just restating the title and description of this PR. This flag is implemented inside of libtest which means that it has nothing to do with doctest warnings, and is an instantly stable interface to all test binaries that we generate, hence my hesitation. If we can avoid it that would be great, but I do not understand what this flag is doing inside of the test harness. Can you explain what's going on inside of libtest to why this is being passed? 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. Aaaaah. My bad. So basically, in libtest, if I have 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. Can this be done without exposing a new flag from libtest? Just by modifying internal data structures or using a custom api from libtest? |
||
} | ||
testing::test_main(&test_args, collector.tests); | ||
0 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you open a tracking issue for this as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean besides the one already opened? (in the PR description)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that can suffice, but then this PR should not close that issue.