Gracefully handle AnonConst in diagnostic_hir_wf_check()
when it is the default value of a generic param
This commit is contained in:
parent
21d94a3d2c
commit
3c70d60c4f
3 changed files with 82 additions and 0 deletions
|
@ -163,6 +163,16 @@ fn diagnostic_hir_wf_check<'tcx>(
|
|||
kind: hir::GenericParamKind::Type { default: Some(ty), .. },
|
||||
..
|
||||
}) => vec![*ty],
|
||||
hir::Node::AnonConst(_)
|
||||
if let Some(const_param_id) =
|
||||
tcx.hir().opt_const_param_default_param_def_id(hir_id)
|
||||
&& let hir::Node::GenericParam(hir::GenericParam {
|
||||
kind: hir::GenericParamKind::Const { ty, .. },
|
||||
..
|
||||
}) = tcx.hir_node_by_def_id(const_param_id) =>
|
||||
{
|
||||
vec![*ty]
|
||||
}
|
||||
ref node => bug!("Unexpected node {:?}", node),
|
||||
},
|
||||
WellFormedLoc::Param { function: _, param_idx } => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue