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

Filter linkcheck spurious failure #63927

Merged
merged 4 commits into from
Sep 7, 2019
Merged

Conversation

mark-i-m
Copy link
Member

r? @ehuss

cc @spastorino

Basically, we filter errors with messages containing "timed out"... a bit of a hack, but hopefully this will be functionality built into linkcheck soon.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 26, 2019
@mark-i-m
Copy link
Member Author

Oh, also, I accidentally ran rustfmt... sorry. I can recreate the PR if its better.

@ehuss
Copy link
Contributor

ehuss commented Aug 27, 2019

error[E0599]: no method named `contains` found for type `&std::boxed::Box<dyn mdbook_linkcheck::errors::BrokenLink>` in the current scope
  --> src/tools/rustbook/src/main.rs:68:38
   |
68 |                             if cause.contains("timed out") {
   |                                      ^^^^^^^^

Also, unless I'm reading it wrong, it seems to do the opposite of what you're saying? It only exits 101 if it contains "timed out"?

@mark-i-m
Copy link
Member Author

@ehuss Fixed bugs, and cleaned up a little.

@spastorino We can't use cfg! because then the then block would still unconditionally depend on the mdbook_linkcheck dependency.

@ehuss
Copy link
Contributor

ehuss commented Aug 30, 2019

This still doesn't seem to compile for me?

error[E0308]: mismatched types
  --> src/tools/rustbook/src/main.rs:63:40
   |
63 |                             .unwrap_or(false)
   |                                        ^^^^^ expected struct `mdbook_linkcheck::errors::BrokenLinks`, found bool
   |
   = note: expected type `mdbook_linkcheck::errors::BrokenLinks`
              found type `bool`

error[E0599]: no method named `contains` found for type `&std::boxed::Box<dyn mdbook_linkcheck::errors::BrokenLink>` in the current scope
  --> src/tools/rustbook/src/main.rs:67:49
   |
67 |                             .any(|cause| !cause.contains("timed out"));
   |                                                 ^^^^^^^^

error[E0308]: mismatched types
  --> src/tools/rustbook/src/main.rs:76:20
   |
76 |                 if actually_broken {
   |                    ^^^^^^^^^^^^^^^
   |                    |
   |                    expected bool, found ()
   |                    in this expansion of `desugaring of `if` or `while` condition`
   |                    in this macro invocation
   |
   = note: expected type `bool`
              found type `()`

@mark-i-m
Copy link
Member Author

Arg :( I forgot to compile with the feature flag enabled. It should work now, though it's a bit uglier.

@ehuss Thank you

broken_links
.links()
.iter()
.inspect(|cause| eprintln!("\tCaused By: {}", cause))
Copy link
Contributor

Choose a reason for hiding this comment

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

This changes it so that only the first error will be displayed. Can it be changed so that it still displays all errors?

Also, it looks like 0.4 was released, which uses a significantly different API. What is the plan to update that?

Copy link
Member Author

Choose a reason for hiding this comment

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

This changes it so that only the first error will be displayed. Can it be changed so that it still displays all errors?

Ah, good catch. Done.

What is the plan to update that?

We haven't really updated yet on the rustc-guide repo. I need to take a look at the PR, but haven't had time. The main advantage would be the ability to take advantage of caching. I'm not sure that's a can of worms I want to open on this repo, though. It was hard enough to get what we have working...

::std::process::exit(101);
#[cfg(not(feature = "linkcheck"))]
{
false
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be unreachable!, just to be clear?

Copy link
Member

Choose a reason for hiding this comment

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

It's not unreachable, or am I wrong?. The idea is that actually_broken is set to false when not using the linkcheck feature.

Copy link
Contributor

Choose a reason for hiding this comment

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

The linkcheck() function never returns Err, so this code block shouldn't ever be entered, if I'm reading it correctly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm... true. I did a bit of refactoring so we avoid calling it all. It's a bit annoying to try to avoid triggering unused_* lints.

@mark-i-m
Copy link
Member Author

mark-i-m commented Sep 5, 2019

@ehuss Ok, maybe I got it right this time...

@ehuss
Copy link
Contributor

ehuss commented Sep 6, 2019

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 6, 2019

📌 Commit bad8147 has been approved by ehuss

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 6, 2019
Centril added a commit to Centril/rust that referenced this pull request Sep 7, 2019
Filter linkcheck spurious failure

r? @ehuss

cc @spastorino

Basically, we filter errors with messages containing "timed out"... a bit of a hack, but hopefully this will be functionality built into linkcheck soon.
bors added a commit that referenced this pull request Sep 7, 2019
Rollup of 10 pull requests

Successful merges:

 - #63919 (Use hygiene for AST passes)
 - #63927 (Filter linkcheck spurious failure)
 - #64149 (rustc_codegen_llvm: give names to non-alloca variable values.)
 - #64192 (Bail out when encountering likely missing turbofish in parser)
 - #64231 (Move the HIR CFG to `rustc_ast_borrowck`)
 - #64233 (Correct pluralisation of various diagnostic messages)
 - #64236 (reduce visibility)
 - #64240 (Include compiler-rt in the source tarball)
 - #64241 ([doc] Added more prereqs and note about default directory)
 - #64243 (Move injection of attributes from command line to `libsyntax_ext`)

Failed merges:

r? @ghost
@bors bors merged commit bad8147 into rust-lang:master Sep 7, 2019
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Nov 11, 2019
Pkgsrc changes:
 * Remove patch which no longer applies (but what about RPATH?)
 * Adapt a few patches to changed files upstream.

Upstream changes:

Version 1.39.0 (2019-11-07)
===========================

Language
--------
- [You can now create `async` functions and blocks with `async fn`,
  `async move {}`, and `async {}` respectively, and you can now call
  `.await` on async expressions.][63209]
- [You can now use certain attributes on function, closure, and function
  pointer parameters.][64010] These attributes include `cfg`, `cfg_attr`,
  `allow`, `warn`, `deny`, `forbid` as well as inert helper attributes used
  by procedural macro attributes applied to items. e.g.
  ```rust
  fn len(
      #[cfg(windows)] slice: &[u16],
      #[cfg(not(windows))] slice: &[u8],
  ) -> usize {
      slice.len()
  }
  ```
- [You can now take shared references to bind-by-move patterns in the
  `if` guards of `match` arms.][63118] e.g.
  ```rust
  fn main() {
      let array: Box<[u8; 4]> = Box::new([1, 2, 3, 4]);

      match array {
          nums
  //      ---- `nums` is bound by move.
              if nums.iter().sum::<u8>() == 10
  //                 ^------ `.iter()` implicitly takes a reference to `nums`.
          => {
              drop(nums);
  //          ----------- Legal as `nums` was bound by move and so we have ownership.
          }
          _ => unreachable!(),
      }
  }
  ```

Compiler
--------
- [Added tier 3\* support for the `i686-unknown-uefi` target.][64334]
- [Added tier 3 support for the `sparc64-unknown-openbsd` target.][63595]
- [rustc will now trim code snippets in diagnostics to fit in your terminal.]
  [63402] **Note** Cargo currently doesn't use this feature. Refer to
  [cargo#7315][cargo/7315] to track this feature's progress.
- [You can now pass `--show-output` argument to test binaries to print the
  output of successful tests.][62600]

\* Refer to Rust's [platform support page][forge-platform-support] for more
information on Rust's tiered platform support.

Libraries
---------
- [`Vec::new` and `String::new` are now `const` functions.][64028]
- [`LinkedList::new` is now a `const` function.][63684]
- [`str::len`, `[T]::len` and `str::as_bytes` are now `const` functions.][63770]
- [The `abs`, `wrapping_abs`, and `overflowing_abs` numeric functions are
  now `const`.][63786]

Stabilized APIs
---------------
- [`Pin::into_inner`]
- [`Instant::checked_duration_since`]
- [`Instant::saturating_duration_since`]

Cargo
-----
- [You can now publish git dependencies if supplied with a `version`.]
  [cargo/7237]
- [The `--all` flag has been renamed to `--workspace`.][cargo/7241] Using
  `--all` is now deprecated.

Misc
----
- [You can now pass `-Clinker` to rustdoc to control the linker used
  for compiling doctests.][63834]

Compatibility Notes
-------------------
- [Code that was previously accepted by the old borrow checker, but rejected by
  the NLL borrow checker is now a hard error in Rust 2018.][63565] This was
  previously a warning, and will also become a hard error in the Rust 2015
  edition in the 1.40.0 release.
- [`rustdoc` now requires `rustc` to be installed and in the same directory to
  run tests.][63827] This should improve performance when running a large
  amount of doctests.
- [The `try!` macro will now issue a deprecation warning.][62672] It is
  recommended to use the `?` operator instead.
- [`asinh(-0.0)` now correctly returns `-0.0`.][63698] Previously this
  returned `0.0`.

[62600]: rust-lang/rust#62600
[62672]: rust-lang/rust#62672
[63118]: rust-lang/rust#63118
[63209]: rust-lang/rust#63209
[63402]: rust-lang/rust#63402
[63565]: rust-lang/rust#63565
[63595]: rust-lang/rust#63595
[63684]: rust-lang/rust#63684
[63698]: rust-lang/rust#63698
[63770]: rust-lang/rust#63770
[63786]: rust-lang/rust#63786
[63827]: rust-lang/rust#63827
[63834]: rust-lang/rust#63834
[63927]: rust-lang/rust#63927
[63933]: rust-lang/rust#63933
[63934]: rust-lang/rust#63934
[63938]: rust-lang/rust#63938
[63940]: rust-lang/rust#63940
[63941]: rust-lang/rust#63941
[63945]: rust-lang/rust#63945
[64010]: rust-lang/rust#64010
[64028]: rust-lang/rust#64028
[64334]: rust-lang/rust#64334
[cargo/7237]: rust-lang/cargo#7237
[cargo/7241]: rust-lang/cargo#7241
[cargo/7315]: rust-lang/cargo#7315
[`Pin::into_inner`]: https://doc.rust-lang.org/std/pin/struct.Pin.html#method.into_inner
[`Instant::checked_duration_since`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.checked_duration_since
[`Instant::saturating_duration_since`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.saturating_duration_since
@mark-i-m mark-i-m deleted the filter-spurious branch December 11, 2019 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants