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

The String::from link is broken(?). #60200

Closed
Songbird0 opened this issue Apr 23, 2019 · 11 comments
Closed

The String::from link is broken(?). #60200

Songbird0 opened this issue Apr 23, 2019 · 11 comments
Assignees
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@Songbird0
Copy link
Contributor

Hi,

This anchor doesn't seem to work.

Tested on: Firefox 66.0.3 (64 bits) and Vivaldi 2.4.

@jonas-schievink jonas-schievink added C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 23, 2019
@hellow554
Copy link
Contributor

hellow554 commented Apr 23, 2019

Where do you have that anchor from?

https://doc.rust-lang.org/std/string/struct.String.html#examples

You can create a String from a literal string with String::from:

@Songbird0
Copy link
Contributor Author

Songbird0 commented Apr 23, 2019 via email

@czipperz
Copy link
Contributor

@ollie27
Copy link
Member

ollie27 commented Apr 23, 2019

This looks like the same issue as #52517 and #52774.

@ehuss
Copy link
Contributor

ehuss commented Apr 23, 2019

@ollie27 I'm not sure it is related to collapsing. It looks like the fragments changed in 1.33 (it worked previously). The new fragments look like #method.from-2 with -2 or some number to the individual impl. However, it looks like this link has always been wrong. The actual impl (From<&str> for String) doesn't seem to be listed anywhere? I'm a little confused.

@ollie27
Copy link
Member

ollie27 commented Apr 23, 2019

@ehuss #method.from is still there under impl From<String> for Rc<str> on the stable docs, it's just collapsed. The number suffixes are added if there is more than one with the same name but the first never gets a suffix. impl From<&str> for String is listed as impl<'a> From<&'a str> for String.

@ehuss
Copy link
Contributor

ehuss commented Apr 23, 2019

Oh, indeed! It is not uncollapsing. I thought that had all been fixed.

Regardless, the fragment for the str impl method keeps changing (in stable it is method.from-6 and in nightly it is method.from-8). If the intent is to link to the correct impl, there should probably be a more stable way to do it (not sure if intra-doc links would help here).

If is desired to just link to the impl (which doesn't seem to have problems with collapsing) it could link to impl-From%3C%26%27_%20str%3E as @czipperz said (note it is '_ in nightly, not 'a, which is another worrisome point about these links getting broken over time — unfortunately this file is ignored by the linkchecker).

@czipperz
Copy link
Contributor

It seems like we should have a compile time check to ensure links aren't broken. Is this possible?

@ehuss
Copy link
Contributor

ehuss commented Apr 24, 2019

@czipperz There is a linkchecker, but it is disabled for String due to #32129.

@GuillaumeGomez GuillaumeGomez self-assigned this Apr 24, 2019
@GuillaumeGomez
Copy link
Member

I added this issue to my "I need to fix that" list.

@GuillaumeGomez
Copy link
Member

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants