1
Fork 0

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:
Noah Lev 2021-08-24 10:33:41 -07:00
parent 0bb1c285af
commit 6a84d34784
4 changed files with 13 additions and 20 deletions

View file

@ -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),