Uh oh!
There was an error while loading. Please reload this page.
Improve the Pulldown/hoedown warnings - #44238
Conversation
Also checks for differences after eliminating whitespace-only diffs. Renames get_html_diff
nrc
commented
Sep 1, 2017
Sample output: https://gist.github.com/nrc/e4ba8c465a5174daa616361705bf14c1 c.f., old output: https://gist.github.com/nrc/bb73f63a2a87d29ed7e10609a81ceb64 |
| 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."); |
There was a problem hiding this comment.
Do we want all these println!s to be on stdout or stderr?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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') { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Just using something like .lines().next() would catch it, i assume.
QuietMisdreavus
commented
Sep 1, 2017
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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
commented
Sep 1, 2017
@bors: r=@QuietMisdreavus p=10 |
bors
commented
Sep 1, 2017
📌 Commit 1d6d09f has been approved by |
bors
commented
Sep 1, 2017
⌛ Testing commit 1d6d09f with merge 54793738b28b1495d20de370b03381e0a0e3ceb4... |
bors
commented
Sep 1, 2017
💔 Test failed - status-travis |
kennytm
commented
Sep 1, 2017
|
| // 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")); |
There was a problem hiding this comment.
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..]); |
There was a problem hiding this comment.
This will panic if 50 or s.len()-20 isn't on a character boundary.
| _ => true, | ||
| } | ||
| }) | ||
| .collect::<Vec<_>>(); |
| 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")); |
There was a problem hiding this comment.
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
commented
Sep 1, 2017
Improve the Pulldown/hoedown warnings cc #44229 r? @QuietMisdreavus
bors
commented
Sep 1, 2017
☀️ Test successful - status-appveyor, status-travis |
Fixup some nits from rust-lang#44238 r? @ollie27
Fixup some nits from rust-lang#44238 r? @ollie27
Fixup some nits from rust-lang#44238 r? @ollie27
cc #44229
r? @QuietMisdreavus