1 //! Parsing and validation of builtin attributes
3 use crate::ast::{self, Attribute, MetaItem, NestedMetaItem};
4 use crate::early_buffered_lints::BufferedEarlyLintId;
5 use crate::ext::base::ExtCtxt;
6 use crate::ext::build::AstBuilder;
7 use crate::feature_gate::{Features, GatedCfg};
8 use crate::parse::ParseSess;
10 use errors::{Applicability, Handler};
11 use syntax_pos::hygiene::Transparency;
12 use syntax_pos::{symbol::Symbol, symbol::sym, Span};
14 use super::{mark_used, MetaItemKind};
18 UnknownMetaItem(String, &'static [&'static str]),
21 MultipleStabilityLevels,
22 UnsupportedLiteral(&'static str, /* is_bytestr */ bool),
25 /// A template that the attribute input must match.
26 /// Only top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is considered now.
27 #[derive(Clone, Copy)]
28 pub struct AttributeTemplate {
30 crate list: Option<&'static str>,
31 crate name_value_str: Option<&'static str>,
34 impl AttributeTemplate {
35 /// Checks that the given meta-item is compatible with this template.
36 fn compatible(&self, meta_item_kind: &ast::MetaItemKind) -> bool {
37 match meta_item_kind {
38 ast::MetaItemKind::Word => self.word,
39 ast::MetaItemKind::List(..) => self.list.is_some(),
40 ast::MetaItemKind::NameValue(lit) if lit.node.is_str() => self.name_value_str.is_some(),
41 ast::MetaItemKind::NameValue(..) => false,
46 fn handle_errors(sess: &ParseSess, span: Span, error: AttrError) {
47 let diag = &sess.span_diagnostic;
49 AttrError::MultipleItem(item) => span_err!(diag, span, E0538,
50 "multiple '{}' items", item),
51 AttrError::UnknownMetaItem(item, expected) => {
52 let expected = expected
54 .map(|name| format!("`{}`", name))
56 struct_span_err!(diag, span, E0541, "unknown meta item '{}'", item)
57 .span_label(span, format!("expected one of {}", expected.join(", ")))
60 AttrError::MissingSince => span_err!(diag, span, E0542, "missing 'since'"),
61 AttrError::MissingFeature => span_err!(diag, span, E0546, "missing 'feature'"),
62 AttrError::MultipleStabilityLevels => span_err!(diag, span, E0544,
63 "multiple stability levels"),
64 AttrError::UnsupportedLiteral(
68 let mut err = struct_span_err!(diag, span, E0565, "{}", msg);
70 if let Ok(lint_str) = sess.source_map().span_to_snippet(span) {
73 "consider removing the prefix",
74 format!("{}", &lint_str[1..]),
75 Applicability::MaybeIncorrect,
84 #[derive(Copy, Clone, Hash, PartialEq, RustcEncodable, RustcDecodable)]
92 #[derive(Copy, Clone, Hash, PartialEq, RustcEncodable, RustcDecodable)]
93 pub enum OptimizeAttr {
99 #[derive(Copy, Clone, PartialEq)]
100 pub enum UnwindAttr {
105 /// Determine what `#[unwind]` attribute is present in `attrs`, if any.
106 pub fn find_unwind_attr(diagnostic: Option<&Handler>, attrs: &[Attribute]) -> Option<UnwindAttr> {
107 attrs.iter().fold(None, |ia, attr| {
108 if attr.check_name(sym::unwind) {
109 if let Some(meta) = attr.meta() {
110 if let MetaItemKind::List(items) = meta.node {
111 if items.len() == 1 {
112 if items[0].check_name(sym::allowed) {
113 return Some(UnwindAttr::Allowed);
114 } else if items[0].check_name(sym::aborts) {
115 return Some(UnwindAttr::Aborts);
120 struct_span_err!(d, attr.span, E0633, "malformed `unwind` attribute input")
121 .span_label(attr.span, "invalid argument")
124 "the allowed arguments are `allowed` and `aborts`",
125 (vec!["allowed", "aborts"]).into_iter()
126 .map(|s| format!("#[unwind({})]", s)),
127 Applicability::MachineApplicable,
138 /// Represents the #[stable], #[unstable], #[rustc_{deprecated,const_unstable}] attributes.
139 #[derive(RustcEncodable, RustcDecodable, Copy, Clone, Debug, PartialEq, Eq, Hash)]
140 pub struct Stability {
141 pub level: StabilityLevel,
143 pub rustc_depr: Option<RustcDeprecation>,
144 /// `None` means the function is stable but needs to be a stable const fn, too
145 /// `Some` contains the feature gate required to be able to use the function
147 pub const_stability: Option<Symbol>,
148 /// whether the function has a `#[rustc_promotable]` attribute
149 pub promotable: bool,
150 /// whether the function has a `#[rustc_allow_const_fn_ptr]` attribute
151 pub allow_const_fn_ptr: bool,
154 /// The available stability levels.
155 #[derive(RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Copy, Clone, Debug, Eq, Hash)]
156 pub enum StabilityLevel {
157 // Reason for the current stability level and the relevant rust-lang issue
158 Unstable { reason: Option<Symbol>, issue: u32 },
159 Stable { since: Symbol },
163 pub fn unstable(feature: Symbol, reason: Option<Symbol>, issue: u32) -> Stability {
165 level: StabilityLevel::Unstable { reason, issue },
168 const_stability: None,
170 allow_const_fn_ptr: false,
175 impl StabilityLevel {
176 pub fn is_unstable(&self) -> bool {
177 if let StabilityLevel::Unstable {..} = *self {
183 pub fn is_stable(&self) -> bool {
184 if let StabilityLevel::Stable {..} = *self {
192 #[derive(RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Copy, Clone, Debug, Eq, Hash)]
193 pub struct RustcDeprecation {
196 /// A text snippet used to completely replace any use of the deprecated item in an expression.
197 pub suggestion: Option<Symbol>,
200 /// Checks if `attrs` contains an attribute like `#![feature(feature_name)]`.
201 /// This will not perform any "sanity checks" on the form of the attributes.
202 pub fn contains_feature_attr(attrs: &[Attribute], feature_name: Symbol) -> bool {
203 attrs.iter().any(|item| {
204 item.check_name(sym::feature) &&
205 item.meta_item_list().map(|list| {
206 list.iter().any(|mi| mi.is_word() && mi.check_name(feature_name))
211 /// Collects stability info from all stability attributes in `attrs`.
212 /// Returns `None` if no stability attributes are found.
213 pub fn find_stability(sess: &ParseSess, attrs: &[Attribute],
214 item_sp: Span) -> Option<Stability> {
215 find_stability_generic(sess, attrs.iter(), item_sp)
218 fn find_stability_generic<'a, I>(sess: &ParseSess,
222 where I: Iterator<Item = &'a Attribute>
224 use StabilityLevel::*;
226 let mut stab: Option<Stability> = None;
227 let mut rustc_depr: Option<RustcDeprecation> = None;
228 let mut rustc_const_unstable: Option<Symbol> = None;
229 let mut promotable = false;
230 let mut allow_const_fn_ptr = false;
231 let diagnostic = &sess.span_diagnostic;
233 'outer: for attr in attrs_iter {
235 sym::rustc_deprecated,
236 sym::rustc_const_unstable,
239 sym::rustc_promotable,
240 sym::rustc_allow_const_fn_ptr,
241 ].iter().any(|&s| attr.path == s) {
242 continue // not a stability level
247 let meta = attr.meta();
249 if attr.path == sym::rustc_promotable {
252 if attr.path == sym::rustc_allow_const_fn_ptr {
253 allow_const_fn_ptr = true;
255 // attributes with data
256 else if let Some(MetaItem { node: MetaItemKind::List(ref metas), .. }) = meta {
257 let meta = meta.as_ref().unwrap();
258 let get = |meta: &MetaItem, item: &mut Option<Symbol>| {
260 handle_errors(sess, meta.span, AttrError::MultipleItem(meta.path.to_string()));
263 if let Some(v) = meta.value_str() {
267 span_err!(diagnostic, meta.span, E0539, "incorrect meta item");
272 macro_rules! get_meta {
273 ($($name:ident),+) => {
275 let mut $name = None;
278 if let Some(mi) = meta.meta_item() {
279 match mi.name_or_empty() {
281 sym::$name => if !get(mi, &mut $name) { continue 'outer },
284 let expected = &[ $( stringify!($name) ),+ ];
288 AttrError::UnknownMetaItem(mi.path.to_string(), expected),
297 AttrError::UnsupportedLiteral(
298 "unsupported literal",
308 match meta.name_or_empty() {
309 sym::rustc_deprecated => {
310 if rustc_depr.is_some() {
311 span_err!(diagnostic, item_sp, E0540,
312 "multiple rustc_deprecated attributes");
316 get_meta!(since, reason, suggestion);
318 match (since, reason) {
319 (Some(since), Some(reason)) => {
320 rustc_depr = Some(RustcDeprecation {
327 handle_errors(sess, attr.span, AttrError::MissingSince);
331 span_err!(diagnostic, attr.span, E0543, "missing 'reason'");
336 sym::rustc_const_unstable => {
337 if rustc_const_unstable.is_some() {
338 span_err!(diagnostic, item_sp, E0553,
339 "multiple rustc_const_unstable attributes");
344 if let Some(feature) = feature {
345 rustc_const_unstable = Some(feature);
347 span_err!(diagnostic, attr.span, E0629, "missing 'feature'");
353 handle_errors(sess, attr.span, AttrError::MultipleStabilityLevels);
357 let mut feature = None;
358 let mut reason = None;
359 let mut issue = None;
361 if let Some(mi) = meta.meta_item() {
362 match mi.name_or_empty() {
363 sym::feature => if !get(mi, &mut feature) { continue 'outer },
364 sym::reason => if !get(mi, &mut reason) { continue 'outer },
365 sym::issue => if !get(mi, &mut issue) { continue 'outer },
370 AttrError::UnknownMetaItem(
372 &["feature", "reason", "issue"]
382 AttrError::UnsupportedLiteral(
383 "unsupported literal",
391 match (feature, reason, issue) {
392 (Some(feature), reason, Some(issue)) => {
393 stab = Some(Stability {
397 if let Ok(issue) = issue.as_str().parse() {
400 span_err!(diagnostic, attr.span, E0545,
401 "incorrect 'issue'");
408 const_stability: None,
410 allow_const_fn_ptr: false,
414 handle_errors(sess, attr.span, AttrError::MissingFeature);
418 span_err!(diagnostic, attr.span, E0547, "missing 'issue'");
425 handle_errors(sess, attr.span, AttrError::MultipleStabilityLevels);
429 let mut feature = None;
430 let mut since = None;
433 NestedMetaItem::MetaItem(mi) => {
434 match mi.name_or_empty() {
435 sym::feature => if !get(mi, &mut feature) { continue 'outer },
436 sym::since => if !get(mi, &mut since) { continue 'outer },
441 AttrError::UnknownMetaItem(
442 mi.path.to_string(), &["since", "note"],
449 NestedMetaItem::Literal(lit) => {
453 AttrError::UnsupportedLiteral(
454 "unsupported literal",
463 match (feature, since) {
464 (Some(feature), Some(since)) => {
465 stab = Some(Stability {
471 const_stability: None,
473 allow_const_fn_ptr: false,
477 handle_errors(sess, attr.span, AttrError::MissingFeature);
481 handle_errors(sess, attr.span, AttrError::MissingSince);
491 // Merge the deprecation info into the stability info
492 if let Some(rustc_depr) = rustc_depr {
493 if let Some(ref mut stab) = stab {
494 stab.rustc_depr = Some(rustc_depr);
496 span_err!(diagnostic, item_sp, E0549,
497 "rustc_deprecated attribute must be paired with \
498 either stable or unstable attribute");
502 // Merge the const-unstable info into the stability info
503 if let Some(feature) = rustc_const_unstable {
504 if let Some(ref mut stab) = stab {
505 stab.const_stability = Some(feature);
507 span_err!(diagnostic, item_sp, E0630,
508 "rustc_const_unstable attribute must be paired with \
509 either stable or unstable attribute");
513 // Merge the const-unstable info into the stability info
514 if promotable || allow_const_fn_ptr {
515 if let Some(ref mut stab) = stab {
516 stab.promotable = promotable;
517 stab.allow_const_fn_ptr = allow_const_fn_ptr;
519 span_err!(diagnostic, item_sp, E0717,
520 "rustc_promotable and rustc_allow_const_fn_ptr attributes \
521 must be paired with either stable or unstable attribute");
528 pub fn find_crate_name(attrs: &[Attribute]) -> Option<Symbol> {
529 super::first_attr_value_str_by_name(attrs, sym::crate_name)
532 /// Tests if a cfg-pattern matches the cfg set
533 pub fn cfg_matches(cfg: &ast::MetaItem, sess: &ParseSess, features: Option<&Features>) -> bool {
534 eval_condition(cfg, sess, &mut |cfg| {
535 if let (Some(feats), Some(gated_cfg)) = (features, GatedCfg::gate(cfg)) {
536 gated_cfg.check_and_emit(sess, feats);
538 let error = |span, msg| { sess.span_diagnostic.span_err(span, msg); true };
539 if cfg.path.segments.len() != 1 {
540 return error(cfg.path.span, "`cfg` predicate key must be an identifier");
543 MetaItemKind::List(..) => {
544 error(cfg.span, "unexpected parentheses after `cfg` predicate key")
546 MetaItemKind::NameValue(lit) if !lit.node.is_str() => {
550 AttrError::UnsupportedLiteral(
551 "literal in `cfg` predicate value must be a string",
552 lit.node.is_bytestr()
557 MetaItemKind::NameValue(..) | MetaItemKind::Word => {
558 let ident = cfg.ident().expect("multi-segment cfg predicate");
559 sess.config.contains(&(ident.name, cfg.value_str()))
565 /// Evaluate a cfg-like condition (with `any` and `all`), using `eval` to
566 /// evaluate individual items.
567 pub fn eval_condition<F>(cfg: &ast::MetaItem, sess: &ParseSess, eval: &mut F)
569 where F: FnMut(&ast::MetaItem) -> bool
572 ast::MetaItemKind::List(ref mis) => {
573 for mi in mis.iter() {
574 if !mi.is_meta_item() {
578 AttrError::UnsupportedLiteral(
579 "unsupported literal",
587 // The unwraps below may look dangerous, but we've already asserted
588 // that they won't fail with the loop above.
589 match cfg.name_or_empty() {
590 sym::any => mis.iter().any(|mi| {
591 eval_condition(mi.meta_item().unwrap(), sess, eval)
593 sym::all => mis.iter().all(|mi| {
594 eval_condition(mi.meta_item().unwrap(), sess, eval)
598 span_err!(sess.span_diagnostic, cfg.span, E0536, "expected 1 cfg-pattern");
602 !eval_condition(mis[0].meta_item().unwrap(), sess, eval)
605 span_err!(sess.span_diagnostic, cfg.span, E0537,
606 "invalid predicate `{}`", cfg.path);
611 ast::MetaItemKind::Word | ast::MetaItemKind::NameValue(..) => {
618 #[derive(RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Clone, Debug, Eq, Hash)]
619 pub struct Deprecation {
620 pub since: Option<Symbol>,
621 pub note: Option<Symbol>,
624 /// Finds the deprecation attribute. `None` if none exists.
625 pub fn find_deprecation(sess: &ParseSess, attrs: &[Attribute],
626 item_sp: Span) -> Option<Deprecation> {
627 find_deprecation_generic(sess, attrs.iter(), item_sp)
630 fn find_deprecation_generic<'a, I>(sess: &ParseSess,
633 -> Option<Deprecation>
634 where I: Iterator<Item = &'a Attribute>
636 let mut depr: Option<Deprecation> = None;
637 let diagnostic = &sess.span_diagnostic;
639 'outer: for attr in attrs_iter {
640 if !attr.check_name(sym::deprecated) {
645 span_err!(diagnostic, item_sp, E0550, "multiple deprecated attributes");
649 let meta = attr.meta().unwrap();
650 depr = match &meta.node {
651 MetaItemKind::Word => Some(Deprecation { since: None, note: None }),
652 MetaItemKind::NameValue(..) => {
653 meta.value_str().map(|note| {
654 Deprecation { since: None, note: Some(note) }
657 MetaItemKind::List(list) => {
658 let get = |meta: &MetaItem, item: &mut Option<Symbol>| {
661 sess, meta.span, AttrError::MultipleItem(meta.path.to_string())
665 if let Some(v) = meta.value_str() {
669 if let Some(lit) = meta.name_value_literal() {
673 AttrError::UnsupportedLiteral(
674 "literal in `deprecated` \
675 value must be a string",
676 lit.node.is_bytestr()
680 span_err!(diagnostic, meta.span, E0551, "incorrect meta item");
687 let mut since = None;
691 NestedMetaItem::MetaItem(mi) => {
692 match mi.name_or_empty() {
693 sym::since => if !get(mi, &mut since) { continue 'outer },
694 sym::note => if !get(mi, &mut note) { continue 'outer },
699 AttrError::UnknownMetaItem(mi.path.to_string(),
706 NestedMetaItem::Literal(lit) => {
710 AttrError::UnsupportedLiteral(
711 "item in `deprecated` must be a key/value pair",
720 Some(Deprecation { since, note })
728 #[derive(PartialEq, Debug, RustcEncodable, RustcDecodable, Copy, Clone)]
738 #[derive(Eq, Hash, PartialEq, Debug, RustcEncodable, RustcDecodable, Copy, Clone)]
740 SignedInt(ast::IntTy),
741 UnsignedInt(ast::UintTy)
746 pub fn is_signed(self) -> bool {
750 SignedInt(..) => true,
751 UnsignedInt(..) => false
756 /// Parse #[repr(...)] forms.
758 /// Valid repr contents: any of the primitive integral type names (see
759 /// `int_type_of_word`, below) to specify enum discriminant type; `C`, to use
760 /// the same discriminant size that the corresponding C enum would or C
761 /// structure layout, `packed` to remove padding, and `transparent` to elegate representation
762 /// concerns to the only non-ZST field.
763 pub fn find_repr_attrs(sess: &ParseSess, attr: &Attribute) -> Vec<ReprAttr> {
766 let mut acc = Vec::new();
767 let diagnostic = &sess.span_diagnostic;
768 if attr.path == sym::repr {
769 if let Some(items) = attr.meta_item_list() {
772 if !item.is_meta_item() {
776 AttrError::UnsupportedLiteral(
777 "meta item in `repr` must be an identifier",
784 let mut recognised = false;
786 let hint = match item.name_or_empty() {
787 sym::C => Some(ReprC),
788 sym::packed => Some(ReprPacked(1)),
789 sym::simd => Some(ReprSimd),
790 sym::transparent => Some(ReprTransparent),
791 name => int_type_of_word(name).map(ReprInt),
794 if let Some(h) = hint {
798 } else if let Some((name, value)) = item.name_value_literal() {
799 let parse_alignment = |node: &ast::LitKind| -> Result<u32, &'static str> {
800 if let ast::LitKind::Int(literal, ast::LitIntType::Unsuffixed) = node {
801 if literal.is_power_of_two() {
802 // rustc::ty::layout::Align restricts align to <= 2^29
803 if *literal <= 1 << 29 {
806 Err("larger than 2^29")
809 Err("not a power of two")
812 Err("not an unsuffixed integer")
816 let mut literal_error = None;
817 if name == sym::align {
819 match parse_alignment(&value.node) {
820 Ok(literal) => acc.push(ReprAlign(literal)),
821 Err(message) => literal_error = Some(message)
824 else if name == sym::packed {
826 match parse_alignment(&value.node) {
827 Ok(literal) => acc.push(ReprPacked(literal)),
828 Err(message) => literal_error = Some(message)
831 if let Some(literal_error) = literal_error {
832 span_err!(diagnostic, item.span(), E0589,
833 "invalid `repr(align)` attribute: {}", literal_error);
836 if let Some(meta_item) = item.meta_item() {
837 if meta_item.check_name(sym::align) {
838 if let MetaItemKind::NameValue(ref value) = meta_item.node {
840 let mut err = struct_span_err!(diagnostic, item.span(), E0693,
841 "incorrect `repr(align)` attribute format");
843 ast::LitKind::Int(int, ast::LitIntType::Unsuffixed) => {
846 "use parentheses instead",
847 format!("align({})", int),
848 Applicability::MachineApplicable
851 ast::LitKind::Str(s, _) => {
854 "use parentheses instead",
855 format!("align({})", s),
856 Applicability::MachineApplicable
867 // Not a word we recognize
868 span_err!(diagnostic, item.span(), E0552,
869 "unrecognized representation hint");
877 fn int_type_of_word(s: Symbol) -> Option<IntType> {
881 sym::i8 => Some(SignedInt(ast::IntTy::I8)),
882 sym::u8 => Some(UnsignedInt(ast::UintTy::U8)),
883 sym::i16 => Some(SignedInt(ast::IntTy::I16)),
884 sym::u16 => Some(UnsignedInt(ast::UintTy::U16)),
885 sym::i32 => Some(SignedInt(ast::IntTy::I32)),
886 sym::u32 => Some(UnsignedInt(ast::UintTy::U32)),
887 sym::i64 => Some(SignedInt(ast::IntTy::I64)),
888 sym::u64 => Some(UnsignedInt(ast::UintTy::U64)),
889 sym::i128 => Some(SignedInt(ast::IntTy::I128)),
890 sym::u128 => Some(UnsignedInt(ast::UintTy::U128)),
891 sym::isize => Some(SignedInt(ast::IntTy::Isize)),
892 sym::usize => Some(UnsignedInt(ast::UintTy::Usize)),
897 pub enum TransparencyError {
898 UnknownTransparency(Symbol, Span),
899 MultipleTransparencyAttrs(Span, Span),
902 pub fn find_transparency(
903 attrs: &[Attribute], is_legacy: bool
904 ) -> (Transparency, Option<TransparencyError>) {
905 let mut transparency = None;
906 let mut error = None;
908 if attr.check_name(sym::rustc_macro_transparency) {
909 if let Some((_, old_span)) = transparency {
910 error = Some(TransparencyError::MultipleTransparencyAttrs(old_span, attr.span));
912 } else if let Some(value) = attr.value_str() {
913 transparency = Some((match &*value.as_str() {
914 "transparent" => Transparency::Transparent,
915 "semitransparent" => Transparency::SemiTransparent,
916 "opaque" => Transparency::Opaque,
918 error = Some(TransparencyError::UnknownTransparency(value, attr.span));
925 let fallback = if is_legacy { Transparency::SemiTransparent } else { Transparency::Opaque };
926 (transparency.map_or(fallback, |t| t.0), error)
929 pub fn check_builtin_macro_attribute(ecx: &ExtCtxt<'_>, meta_item: &MetaItem, name: Symbol) {
930 // All the built-in macro attributes are "words" at the moment.
931 let template = AttributeTemplate { word: true, list: None, name_value_str: None };
932 let attr = ecx.attribute(meta_item.clone());
933 check_builtin_attribute(ecx.parse_sess, &attr, name, template);
936 crate fn check_builtin_attribute(
937 sess: &ParseSess, attr: &ast::Attribute, name: Symbol, template: AttributeTemplate
939 // Some special attributes like `cfg` must be checked
940 // before the generic check, so we skip them here.
941 let should_skip = |name| name == sym::cfg;
942 // Some of previously accepted forms were used in practice,
943 // report them as warnings for now.
944 let should_warn = |name| name == sym::doc || name == sym::ignore ||
945 name == sym::inline || name == sym::link ||
946 name == sym::test || name == sym::bench;
948 match attr.parse_meta(sess) {
949 Ok(meta) => if !should_skip(name) && !template.compatible(&meta.node) {
950 let error_msg = format!("malformed `{}` attribute input", name);
951 let mut msg = "attribute must be of the form ".to_owned();
952 let mut suggestions = vec![];
953 let mut first = true;
956 let code = format!("#[{}]", name);
957 msg.push_str(&format!("`{}`", &code));
958 suggestions.push(code);
960 if let Some(descr) = template.list {
962 msg.push_str(" or ");
965 let code = format!("#[{}({})]", name, descr);
966 msg.push_str(&format!("`{}`", &code));
967 suggestions.push(code);
969 if let Some(descr) = template.name_value_str {
971 msg.push_str(" or ");
973 let code = format!("#[{} = \"{}\"]", name, descr);
974 msg.push_str(&format!("`{}`", &code));
975 suggestions.push(code);
977 if should_warn(name) {
979 BufferedEarlyLintId::IllFormedAttributeInput,
985 sess.span_diagnostic.struct_span_err(meta.span, &error_msg)
988 if suggestions.len() == 1 {
989 "must be of the form"
991 "the following are the possible correct uses"
993 suggestions.into_iter(),
994 Applicability::HasPlaceholders,
998 Err(mut err) => err.emit(),