Create a valid Res
in external_path()
The order of the `where` bounds on auto trait impls changed because rustdoc currently sorts auto trait `where` bounds based on the `Debug` output for the bound. Now that the bounds have an actual `Res`, they are being unintentionally sorted by their `DefId` rather than their path. So, I had to update a test for the change in ordering of the rendered bounds.
This commit is contained in:
parent
0bb1c285af
commit
6a84d34784
@ -166,7 +166,7 @@ fn clean(&self, cx: &mut DocContext<'_>) -> Type {
|
||||
inline::record_extern_fqn(cx, trait_ref.def_id, kind);
|
||||
let path = external_path(
|
||||
cx,
|
||||
cx.tcx.item_name(trait_ref.def_id),
|
||||
trait_ref.def_id,
|
||||
Some(trait_ref.def_id),
|
||||
true,
|
||||
bounds.to_vec(),
|
||||
@ -1448,19 +1448,12 @@ fn clean(&self, cx: &mut DocContext<'_>) -> Type {
|
||||
AdtKind::Enum => ItemType::Enum,
|
||||
};
|
||||
inline::record_extern_fqn(cx, did, kind);
|
||||
let path = external_path(cx, cx.tcx.item_name(did), None, false, vec![], substs);
|
||||
let path = external_path(cx, did, None, false, vec![], substs);
|
||||
ResolvedPath { path, did, is_generic: false }
|
||||
}
|
||||
ty::Foreign(did) => {
|
||||
inline::record_extern_fqn(cx, did, ItemType::ForeignType);
|
||||
let path = external_path(
|
||||
cx,
|
||||
cx.tcx.item_name(did),
|
||||
None,
|
||||
false,
|
||||
vec![],
|
||||
InternalSubsts::empty(),
|
||||
);
|
||||
let path = external_path(cx, did, None, false, vec![], InternalSubsts::empty());
|
||||
ResolvedPath { path, did, is_generic: false }
|
||||
}
|
||||
ty::Dynamic(ref obj, ref reg) => {
|
||||
@ -1484,8 +1477,7 @@ fn clean(&self, cx: &mut DocContext<'_>) -> Type {
|
||||
|
||||
for did in dids {
|
||||
let empty = cx.tcx.intern_substs(&[]);
|
||||
let path =
|
||||
external_path(cx, cx.tcx.item_name(did), Some(did), false, vec![], empty);
|
||||
let path = external_path(cx, did, Some(did), false, vec![], empty);
|
||||
inline::record_extern_fqn(cx, did, ItemType::Trait);
|
||||
let bound = PolyTrait {
|
||||
trait_: ResolvedPath { path, did, is_generic: false },
|
||||
@ -1502,8 +1494,7 @@ fn clean(&self, cx: &mut DocContext<'_>) -> Type {
|
||||
});
|
||||
}
|
||||
|
||||
let path =
|
||||
external_path(cx, cx.tcx.item_name(did), Some(did), false, bindings, substs);
|
||||
let path = external_path(cx, did, Some(did), false, bindings, substs);
|
||||
bounds.insert(
|
||||
0,
|
||||
PolyTrait {
|
||||
|
@ -1158,7 +1158,7 @@ impl GenericBound {
|
||||
crate fn maybe_sized(cx: &mut DocContext<'_>) -> GenericBound {
|
||||
let did = cx.tcx.require_lang_item(LangItem::Sized, None);
|
||||
let empty = cx.tcx.intern_substs(&[]);
|
||||
let path = external_path(cx, cx.tcx.item_name(did), Some(did), false, vec![], empty);
|
||||
let path = external_path(cx, did, Some(did), false, vec![], empty);
|
||||
inline::record_extern_fqn(cx, did, ItemType::Trait);
|
||||
GenericBound::TraitBound(
|
||||
PolyTrait {
|
||||
|
@ -141,19 +141,21 @@ fn external_generic_args(
|
||||
}
|
||||
}
|
||||
|
||||
// trait_did should be set to a trait's DefId if called on a TraitRef, in order to sugar
|
||||
// from Fn<(A, B,), C> to Fn(A, B) -> C
|
||||
/// trait_did should be set to a trait's DefId if called on a TraitRef, in order to sugar
|
||||
/// from `Fn<(A, B,), C>` to `Fn(A, B) -> C`
|
||||
pub(super) fn external_path(
|
||||
cx: &mut DocContext<'_>,
|
||||
name: Symbol,
|
||||
did: DefId,
|
||||
trait_did: Option<DefId>,
|
||||
has_self: bool,
|
||||
bindings: Vec<TypeBinding>,
|
||||
substs: SubstsRef<'_>,
|
||||
) -> Path {
|
||||
let def_kind = cx.tcx.def_kind(did);
|
||||
let name = cx.tcx.item_name(did);
|
||||
Path {
|
||||
global: false,
|
||||
res: Res::Err,
|
||||
res: Res::Def(def_kind, did),
|
||||
segments: vec![PathSegment {
|
||||
name,
|
||||
args: external_generic_args(cx, trait_did, has_self, bindings, substs),
|
||||
|
@ -10,7 +10,7 @@ unsafe impl<T> Send for Inner<T>
|
||||
|
||||
// @has no_redundancy/struct.Outer.html
|
||||
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||
// "impl<T> Send for Outer<T> where T: Copy + Send"
|
||||
// "impl<T> Send for Outer<T> where T: Send + Copy"
|
||||
pub struct Outer<T> {
|
||||
inner_field: Inner<T>,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user