diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2023-10-03 17:41:25 +0200 |
|---|---|---|
| committer | León Orell Valerian Liehr <me@fmease.dev> | 2023-10-03 17:41:25 +0200 |
| commit | ace85f0ae31052e5928a19797762077444f9e93c (patch) | |
| tree | 1425e06d7402a22d8801274c4d9fc612ceb811b6 /src | |
| parent | 67de1509f394414c2987af32a952a6fe66ad815a (diff) | |
| download | rust-ace85f0ae31052e5928a19797762077444f9e93c.tar.gz rust-ace85f0ae31052e5928a19797762077444f9e93c.zip | |
rustdoc: add support for cross-crate higher-ranked types
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 00d5a254627..84749a77fa7 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2226,6 +2226,11 @@ pub(crate) fn clean_middle_ty<'tcx>( } } + ty::Bound(_, ref ty) => match ty.kind { + ty::BoundTyKind::Param(_, name) => Generic(name), + ty::BoundTyKind::Anon => panic!("unexpected anonymous bound type variable"), + }, + ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) => { // If it's already in the same alias, don't get an infinite loop. if cx.current_type_aliases.contains_key(&def_id) { @@ -2254,7 +2259,6 @@ pub(crate) fn clean_middle_ty<'tcx>( ty::Closure(..) => panic!("Closure"), ty::Generator(..) => panic!("Generator"), - ty::Bound(..) => panic!("Bound"), ty::Placeholder(..) => panic!("Placeholder"), ty::GeneratorWitness(..) => panic!("GeneratorWitness"), ty::Infer(..) => panic!("Infer"), @@ -3097,6 +3101,17 @@ fn clean_bound_vars<'tcx>( { Some(GenericParamDef::lifetime(name)) } + ty::BoundVariableKind::Ty(ty::BoundTyKind::Param(did, name)) => Some(GenericParamDef { + name, + kind: GenericParamDefKind::Type { + did, + bounds: Vec::new(), + default: None, + synthetic: false, + }, + }), + // FIXME(non_lifetime_binders): Support higher-ranked const parameters. + ty::BoundVariableKind::Const => None, _ => None, }) .collect() |
