- Node::GenericParam(param) => {
- match ¶m.kind {
- hir::GenericParamKind::Type { default: Some(ref ty), .. } => icx.to_ty(ty),
- hir::GenericParamKind::Const { ty: ref hir_ty, .. } => {
- let ty = icx.to_ty(hir_ty);
- if !tcx.features().const_compare_raw_pointers {
- let err = match ty.peel_refs().kind {
- ty::FnPtr(_) => Some("function pointers"),
- ty::RawPtr(_) => Some("raw pointers"),
- _ => None,
- };
- if let Some(unsupported_type) = err {
- feature_gate::feature_err(
- &tcx.sess.parse_sess,
- sym::const_compare_raw_pointers,
- hir_ty.span,
- &format!(
- "using {} as const generic parameters is unstable",
- unsupported_type
- ),
- )
- .emit();
- };
- }
- if ty::search_for_structural_match_violation(param.hir_id, param.span, tcx, ty)
- .is_some()
- {
- struct_span_err!(
+ Node::GenericParam(param) => match ¶m.kind {
+ hir::GenericParamKind::Type { default: Some(ref ty), .. } => icx.to_ty(ty),
+ hir::GenericParamKind::Const { ty: ref hir_ty, .. } => {
+ let ty = icx.to_ty(hir_ty);
+ if !tcx.features().const_compare_raw_pointers {
+ let err = match ty.peel_refs().kind {
+ ty::FnPtr(_) => Some("function pointers"),
+ ty::RawPtr(_) => Some("raw pointers"),
+ _ => None,
+ };
+ if let Some(unsupported_type) = err {
+ feature_gate::feature_err(
+ &tcx.sess.parse_sess,
+ sym::const_compare_raw_pointers,
+ hir_ty.span,
+ &format!(
+ "using {} as const generic parameters is unstable",
+ unsupported_type
+ ),
+ )
+ .emit();
+ };
+ }
+ if traits::search_for_structural_match_violation(param.hir_id, param.span, tcx, ty)
+ .is_some()
+ {
+ struct_span_err!(