Skip to content

Missing Implementors for Join and Pattern trait in rustdoc #75588

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
tesuji opened this issue Aug 16, 2020 · 13 comments · Fixed by #76571
Closed

Missing Implementors for Join and Pattern trait in rustdoc #75588

tesuji opened this issue Aug 16, 2020 · 13 comments · Fixed by #76571
Labels
C-bug Category: This is a bug. P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@tesuji
Copy link
Contributor

tesuji commented Aug 16, 2020

Missing Implementors for std::slice::Join trait.

Current output:
image

While rustdoc displays Borrow trait implementors.

Expected:
Display Implementors for Join trait:

#[unstable(feature = "slice_concat_trait", issue = "27747")]
pub trait Join<Separator> {
#[unstable(feature = "slice_concat_trait", issue = "27747")]
/// The resulting type after concatenation
type Output;
/// Implementation of [`[T]::join`](../../std/primitive.slice.html#method.join)
#[unstable(feature = "slice_concat_trait", issue = "27747")]
fn join(slice: &Self, sep: Separator) -> Self::Output;
}
#[unstable(feature = "slice_concat_ext", issue = "27747")]
impl<T: Clone, V: Borrow<[T]>> Concat<T> for [V] {
type Output = Vec<T>;
fn concat(slice: &Self) -> Vec<T> {
let size = slice.iter().map(|slice| slice.borrow().len()).sum();
let mut result = Vec::with_capacity(size);
for v in slice {
result.extend_from_slice(v.borrow())
}
result
}
}
#[unstable(feature = "slice_concat_ext", issue = "27747")]
impl<T: Clone, V: Borrow<[T]>> Join<&T> for [V] {
type Output = Vec<T>;
fn join(slice: &Self, sep: &T) -> Vec<T> {
let mut iter = slice.iter();
let first = match iter.next() {
Some(first) => first,
None => return vec![],
};
let size = slice.iter().map(|v| v.borrow().len()).sum::<usize>() + slice.len() - 1;
let mut result = Vec::with_capacity(size);
result.extend_from_slice(first.borrow());
for v in iter {
result.push(sep.clone());
result.extend_from_slice(v.borrow())
}
result
}
}
#[unstable(feature = "slice_concat_ext", issue = "27747")]
impl<T: Clone, V: Borrow<[T]>> Join<&[T]> for [V] {
type Output = Vec<T>;
fn join(slice: &Self, sep: &[T]) -> Vec<T> {
let mut iter = slice.iter();
let first = match iter.next() {
Some(first) => first,
None => return vec![],
};
let size =
slice.iter().map(|v| v.borrow().len()).sum::<usize>() + sep.len() * (slice.len() - 1);
let mut result = Vec::with_capacity(size);
result.extend_from_slice(first.borrow());
for v in iter {
result.extend_from_slice(sep);
result.extend_from_slice(v.borrow())
}
result
}
}

Meta

rustc --version --verbose: 1.47.0-nightly (9b88e0a 2020-08-15)

@rustbot modify labels: T-rustdoc

@tesuji tesuji added the C-bug Category: This is a bug. label Aug 16, 2020
@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Aug 16, 2020
@RalfJung RalfJung changed the title Missing Implementors for std::slice::Join trait Missing Implementors for std::slice::Join trait in rustdoc Aug 16, 2020
@tesuji
Copy link
Contributor Author

tesuji commented Aug 18, 2020

This is a regression from stable-to-nightly: https://doc.rust-lang.org/1.45.2/std/slice/trait.Join.html and beta one has Implementors section.

cc @jyn514

@tesuji
Copy link
Contributor Author

tesuji commented Sep 9, 2020

It has made it way to beta. Pattern trait is also affected: https://doc.rust-lang.org/beta/std/str/pattern/trait.Pattern.html#implementors

@rustbot modify labels: I-prioritize

@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Sep 9, 2020
@tesuji tesuji changed the title Missing Implementors for std::slice::Join trait in rustdoc Missing Implementors for traits in rustdoc Sep 9, 2020
@LeSeulArtichaut
Copy link
Contributor

(Btw I think you can use @rustbot prioritize as a shorthand)

@LeSeulArtichaut LeSeulArtichaut added the regression-from-stable-to-beta Performance or correctness regression from stable to beta. label Sep 9, 2020
@tesuji tesuji changed the title Missing Implementors for traits in rustdoc Missing Implementors for Join and Pattern trait in rustdoc Sep 9, 2020
@tesuji
Copy link
Contributor Author

tesuji commented Sep 9, 2020

The Borrow trait still has Implementors section, I am not sure if this bug affect crates in ecosystem.

@tesuji
Copy link
Contributor Author

tesuji commented Sep 9, 2020

So I think this bug shouldn't affect stable traits, just most unstable traits I saw are affected.

@tesuji

This comment has been minimized.

@jyn514
Copy link
Member

jyn514 commented Sep 9, 2020

This is more likely to be #73771 than the refactor I think.

@jyn514 jyn514 added E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc labels Sep 9, 2020
@Mark-Simulacrum
Copy link
Member

Yeah, I suspect that given #74672 it might make sense to revert anyway, since it doesn't actually accomplish the goal.

Or someone more experienced with rustdoc may be able to suggest/implement a better patch.

@tesuji
Copy link
Contributor Author

tesuji commented Sep 9, 2020

New discovery: So far only trait exported to std affected. For example with Join trait, in alloc it is normal: https://doc.rust-lang.org/nightly/alloc/slice/trait.Join.html

@tesuji
Copy link
Contributor Author

tesuji commented Sep 9, 2020

Oh right, I have MCVE, it needs two dummy crates.

dummy crate "unstabled"
#![crate_name = "unstabled"]
#![feature(staged_api)]
#![unstable(feature = "thisisnotreal", issue = "27747")]

#[unstable(feature = "asdfasdfasdfa", issue = "27747")]
pub struct Foo<T: Sized + Clone> {
    #[unstable(feature = "asdfasdfasdfa", issue = "27747")]
    bytes: [T],
}

#[unstable(feature = "asdfasdfasdfa", issue = "27747")]
pub trait Join {
    #[unstable(feature = "asdfasdfasdfa", issue = "27747")]
    type Output;

    #[unstable(feature = "asdfasdfasdfa", issue = "27747")]
    fn join(slice: &Self) -> Self::Output;
}

#[unstable(feature = "asdfasdfasdfa", issue = "27747")]
impl<T: Sized + Clone> Join for Foo<T> {
    type Output = Vec<T>;

    fn join(slice: &Self) -> Vec<T> {
        unimplemented!()
    }
}

Crate to run cargo doc:

#![feature(asdfasdfasdfa)]

pub use unstabled::Join;

@rustbot modify labels: -E-needs-mcve

@rustbot rustbot removed the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Sep 9, 2020
@tesuji
Copy link
Contributor Author

tesuji commented Sep 9, 2020

searched nightlies: from nightly-2020-06-04 to nightly-2020-07-17
regressed nightly: nightly-2020-07-17
searched commits: from 7e11379 to 5c9e5df
regressed commit: 5c9e5df

bisected with cargo-bisect-rustc v0.5.2

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc 2020-06-04 --end 2020-07-17 --script=./test.bash --without-cargo 

@jyn514
Copy link
Member

jyn514 commented Sep 9, 2020

That rollup includes both #73771 and #73566; of the two I think 73771 is the more likely culprit.

@jyn514
Copy link
Member

jyn514 commented Sep 9, 2020

Marking as P-high as discussed by the prioritization WG.

@jyn514 jyn514 added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc labels Sep 9, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Sep 12, 2020
…n514

Ignore rustc_private items from std docs

By ignoring rustc_private items for non local impl block,
this may fix rust-lang#74672 and fix rust-lang#75588 .

This might suppress rust-lang#76529 if it is simple enough for backport.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Sep 12, 2020
…n514

Ignore rustc_private items from std docs

By ignoring rustc_private items for non local impl block,
this may fix rust-lang#74672 and fix rust-lang#75588 .

This might suppress rust-lang#76529 if it is simple enough for backport.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Sep 12, 2020
…n514

Ignore rustc_private items from std docs

By ignoring rustc_private items for non local impl block,
this may fix rust-lang#74672 and fix rust-lang#75588 .

This might suppress rust-lang#76529 if it is simple enough for backport.
@bors bors closed this as completed in 356d8ad Sep 14, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants