Re-exported types have confusingly different documentation
Re-exported types seem to have more confusing documentation than the original type. I noticed this while reviewing rayon::Configuration which is re-exported from rayon-core.
original/src/lib.rs
pub trait T {}
pub struct S;
impl S {
pub fn f<F>(_: F, _: Box<T>) -> Self
where F: Fn()
{
unimplemented!()
}
}
This is documented basically like what I wrote, which is what I would expect:

src/lib.rs
extern crate original;
pub use original::S;
This is documented with a couple changes, all of which are technically correct but unexpected.
- The
Box<T>is nowBox<T + 'static>. - The return type has changed from
SelftoS. - The
whereclause gives an explicit-> (). - The parameter name placeholders are gone (which I prefer, but it is a difference).

I am using rustc 1.22.0-nightly (f861b6ee4 2017-09-01).
@GuillaumeGomez
<!-- TRIAGEBOT_START --> <!-- TRIAGEBOT_ASSIGN_START --> <!-- TRIAGEBOT_ASSIGN_DATA_START$${"user":"fmease"}$$TRIAGEBOT_ASSIGN_DATA_END --> <!-- TRIAGEBOT_ASSIGN_END --> <!-- TRIAGEBOT_END -->Re-exported types seem to have more confusing documentation than the original type. I noticed this while reviewing rayon::Configuration which is re-exported from rayon-core.
original/src/lib.rs
pub trait T {} pub struct S; impl S { pub fn f<F>(_: F, _: Box<T>) -> Self where F: Fn() { unimplemented!() } }This is documented basically like what I wrote, which is what I would expect:

src/lib.rs
extern crate original; pub use original::S;This is documented with a couple changes, all of which are technically correct but unexpected.
- The
Box<T>is nowBox<T + 'static>. - The return type has changed from
SelftoS. - ~~The
whereclause gives an explicit-> ().~~ fixed as of 1.50 - The parameter name placeholders are gone (which I prefer, but it is a difference).

I am using rustc 1.22.0-nightly (f861b6ee4 2017-09-01).
@GuillaumeGomez
<!-- TRIAGEBOT_START --> <!-- TRIAGEBOT_ASSIGN_START --> <!-- TRIAGEBOT_ASSIGN_DATA_START$${"user":"fmease"}$$TRIAGEBOT_ASSIGN_DATA_END --> <!-- TRIAGEBOT_ASSIGN_END --> <!-- TRIAGEBOT_END -->jyn at 2022-10-31 16:16:05
- The
Dark magic! :laughing:
I'll take a look later.
Guillaume Gomez at 2017-09-04 08:27:08
cc #24305
Lukas H. at 2017-09-04 21:31:18
I think this is a cross-crate reexports issue, so labeling as such.
Noah Lev at 2020-10-12 04:36:51
Triage as of rustdoc 1.50.0-nightly (0f6f2d681 2020-12-06): This bug has gone away:
The where clause gives an explicit -> ().
The rest are still changed from the inner crate.
Inner:
Outer: 
jyn at 2020-12-16 01:53:29
I expect this is an inconsistency between how
cleantreats HIR andrustc_middle::tysomewhere (the difference being thattyworks off serialized metadata).jyn at 2020-12-16 01:54:33
Temporarily assigning myself to this issue since I am working on fixing several issues related to the handling of cross-crate trait object types in rustdoc and other minor cross-crate things. I won't fix everything mentioned in this issue however, hence this is only a temporary assignment until the PR is open.
@rustbot claim @rustbot label -C-enhancement +C-bug
León Orell Valerian Liehr at 2022-10-27 15:08:06
Update: Thanks to #103885, #107637 & #112463, the output is finally very close to acceptable (source vs. rendered):
- pub fn f<F>(_: F, _: Box<dyn T>) -> Self - where F: Fn() + pub fn f<F>(_: F, _: Box<dyn T>) -> S + where + F: Fn(),The remaining issue concerns
Selftypes in cross-crate scenarios. I'm not gonna work on a PR for that in the foreseeable future but at some point I will probably submit a PR for it. I predict it to be a bit nasty performance-wise since it requires performing type unification on everyTyinside animpl.León Orell Valerian Liehr at 2023-10-30 18:32:56