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

1307 broken links in the Rust documentation #14515

Closed
4 of 7 tasks
chris-morgan opened this issue May 29, 2014 · 8 comments
Closed
4 of 7 tasks

1307 broken links in the Rust documentation #14515

chris-morgan opened this issue May 29, 2014 · 8 comments

Comments

@chris-morgan
Copy link
Member

(Sorry, I couldn’t invent 30 more.)

I have a massive list of bad links from crawling doc.rust-lang.org (1307 of them). Most of them arise from bugs in rustdoc, though a few are bad from other manual causes.

Here are the some patterns that I have identified that cause them and which I have omitted from the data set below:

  • There are 165 links of the form Some(…) are being produced in rustdoc::html::render::item_module, where item.href() (an Option<String>) is being written directly without unwrapping. rustdoc: Create anchor pages for primitive types #14513
  • The implementors/….js pattern accounts for 247 404s, because there is no stub JS file if nothing implements the trait. I am not fond of the technique being used, but given it in its current state, we should produce stub JS files that simply do nothing, to avoid a 404.
  • There are 42 with a ?gotosrc=… in them, omitted as I am informed that it has been fixed, just that the online docs haven’t been updated yet. rustdoc: cross-crate source links are one level lower. #14458

Some other observations:

  • The links in trait implementations appear at a brief look-over to be causing the most problems. Most of the links that I have not categorised probably boil down to just a few bugs in this area; here are two I have identified:
    • Getting the private path (e.g. serialize::serialize::Encodable rather than its canonical public path, serialize::Encodable; I have omitted 771 (!) broken links for serialize::serialize, 8 for std::io::mem::MemWriter, and probably more of the remaining ones are from this same thing); rustdoc: Create anchor pages for primitive types #14513
    • Including private (e.g. HomingIO which is in a private module) and/or #[doc(hidden)] (e.g. RcBoxPtr) traits in the “traits this type implements” section;
  • We used to have enum.Result.html, now all enums are type.Result.html. This has broken manual links both inside the documentation (15, by the looks of it) and outside the documentation, and should be reverted.

Anyway, here’s the list of ones that I haven’t removed for reasons mentioned above:

Target Source
http://doc.rust-lang.org/doc/master/rust.html#logging-system http://doc.rust-lang.org/complement-lang-faq.html
../std/str/enum.MaybeOwned.html http://doc.rust-lang.org/complement-cheatsheet.html
../std/io/buffered/struct.BufferedReader.html http://doc.rust-lang.org/complement-cheatsheet.html
../std/vec/trait.ImmutableVector.html#tymethod.iter http://doc.rust-lang.org/complement-cheatsheet.html
../std/vec/trait.MutableVector.html#tymethod.mut_iter http://doc.rust-lang.org/complement-cheatsheet.html
../std/vec/trait.OwnedVector.html#tymethod.move_iter http://doc.rust-lang.org/complement-cheatsheet.html
../../alloc/rc/trait.RcBoxPtr.html http://doc.rust-lang.org/std/rc/struct.Rc.html
../alloc/arc/struct.ArcInner.html http://doc.rust-lang.org/sync/struct.Arc.html
enum.Result.html#method.ok http://doc.rust-lang.org/std/result/
enum.Result.html#method.ok http://doc.rust-lang.org/std/result/
../../alloc/rc/trait.RcBoxPtr.html http://doc.rust-lang.org/std/rc/struct.Weak.html
../../alloc/rc/trait.RcBoxPtr.html http://doc.rust-lang.org/std/rc/struct.Weak.html
../alloc/arc/struct.ArcInner.html http://doc.rust-lang.org/sync/struct.Weak.html
../regex/re/trait.Replacer.html http://doc.rust-lang.org/regex/struct.NoExpand.html
../regex/re/trait.Replacer.html http://doc.rust-lang.org/regex/trait.Replacer.html
../regex/re/trait.Replacer.html http://doc.rust-lang.org/regex/trait.Replacer.html
../regex/re/trait.Replacer.html http://doc.rust-lang.org/regex/type.Regex.html
../regex/re/trait.Replacer.html http://doc.rust-lang.org/regex/type.Regex.html
../regex/re/trait.Replacer.html http://doc.rust-lang.org/regex/type.Regex.html
../../rustuv/homing/trait.HomingIO.html http://doc.rust-lang.org/rustuv/file/struct.FileWatcher.html
../../rustuv/homing/trait.HomingIO.html http://doc.rust-lang.org/rustuv/net/struct.TcpWatcher.html
../../rustuv/homing/trait.HomingIO.html http://doc.rust-lang.org/rustuv/net/struct.TcpListener.html
../../rustuv/homing/trait.HomingIO.html http://doc.rust-lang.org/rustuv/net/struct.TcpAcceptor.html
../../rustuv/homing/trait.HomingIO.html http://doc.rust-lang.org/rustuv/net/struct.UdpWatcher.html
../../rustuv/homing/trait.HomingIO.html http://doc.rust-lang.org/rustuv/pipe/struct.PipeWatcher.html
../../rustuv/homing/trait.HomingIO.html http://doc.rust-lang.org/rustuv/pipe/struct.PipeListener.html
../../rustuv/homing/trait.HomingIO.html http://doc.rust-lang.org/rustuv/pipe/struct.PipeAcceptor.html
../../rustuv/homing/trait.HomingIO.html http://doc.rust-lang.org/rustuv/process/struct.Process.html
../../rustuv/homing/trait.HomingIO.html http://doc.rust-lang.org/rustuv/signal/struct.SignalWatcher.html
../../rustuv/homing/trait.HomingIO.html http://doc.rust-lang.org/rustuv/timer/struct.TimerWatcher.html
../../rustuv/homing/trait.HomingIO.html http://doc.rust-lang.org/rustuv/tty/struct.TtyWatcher.html
../regex/re/type.Regex.html http://doc.rust-lang.org/test/struct.TestOpts.html
../sync/lock/struct.RWLock.html http://doc.rust-lang.org/workcache/struct.Context.html
../sync/lock/struct.RWLock.html http://doc.rust-lang.org/workcache/struct.Context.html
../sync/lock/struct.RWLock.html http://doc.rust-lang.org/workcache/struct.Context.html
../../core/fmt/rt/type.Alignment.html http://doc.rust-lang.org/std/fmt/struct.Formatter.html
../../core/fmt/rt/type.Piece.html http://doc.rust-lang.org/std/fmt/struct.Formatter.html
../../core/fmt/rt/type.Piece.html http://doc.rust-lang.org/std/fmt/struct.Formatter.html
../../core/fmt/rt/type.Alignment.html http://doc.rust-lang.org/std/fmt/struct.Formatter.html
http://doc.rust-lang.org/core/fmt/type.CurrentlyFormatting.html http://doc.rust-lang.org/std/fmt/struct.Formatter.html
../../core/fmt/rt/type.Count.html http://doc.rust-lang.org/std/fmt/struct.Formatter.html
../../core/fmt/rt/type.Method.html http://doc.rust-lang.org/std/fmt/struct.Formatter.html
enum.Result.html#method.ok http://doc.rust-lang.org/std/result/index.html
enum.Result.html#method.ok http://doc.rust-lang.org/std/result/index.html
enum.Result.html#method.ok http://doc.rust-lang.org/std/result/index.html
enum.Result.html#method.ok http://doc.rust-lang.org/std/result/index.html
enum.Result.html#method.ok http://doc.rust-lang.org/std/result/index.html
enum.Result.html#method.ok http://doc.rust-lang.org/std/result/index.html
../io/trait.Writer.html http://doc.rust-lang.org/core/result/
enum.Result.html#method.ok http://doc.rust-lang.org/core/result/
enum.Result.html#method.ok http://doc.rust-lang.org/core/result/
../../alloc/std/fmt/trait.Show.html http://doc.rust-lang.org/alloc/owned/struct.Box.html
../../alloc/std/fmt/trait.Show.html http://doc.rust-lang.org/alloc/owned/struct.Box.html
../../alloc/std/fmt/trait.Show.html http://doc.rust-lang.org/alloc/owned/struct.Box.html
../../alloc/std/fmt/struct.Formatter.html http://doc.rust-lang.org/alloc/owned/struct.Box.html
../../alloc/std/fmt/type.Result.html http://doc.rust-lang.org/alloc/owned/struct.Box.html
../../alloc/std/fmt/struct.Formatter.html http://doc.rust-lang.org/alloc/owned/struct.Box.html
../../alloc/std/fmt/type.Result.html http://doc.rust-lang.org/alloc/owned/struct.Box.html
../../std/unstable/mutex/struct.NativeMutex.html http://doc.rust-lang.org/green/task/struct.GreenTask.html
../../core/fmt/num/trait.GenericRadix.html http://doc.rust-lang.org/core/fmt/struct.Radix.html
enum.Result.html#method.ok http://doc.rust-lang.org/core/result/index.html
enum.Result.html#method.ok http://doc.rust-lang.org/core/result/index.html
../io/trait.Writer.html http://doc.rust-lang.org/core/result/index.html
enum.Result.html#method.ok http://doc.rust-lang.org/core/result/index.html
enum.Result.html#method.ok http://doc.rust-lang.org/core/result/index.html
../io/trait.Writer.html http://doc.rust-lang.org/core/result/index.html
../../collections/hashmap/table/struct.Entries.html http://doc.rust-lang.org/collections/hashmap/type.Entries.html
../../collections/hashmap/table/struct.MutEntries.html http://doc.rust-lang.org/collections/hashmap/type.MutEntries.html
../../alloc/std/option/type.Option.html http://doc.rust-lang.org/alloc/arc/struct.Weak.html
../../alloc/std/option/type.Option.html http://doc.rust-lang.org/alloc/arc/struct.Weak.html
../../alloc/std/option/type.Option.html http://doc.rust-lang.org/alloc/rc/struct.Weak.html
../../alloc/std/option/type.Option.html http://doc.rust-lang.org/alloc/rc/struct.Weak.html
../../../std/unstable/mutex/struct.LockGuard.html http://doc.rust-lang.org/native/io/net/struct.Guard.html
i.e.%20all%20fields%20for%20self%20are%20in%20the%0Afirst%20tuple,%20for%20other1%20are%20in%20the%20second%20tuple,%20etc. http://doc.rust-lang.org/syntax/ext/deriving/generic/type.SubstructureFields.html
@alexcrichton
Copy link
Member

What was the tool you used to generate this information? This may make a good regression test for rustdoc.

@alexcrichton
Copy link
Member

Much of this is now covered by #14513, I will likely break this into separate issues once that PR lands.

alexcrichton added a commit to alexcrichton/rust that referenced this issue May 30, 2014
alexcrichton added a commit to alexcrichton/rust that referenced this issue May 31, 2014
Cross crate links can target items which are not rendered in the documentation.
If the item is reexported at a higher level, the destination of the link (a
concatenation of the fully qualified name) may actually lead to nowhere. This
fixes this problem by altering rustdoc to emit pages which redirect to the local
copy of the reexported structure.

cc rust-lang#14515
Closes rust-lang#14137
alexcrichton added a commit to alexcrichton/rust that referenced this issue Jun 1, 2014
alexcrichton added a commit to alexcrichton/rust that referenced this issue Jun 1, 2014
Cross crate links can target items which are not rendered in the documentation.
If the item is reexported at a higher level, the destination of the link (a
concatenation of the fully qualified name) may actually lead to nowhere. This
fixes this problem by altering rustdoc to emit pages which redirect to the local
copy of the reexported structure.

cc rust-lang#14515
Closes rust-lang#14137
@alexcrichton
Copy link
Member

Many of these have now been dealt with, the remaining ones are left unchecked.

@chris-morgan
Copy link
Member Author

I was using linkchecker. It’s not perfect, but until I write such a tool in Rust (I do intend to, eventually), it’s the best I know of.

@steveklabnik
Copy link
Member

Re-ran linkchecker:

Statistics:
Downloaded: 206.3MB.
Content types: 0 image, 800810 text, 0 video, 0 audio, 52548 application, 0 mail and 22847 other.
URL lengths: min=16, max=109, avg=54.

That's it. 876205 links in 8786 URLs checked. 323 warnings found. 2090 errors found.
Stopped checking at 2015-03-31 17:15:10-004 (1 hour, 19 minutes)

@steveklabnik
Copy link
Member

Oh, a lot of these broke due to not re-exporting the core docs and such.

@steveklabnik
Copy link
Member

err, not core, but stuff like syntax that's described in unstable documentation

@steveklabnik
Copy link
Member

I've submitted fixes for a few things, and also opened individual issues for the rustdoc bugs causing the other issues. Gonna give this one a close!

bors added a commit to rust-lang-ci/rust that referenced this issue Jun 5, 2023
…pplicative-editing-assoc-items, r=Veykril

fix: restrict applicable range of `reorder-impl-trait-items`

This PR should complete the need for restricting the applicable range of `reorder-impl-trait-items`.

When the cursor is in the associated items of the `impl` range, the assist will be disabled.

Fix: rust-lang#14515

## Showcases
Note: If there is any available `code-action` (`ide-assist`) available, a lightbulb icon from `lspsaga` will show in the left.

- cursor in `impl` headers
![code action available](https://user-images.githubusercontent.com/44747719/230756854-7b236018-cfa8-4005-b589-2996ec42917f.png)
Code action is available. And it is reordering impl items.
![code action detail](https://user-images.githubusercontent.com/44747719/230756971-341c7fbc-f2ba-4715-a1e5-b1add984d4dd.png)

- cursor in `impl` associated items
![code action unavailable](
https://user-images.githubusercontent.com/44747719/230756906-bee7784e-bd9d-49b2-801b-743c94b4af54.png)
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

No branches or pull requests

3 participants