Skip to content

Commit 4c79967

Browse files
authored
Rollup merge of rust-lang#59170 - varkor:const-generics-rustdoc, r=QuietMisdreavus,eddyb
Add const generics to rustdoc Split out from rust-lang#53645. This work is a collaborative effort with @yodaldevoid. The `FIXME`s are waiting on a refactor to `LazyConst`. I'll address these in a follow up, but I thought it would be better to implement the rest now to avoid bitrot. r? @QuietMisdreavus
2 parents 5481b4e + 9bc5811 commit 4c79967

File tree

7 files changed

+156
-117
lines changed

7 files changed

+156
-117
lines changed

src/librustc/hir/print.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -591,12 +591,12 @@ impl<'a> State<'a> {
591591
self.s.word(";")?;
592592
self.end()?; // end the outer cbox
593593
}
594-
hir::ItemKind::Fn(ref decl, header, ref typarams, body) => {
594+
hir::ItemKind::Fn(ref decl, header, ref param_names, body) => {
595595
self.head("")?;
596596
self.print_fn(decl,
597597
header,
598598
Some(item.ident.name),
599-
typarams,
599+
param_names,
600600
&item.vis,
601601
&[],
602602
Some(body))?;

src/librustdoc/clean/auto_trait.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
435435
let new_ty = match &poly_trait.trait_ {
436436
&Type::ResolvedPath {
437437
ref path,
438-
ref typarams,
438+
ref param_names,
439439
ref did,
440440
ref is_generic,
441441
} => {
@@ -444,7 +444,13 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
444444
.expect("segments were empty");
445445

446446
let (old_input, old_output) = match last_segment.args {
447-
GenericArgs::AngleBracketed { types, .. } => (types, None),
447+
GenericArgs::AngleBracketed { args, .. } => {
448+
let types = args.iter().filter_map(|arg| match arg {
449+
GenericArg::Type(ty) => Some(ty.clone()),
450+
_ => None,
451+
}).collect();
452+
(types, None)
453+
}
448454
GenericArgs::Parenthesized { inputs, output, .. } => {
449455
(inputs, output)
450456
}
@@ -469,7 +475,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
469475

470476
Type::ResolvedPath {
471477
path: new_path,
472-
typarams: typarams.clone(),
478+
param_names: param_names.clone(),
473479
did: did.clone(),
474480
is_generic: *is_generic,
475481
}
@@ -669,7 +675,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
669675
match **trait_ {
670676
Type::ResolvedPath {
671677
path: ref trait_path,
672-
ref typarams,
678+
ref param_names,
673679
ref did,
674680
ref is_generic,
675681
} => {
@@ -724,7 +730,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
724730
PolyTrait {
725731
trait_: Type::ResolvedPath {
726732
path: new_trait_path,
727-
typarams: typarams.clone(),
733+
param_names: param_names.clone(),
728734
did: did.clone(),
729735
is_generic: *is_generic,
730736
},

0 commit comments

Comments
 (0)