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

Improve the Pulldown/hoedown warnings #44238

Merged
merged 6 commits into from
Sep 1, 2017
Merged

Conversation

nrc
Copy link
Member

@nrc nrc commented Sep 1, 2017

@nrc
Copy link
Member Author

nrc commented Sep 1, 2017

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.

Couple questions

if !markdown_warnings.is_empty() {
println!("WARNING: documentation for this crate may be rendered \
differently using the new Pulldown renderer.");
println!(" See https://github.com/rust-lang/rust/issues/44229 for details.");
Copy link
Member

Choose a reason for hiding this comment

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

Do we want all these println!s to be on stdout or stderr?

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted them to be on stderr, but using eprintln gave no output - I'm not sure if Rustbuild or something else is swallowing stderr. I can try again to confirm I wasn't missing something, but I fear we may be stuck with stdout.

Copy link
Member

Choose a reason for hiding this comment

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

If that's the case i won't object. I'm not sure if rustdoc has printed anything that didn't come from a panic before now.


// A short, single-line view of `s`.
fn concise_str(s: &str) -> String {
if s.contains('\n') {
Copy link
Member

Choose a reason for hiding this comment

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

From the rest of the diff, i'm assuming that the text fed to this function has always been run through one of the renderers. Can either of them use Windows line endings? Does it matter?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, I can adjust that.

Copy link
Member

Choose a reason for hiding this comment

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

Just using something like .lines().next() would catch it, i assume.

@QuietMisdreavus
Copy link
Member

From conversation on IRC, it seems like stderr is getting swallowed somewhere along the line. Possibly worth investigating, but not now. r=me pending travis.

scx: &SharedContext)
-> fmt::Result {
let hoedown_output = format!("{}", Markdown(md_text, RenderType::Hoedown));
// We only emit warnings if the user has opted-in to Pulldown rendering.
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand: you said you wanted warnings all the time and it was one of the reasons to delay the merge. Why this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

The core team thought that we should have this off by default until we've investigated (and probably remedied) the false positives and also communicated that these warnings are going to happen, so as not to surprise users. Sorry, for the back and forth here - my bad for not checking with the core team before asking to turn on by default.

write!(w, "<div class='docblock'>{}{}</div>", prefix, output)
}

// Returns true iff s1 and s2 match, ignoring whitespace.
Copy link
Member

Choose a reason for hiding this comment

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

"iff"

Copy link
Member Author

Choose a reason for hiding this comment

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

It's an abbreviation for 'if and only if'

This is just undoing changes from rust-lang#41991 because we are not running markdown rendering twice.
@nrc
Copy link
Member Author

nrc commented Sep 1, 2017

@bors: r=@QuietMisdreavus p=10

@bors
Copy link
Contributor

bors commented Sep 1, 2017

📌 Commit 1d6d09f has been approved by @QuietMisdreavus

@bors
Copy link
Contributor

bors commented Sep 1, 2017

⌛ Testing commit 1d6d09f with merge 54793738b28b1495d20de370b03381e0a0e3ceb4...

@bors
Copy link
Contributor

bors commented Sep 1, 2017

💔 Test failed - status-travis

@kennytm
Copy link
Member

kennytm commented Sep 1, 2017

@bors retry #44221.

[00:34:47]    Compiling rustc_save_analysis v0.0.0 (file:///Users/travis/build/rust-lang/rust/src/librustc_save_analysis)
[00:34:54]    Compiling rustc_borrowck v0.0.0 (file:///Users/travis/build/rust-lang/rust/src/librustc_borrowck)
No output has been received in the last 30m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
The build has been terminated

// A short, single-line view of `s`.
fn concise_str(s: &str) -> String {
if s.contains('\n') {
return format!("{}...", s.lines().next().expect("Impossible! We just found a newline"));
Copy link
Member

Choose a reason for hiding this comment

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

If the first line is really long then this should probably only print the start of it like the case below.

return format!("{}...", s.lines().next().expect("Impossible! We just found a newline"));
}
if s.len() > 70 {
return format!("{} ... {}", &s[..50], &s[s.len()-20..]);
Copy link
Member

Choose a reason for hiding this comment

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

This will panic if 50 or s.len()-20 isn't on a character boundary.

_ => true,
}
})
.collect::<Vec<_>>();
Copy link
Member

Choose a reason for hiding this comment

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

Vec::retain would be cleaner.

assert!(match_non_whitespace("abc xyz", "abc xyz"));
assert!(match_non_whitespace("abc xyz", "abc\nxyz"));
assert!(match_non_whitespace("abc xyz", "abcxyz"));
assert!(match_non_whitespace("abcxyz", "abc xyz"));
Copy link
Member

Choose a reason for hiding this comment

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

Why would these be considered equal? match_non_whitespace is almost identical to s1.split_whitespace().eq(s2.split_whitespace()) except for the two cases above. However, the whitepace should be handled in html_diff anyway as whether it matters depends on the context. For example whitespace is very important inside <pre> tags.

@bors
Copy link
Contributor

bors commented Sep 1, 2017

⌛ Testing commit 1d6d09f with merge ed532c0...

bors added a commit that referenced this pull request Sep 1, 2017
@bors
Copy link
Contributor

bors commented Sep 1, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: @QuietMisdreavus
Pushing ed532c0 to master...

@bors bors merged commit 1d6d09f into rust-lang:master Sep 1, 2017
nrc added a commit to nrc/rust that referenced this pull request Sep 5, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Sep 9, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Sep 9, 2017
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Sep 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants