Commit Graph

84 Commits

Author SHA1 Message Date
Loïc BRANSTETT e346920907 Also take in account mdbook redirect in linkchecker 2022-03-09 13:45:50 +01:00
Simon Chopin 3a1ffead36 linkchecker: fix panic on directory symlinks
In Debian and Ubuntu, there are some patches that change the rustc/fonts
directory to a symlink to the system fonts. This triggers a latent bug
in linkchecker, as the DirEntry filetype isn't a dir but later on the
file itself, when opened, is one, triggering an unreachable!() clause.

This patch fixes the situation by using std::fs::metadata, which goes
through symlinks.

I'd have added a test case but `tidy` doesn't seem to like symlinks, and
moreover I'm not sure how Git deals with symlinks on Windows.

Signed-off-by: Simon Chopin <simon.chopin@canonical.com>
2022-02-11 10:45:59 +01:00
Noah Lev 865d99f82b docs: Escape brackets to satisfy the linkchecker
My change to use `Type::def_id()` (formerly `Type::def_id_full()`) in
more places caused some docs to show up that used to be missed by
rustdoc. Those docs contained unescaped square brackets, which triggered
linkcheck errors. This commit escapes the square brackets and adds this
particular instance to the linkcheck exception list.
2021-10-22 14:08:43 -07:00
Mark Rousskov c746be2219 Migrate to 2021 2021-09-20 22:21:42 -04:00
Joshua Nelson 7b46920218 Fix linkcheck issues
Most of these are because alloc uses `#[lang_item]` to define methods,
but core documents primitives before those methods are available.

- Fix rustdoc-js-std test

  For some reason this change made CStr not show up in the results for
  `str,u8`. Since it still shows up for str, and since it wasn't a great
  match for that query anyway, I think this is ok to let slide.

- Add test that all primitives can be linked to
- Enable `doc(primitive)` in `core` as well
- Add linkcheck exception specifically for Windows

  Ideally this would be done automatically by the linkchecker by
  replacing `\\` with forward slashes, but this PR is already a ton of
  work ...

- Don't forcibly fail linkchecking if there's a broken intra-doc link on Windows

  Previously, it would exit with a hard error if a missing file had `::`
  in it. This changes it to report a missing file instead, which allows
  adding an exception.
2021-09-12 02:30:24 +00:00
await Marsha 4235d93434 Fix typo -- "The" -> "They"
I was reading through source code to try to learn more about the language and how to make the most of it when I ran into a small typo, so I figured I'd offer up a fix! I'm pretty new now, but hopefully I can offer up more substantial changes later. :D
2021-08-06 18:40:36 -05:00
Jade 3cf820e17d rfc3052: Remove authors field from Cargo manifests
Since RFC 3052 soft deprecated the authors field anyway, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information, we should remove it from
crates in this repo.
2021-07-29 14:56:05 -07:00
Eric Huss 1e9f0b367e linkchecker: Fix bug where fragment errors printed the wrong path. 2021-06-09 08:02:14 -07:00
Eric Huss dbc8a1c25a Change the linkchecker self-tests to validate more output. 2021-06-09 08:02:14 -07:00
Eric Huss 7dd2577abf Fix linkchecker redirection tests.
These were changed in #84703.
2021-06-08 11:30:02 -07:00
Eric Huss 095f09a5bf Build linkcheck script as release to run faster. 2021-06-03 14:08:24 -07:00
Eric Huss 98c90522a6 Fix linkcheck script from getting out of sync. 2021-06-03 14:08:19 -07:00
Guillaume Gomez 9077d540da Replace h3 and h4 containing invalid DOM 2021-06-01 21:19:28 +02:00
Eric Huss b6532ebeeb Add some tests for the linkchecker. 2021-05-24 16:25:23 -07:00
Eric Huss e9e6e66dd8 Optimize linkchecker by caching all filesystem access.
This should improve performance 2-3x depending on the system.
2021-05-24 16:24:27 -07:00
Eric Huss 9e11b61e8d linkchecker: Organize state into a struct, and add report.
Moves all the state into a struct so it doesn't need to be passed around
as much.

Also adds a report showing how long it took and what it found.

This includes a minor change: a failure to load a file is now an error,
instead of being ignored. This should only happen if there is a
permission error or some other shenanigans going on.
2021-05-22 16:22:09 -07:00
Mark Rousskov b3a4f91b8d Bump cfgs 2021-04-04 14:57:05 -04:00
François Mockers 06669056b5 remove slice linkcheck exceptions 2021-03-10 18:18:56 +01:00
Jacob Pratt c28f2a8bee Stabilize str_split_once 2021-02-09 23:17:11 -05:00
Joshua Nelson d5570c2fcb Remove unused linkcheck exceptions 2021-01-17 22:36:39 -05:00
Eric Arellano 7bd47bd7a1 Dogfood 'str_split_once() with linkchecker 2020-12-07 14:00:21 -07:00
Yuki Okushi 28f350e320 Set MDBOOK_OUTPUT__HTML__INPUT_404 on linkchecker 2020-10-18 02:30:08 +09:00
Joshua Nelson 65835d1059 Deny broken intra-doc links in linkchecker
Since rustdoc isn't warning about these links, check for them manually.
2020-10-15 20:22:16 -04:00
Lzu Tao c743fc4342 Ignore rustc_private items from std docs
Apply suggestions from code review

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-09-13 05:30:49 +00:00
bors ef55a0a92f Auto merge of #75207 - dylni:add-slice-check-range, r=KodrAus
Add `slice::check_range`

This method is useful for [`RangeBounds`] parameters. It's even been [rewritten](https://github.com/rust-lang/rust/blob/22ee68dc586440f96b76b32fbd6087507c6afdb9/src/librustc_data_structures/sorted_map.rs#L214) [many](https://github.com/rust-lang/rust/blob/22ee68dc586440f96b76b32fbd6087507c6afdb9/library/alloc/src/vec.rs#L1299) [times](https://github.com/rust-lang/rust/blob/22ee68dc586440f96b76b32fbd6087507c6afdb9/library/core/src/slice/mod.rs#L2441) in the standard library, sometimes assuming that the bounds won't be [`usize::MAX`].

For example, [`Vec::drain`] creates an empty iterator when [`usize::MAX`] is used as an inclusive end bound:

```rust
assert!(vec![1].drain(..=usize::max_value()).eq(iter::empty()));
```

If this PR is merged, I'll create another to use it for those methods.

[`RangeBounds`]: https://doc.rust-lang.org/std/ops/trait.RangeBounds.html
[`usize::MAX`]: https://doc.rust-lang.org/std/primitive.usize.html#associatedconstant.MAX
[`Vec::drain`]: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.drain
2020-09-04 12:21:43 +00:00
Matthias Krüger d97c4703eb linkcheckr: fix clippy::redundant_static_lifetimes and clippy::single_char_pattern 2020-08-23 23:53:53 +02:00
dylni ed02b90e9b Fix links again 2020-08-06 14:14:29 -04:00
Manish Goregaokar ec966ae13d primitive impls are weird 2020-07-18 22:42:11 -07:00
Manish Goregaokar 4a324b8117 Update src/tools/linkchecker/main.rs
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-07-18 22:30:25 -07:00
Manish Goregaokar a9680938d0 Add explicit exception list to linkchecker 2020-07-18 16:13:04 -07:00
Manish Goregaokar e53fea7e06 Use intra-doc links on HashMap 2020-07-18 16:13:04 -07:00
Manish Goregaokar d6d48b4ca9 Use intra-doc links in alloc::String 2020-07-18 11:03:44 -07:00
Tamir Duberstein 62cf767a4a Avoid "whitelist"
Other terms are more inclusive and precise.
2020-07-10 07:39:28 -04:00
Eric Huss 75983e137e Support configurable deny-warnings for all in-tree crates. 2020-06-25 21:17:21 -07:00
Ujjwal Sharma 3a6fa99f9e linkchecker: fix typo in main.rs 2020-04-26 17:09:15 +05:30
Eric Huss 4810c4712f Add shared script for linkchecking books. 2020-02-13 09:50:20 -08:00
Oliver Middleton 23f543162a Cleanup linkchecker whitelist
linkchecker is no longer run on the compiler docs so they can be removed from the whitelist.
2020-01-01 23:46:25 +00:00
Mark Rousskov a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Nicholas Nethercote 08e2f05549 Remove InternedString.
By using `LocalInternedString` instead for the few remaining uses.
2019-10-21 18:30:40 +11:00
Alex Crichton 7342325dfb Add #![deny(warnings)] to internal tools 2019-09-23 09:34:44 -07:00
Vadim Petrochenkov 434152157f Remove lint annotations in specific crates that are already enforced by rustbuild
Remove some random unnecessary lint `allow`s
2019-07-28 18:46:24 +03:00
Steven Fackler bd177f3ea3 Stabilized vectored IO
This renames `std::io::IoVec` to `std::io::IoSlice` and
`std::io::IoVecMut` to `std::io::IoSliceMut`, and stabilizes
`std::io::IoSlice`, `std::io::IoSliceMut`,
`std::io::Read::read_vectored`, and `std::io::Write::write_vectored`.

Closes #58452
2019-04-27 08:34:08 -07:00
Steven Fackler 034de8da7d Whitelist iovec types in linkchecker 2019-02-13 20:07:22 -08:00
Hirokazu Hata 3a133f2088 Transition linkchecker to 2018 edition 2019-02-03 22:46:37 +09:00
Igor Matuszewski ff41abcf8b linkchecker: Update deprecated trim_left_matches usage 2019-01-20 00:05:10 +01:00
Mark Rousskov 2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Nicholas Nethercote 43c6eced84 Remove RcVec and RcSlice.
They're both unused now.
2018-12-12 20:36:00 +11:00
Pietro Albini 64371f1cfe Rollup merge of #56119 - frewsxcv:frewsxcv-option-carrier, r=TimNN
Utilize `?` instead of `return None`.

None
2018-12-05 23:54:25 +01:00
Corey Farwell 9012af6f19 Utilize ? instead of return None. 2018-12-04 08:57:34 -08:00
Alex Crichton 225140ed21 Optimize local linkchecker program
I noticed on a [recent build][1] that the linkchecker stage of CI took a
whopping 15 minutes of CI time for something that should be near
instantaneous. Some local profiling showed some very hot functions and
clones which were pretty easy to remove, and now instead of running in
minutes locally it runs in seconds.

[1]: https://ci.appveyor.com/project/rust-lang/rust/build/job/kptifw1kb1nm4xuu
2018-11-29 15:02:06 -08:00