-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
rustdoc: cannot resolve links to associated trait items for primitives #90703
Comments
Hello I tested your problem, and found that when I used [ use std::{num::ParseFloatError, str::FromStr};
/// Uses the rules from [`f64::from_str().unwrap()`].
#[derive(Debug)]
pub struct Number {
pub value: f64,
}
impl FromStr for Number {
type Err = ParseFloatError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let value = s.parse::<f64>()?;
Ok(Self{value})
}
} When I run
I also tested with a mod num;
use num::Number;
use std::str::FromStr;
fn main(){
let s = Number::from_str("6.7").unwrap();
println!("{:?}", s);
} I hope this helps, but I do find it weird cargo needed the unwrap to not give errors |
@Mustafif when you put a dot in a link, rustdoc treats it as a url, not an intra doc link |
Oh my I did not realize that, thank you for informing me about that |
I'd like to take a shot at this, if that's alright. |
@theryangeary go for it! :) if you need help, feel free to ask here or on Zulip. |
Just for posterity: the zulip thread for this is https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/help.20with.20.2390703. |
Hello, is this still being worked on? The last message on the Zulip thread is 25th November. If it's free to pick up I'd be happy to pick it up. |
Feel free to take it over. I haven't had the time to work on it
unfortunately.
…On Thu, Dec 30, 2021, 06:38 Mahdi Dibaiee ***@***.***> wrote:
Hello, is this still being worked on? The last message on the Zulip thread
is 25th November. If it's free to pick up I'd be happy to pick it up.
—
Reply to this email directly, view it on GitHub
<#90703 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABV7RLO7YCQWANQNTMNWIJLUTRADHANCNFSM5HTGWXYQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were assigned.Message ID:
***@***.***>
|
@rustbot claim |
#92443 will fix this for "simple" primitives such as: As such, I think this issue is now "partially" fixed, however more work is needed to make it work for these other types.
See the new issue: #92536 |
…imitive-types, r=Manishearth Rustdoc: resolve associated traits for non-generic primitive types Fixes rust-lang#90703 This seems to work: <img width="457" alt="image" src="https://user-images.githubusercontent.com/2807772/147774059-9556ff96-4519-409e-8ed0-c33ecc436171.png"> I'm just afraid I might have missed some cases / broken previous functionality. I also have not written tests yet, I will have to take a look to see where tests are and how they are structured, but any help there is also appreciated.
…imitive-types, r=Manishearth Rustdoc: resolve associated traits for non-generic primitive types Fixes rust-lang#90703 This seems to work: <img width="457" alt="image" src="https://user-images.githubusercontent.com/2807772/147774059-9556ff96-4519-409e-8ed0-c33ecc436171.png"> I'm just afraid I might have missed some cases / broken previous functionality. I also have not written tests yet, I will have to take a look to see where tests are and how they are structured, but any help there is also appreciated.
…imitive-types, r=Manishearth Rustdoc: resolve associated traits for non-generic primitive types Fixes rust-lang#90703 This seems to work: <img width="457" alt="image" src="https://user-images.githubusercontent.com/2807772/147774059-9556ff96-4519-409e-8ed0-c33ecc436171.png"> I'm just afraid I might have missed some cases / broken previous functionality. I also have not written tests yet, I will have to take a look to see where tests are and how they are structured, but any help there is also appreciated.
…imitive-types, r=Manishearth Rustdoc: resolve associated traits for non-generic primitive types Fixes rust-lang#90703 This seems to work: <img width="457" alt="image" src="https://user-images.githubusercontent.com/2807772/147774059-9556ff96-4519-409e-8ed0-c33ecc436171.png"> I'm just afraid I might have missed some cases / broken previous functionality. I also have not written tests yet, I will have to take a look to see where tests are and how they are structured, but any help there is also appreciated.
I tried this code:
I expected to see this happen: the
[f64::from_str()]
in the docstring links to https://doc.rust-lang.org/1.56.0/std/primitive.f64.html#method.from_strInstead, this happened:
This does not happen for
[f64::floor()]
nor for linking to a non-primitiveFromStr
implmentation, like[Number::from_str()]
(in the example above).@jyn514 suggested that
resolve_primitive_associated_item()
may be only looking at inherent impls and not trait impls, and that it may need a call toresolve_associated_trait_item()
.Meta
rustc --version --verbose
:Reproduced on beta:
and nightly:
Backtrace
RUSTC_BOOTSTRAP=1 RUSTDOC_LOG=rustdoc::passes::collect_intra_doc_links=debug cargo rustdoc -- -Dwarnings -Ztreat-err-as-bug
:The text was updated successfully, but these errors were encountered: