From e6808381e529c7e24645de3a0c605ac07edeaff3 Mon Sep 17 00:00:00 2001 From: lcnr Date: Thu, 27 Jan 2022 07:58:33 +0100 Subject: [PATCH] update pass_by_value --- compiler/rustc_feature/src/builtin_attrs.rs | 2 +- compiler/rustc_lint/src/pass_by_value.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 0e643ff5998..fc7f01f041d 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -625,7 +625,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ ), rustc_attr!( rustc_pass_by_value, Normal, - template!(Word), WarnFollowing, + template!(Word), ErrorFollowing, "#[rustc_pass_by_value] is used to mark types that must be passed by value instead of reference." ), BuiltinAttribute { diff --git a/compiler/rustc_lint/src/pass_by_value.rs b/compiler/rustc_lint/src/pass_by_value.rs index 26d0560bf89..2caf929788f 100644 --- a/compiler/rustc_lint/src/pass_by_value.rs +++ b/compiler/rustc_lint/src/pass_by_value.rs @@ -76,10 +76,10 @@ fn gen_args(cx: &LateContext<'_>, segment: &PathSegment<'_>) -> String { .map(|arg| match arg { GenericArg::Lifetime(lt) => lt.name.ident().to_string(), GenericArg::Type(ty) => { - cx.tcx.sess.source_map().span_to_snippet(ty.span).unwrap_or_default() + cx.tcx.sess.source_map().span_to_snippet(ty.span).unwrap_or_else(|_| "_".into()) } GenericArg::Const(c) => { - cx.tcx.sess.source_map().span_to_snippet(c.span).unwrap_or_default() + cx.tcx.sess.source_map().span_to_snippet(c.span).unwrap_or_else(|_| "_".into()) } GenericArg::Infer(_) => String::from("_"), })