Update with comments
A bunch of nits fixed, and a new test for pretty printing the AST.
This commit is contained in:
parent
9fe793ae5d
commit
ea2af70466
11 changed files with 69 additions and 17 deletions
|
@ -206,8 +206,7 @@ impl<'tcx> Const<'tcx> {
|
|||
pub fn const_param_default<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx Const<'tcx> {
|
||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id.expect_local());
|
||||
let default_def_id = match tcx.hir().get(hir_id) {
|
||||
hir::Node::AnonConst(ac)
|
||||
| hir::Node::GenericParam(hir::GenericParam {
|
||||
hir::Node::GenericParam(hir::GenericParam {
|
||||
kind: hir::GenericParamKind::Const { ty: _, default: Some(ac) },
|
||||
..
|
||||
}) => tcx.hir().local_def_id(ac.hir_id),
|
||||
|
|
|
@ -120,10 +120,12 @@ impl<'tcx> Generics {
|
|||
for param in &self.params {
|
||||
match param.kind {
|
||||
GenericParamDefKind::Lifetime => (),
|
||||
GenericParamDefKind::Type { has_default, .. }
|
||||
| GenericParamDefKind::Const { has_default } => {
|
||||
GenericParamDefKind::Type { has_default, .. } => {
|
||||
own_defaults.types += has_default as usize;
|
||||
}
|
||||
GenericParamDefKind::Const { has_default } => {
|
||||
own_defaults.consts += has_default as usize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue