}
Node::GenericParam(param) => match ¶m.kind {
- hir::GenericParamKind::Type { default: Some(ref ty), .. } |
- hir::GenericParamKind::Const { ref ty, .. } => {
- icx.to_ty(ty)
+ 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::emit_feature_err(
+ &tcx.sess.parse_sess,
+ sym::const_compare_raw_pointers,
+ hir_ty.span,
+ feature_gate::GateIssue::Language,
+ &format!(
+ "using {} as const generic parameters is unstable",
+ unsupported_type
+ ),
+ );
+ };
+ }
+ ty
}
x => {
if !fail {
codegen_fn_attrs.flags |= CodegenFnAttrFlags::USED;
} else if attr.check_name(sym::thread_local) {
codegen_fn_attrs.flags |= CodegenFnAttrFlags::THREAD_LOCAL;
+ } else if attr.check_name(sym::track_caller) {
+ if tcx.fn_sig(id).abi() != abi::Abi::Rust {
+ struct_span_err!(
+ tcx.sess,
+ attr.span,
+ E0737,
+ "rust ABI is required to use `#[track_caller]`"
+ ).emit();
+ }
+ codegen_fn_attrs.flags |= CodegenFnAttrFlags::TRACK_CALLER;
} else if attr.check_name(sym::export_name) {
if let Some(s) = attr.value_str() {
if s.as_str().contains("\0") {