Skip to content

Commit

Permalink
Rollup merge of rust-lang#59170 - varkor:const-generics-rustdoc, r=Qu…
Browse files Browse the repository at this point in the history
…ietMisdreavus,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
  • Loading branch information
Centril authored Mar 22, 2019
2 parents 5481b4e + 9bc5811 commit 4c79967
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 117 deletions.
4 changes: 2 additions & 2 deletions src/librustc/hir/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,12 +591,12 @@ impl<'a> State<'a> {
self.s.word(";")?;
self.end()?; // end the outer cbox
}
hir::ItemKind::Fn(ref decl, header, ref typarams, body) => {
hir::ItemKind::Fn(ref decl, header, ref param_names, body) => {
self.head("")?;
self.print_fn(decl,
header,
Some(item.ident.name),
typarams,
param_names,
&item.vis,
&[],
Some(body))?;
Expand Down
16 changes: 11 additions & 5 deletions src/librustdoc/clean/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
let new_ty = match &poly_trait.trait_ {
&Type::ResolvedPath {
ref path,
ref typarams,
ref param_names,
ref did,
ref is_generic,
} => {
Expand All @@ -444,7 +444,13 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
.expect("segments were empty");

let (old_input, old_output) = match last_segment.args {
GenericArgs::AngleBracketed { types, .. } => (types, None),
GenericArgs::AngleBracketed { args, .. } => {
let types = args.iter().filter_map(|arg| match arg {
GenericArg::Type(ty) => Some(ty.clone()),
_ => None,
}).collect();
(types, None)
}
GenericArgs::Parenthesized { inputs, output, .. } => {
(inputs, output)
}
Expand All @@ -469,7 +475,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {

Type::ResolvedPath {
path: new_path,
typarams: typarams.clone(),
param_names: param_names.clone(),
did: did.clone(),
is_generic: *is_generic,
}
Expand Down Expand Up @@ -669,7 +675,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
match **trait_ {
Type::ResolvedPath {
path: ref trait_path,
ref typarams,
ref param_names,
ref did,
ref is_generic,
} => {
Expand Down Expand Up @@ -724,7 +730,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
PolyTrait {
trait_: Type::ResolvedPath {
path: new_trait_path,
typarams: typarams.clone(),
param_names: param_names.clone(),
did: did.clone(),
is_generic: *is_generic,
},
Expand Down
Loading

0 comments on commit 4c79967

Please sign in to comment.