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

CI is not catching some intra-doc link failures #75768

Closed
jyn514 opened this issue Aug 21, 2020 · 7 comments
Closed

CI is not catching some intra-doc link failures #75768

jyn514 opened this issue Aug 21, 2020 · 7 comments
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Aug 21, 2020

This is alloc, std isn't in scope. I'm curious how CI didn't catch this ...
Not yet sure whether this is a CI issue or rustdoc issue.

Originally posted by @jyn514 in #75725 (comment)

@jyn514 jyn514 added A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name A-testsuite Area: The testsuite used to check the correctness of rustc T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Aug 21, 2020
@ehuss
Copy link
Contributor

ehuss commented Aug 21, 2020

If you're talking about the PR builder, it only does a limited stage 0 build:

python3 ../x.py doc --stage 0 library/std && \

@jyn514
Copy link
Member Author

jyn514 commented Aug 21, 2020

The stage 0 build should still have caught this, though. It runs with intra-doc links on because RUSTC_BOOTSTRAP is set.

@Mark-Simulacrum
Copy link
Member

It looks like it was caught? https://github.com/rust-lang/rust/pull/75725/checks?check_run_id=1012069433

Without a specific thing that was not caught and a link to the CI build in which it was not caught I probably can't help here.

@jyn514
Copy link
Member Author

jyn514 commented Aug 21, 2020

Here is the specific thing that was not caught: 1ababd8#diff-751e42ddeb4b1353113ad998d3a758c7R1746
Here is the CI build: https://github.com/rust-lang/rust/runs/1009979015

@jyn514
Copy link
Member Author

jyn514 commented Aug 21, 2020

I'm not saying it's a CI failure - it might be a bug in rustdoc.

@ehuss
Copy link
Contributor

ehuss commented Aug 21, 2020

Ah, in this particular case, that is an unused reference link, which pulldown_cmark ignores. [`forget`] is never referenced in this doc block:

rust/library/alloc/src/rc.rs

Lines 1704 to 1746 in 1ababd8

/// Converts a raw pointer previously created by [`into_raw`] back into `Weak<T>`.
///
/// This can be used to safely get a strong reference (by calling [`upgrade`]
/// later) or to deallocate the weak count by dropping the `Weak<T>`.
///
/// It takes ownership of one weak reference (with the exception of pointers created by [`new`],
/// as these don't own anything; the method still works on them).
///
/// # Safety
///
/// The pointer must have originated from the [`into_raw`] and must still own its potential
/// weak reference.
///
/// It is allowed for the strong count to be 0 at the time of calling this. Nevertheless, this
/// takes ownership of one weak reference currently represented as a raw pointer (the weak
/// count is not modified by this operation) and therefore it must be paired with a previous
/// call to [`into_raw`].
///
/// # Examples
///
/// ```
/// use std::rc::{Rc, Weak};
///
/// let strong = Rc::new("hello".to_owned());
///
/// let raw_1 = Rc::downgrade(&strong).into_raw();
/// let raw_2 = Rc::downgrade(&strong).into_raw();
///
/// assert_eq!(2, Rc::weak_count(&strong));
///
/// assert_eq!("hello", &*unsafe { Weak::from_raw(raw_1) }.upgrade().unwrap());
/// assert_eq!(1, Rc::weak_count(&strong));
///
/// drop(strong);
///
/// // Decrement the last weak count.
/// assert!(unsafe { Weak::from_raw(raw_2) }.upgrade().is_none());
/// ```
///
/// [`into_raw`]: Weak::into_raw
/// [`upgrade`]: Weak::upgrade
/// [`new`]: Weak::new
/// [`forget`]: std::mem::forget

It would be great to warn or err on that case, but I'm not sure how feasible that is with pulldown_cmark as it is. (I've wanted this for mdbook, too, but last time I looked it wasn't possible.)

@jyn514
Copy link
Member Author

jyn514 commented Aug 21, 2020

Ah ok, this is just a duplicate of #62345 then. Sorry for the false alarm.

@jyn514 jyn514 closed this as completed Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name A-testsuite Area: The testsuite used to check the correctness of rustc 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

3 participants