1//! Built-in attributes and `cfg` flag gating.
23use std::sync::LazyLock;
45use AttributeGate::*;
6use rustc_data_structures::fx::FxHashMap;
7use rustc_hir::AttrStyle;
8use rustc_span::{Symbol, sym};
910use crate::Features;
1112type GateFn = fn(&Features) -> bool;
1314pub type GatedCfg = (Symbol, Symbol, GateFn);
1516/// `cfg(...)`'s that are feature gated.
17const GATED_CFGS: &[GatedCfg] = &[
18// (name in cfg, feature, function to check if the feature is enabled)
19(sym::overflow_checks, sym::cfg_overflow_checks, Features::cfg_overflow_checks),
20 (sym::ub_checks, sym::cfg_ub_checks, Features::cfg_ub_checks),
21 (sym::contract_checks, sym::cfg_contract_checks, Features::cfg_contract_checks),
22 (sym::target_thread_local, sym::cfg_target_thread_local, Features::cfg_target_thread_local),
23 (
24 sym::target_has_atomic_equal_alignment,
25 sym::cfg_target_has_atomic_equal_alignment,
26Features::cfg_target_has_atomic_equal_alignment,
27 ),
28 (
29 sym::target_has_atomic_load_store,
30 sym::cfg_target_has_atomic,
31Features::cfg_target_has_atomic,
32 ),
33 (sym::sanitize, sym::cfg_sanitize, Features::cfg_sanitize),
34 (sym::version, sym::cfg_version, Features::cfg_version),
35 (sym::relocation_model, sym::cfg_relocation_model, Features::cfg_relocation_model),
36 (sym::sanitizer_cfi_generalize_pointers, sym::cfg_sanitizer_cfi, Features::cfg_sanitizer_cfi),
37 (sym::sanitizer_cfi_normalize_integers, sym::cfg_sanitizer_cfi, Features::cfg_sanitizer_cfi),
38// this is consistent with naming of the compiler flag it's for
39(sym::fmt_debug, sym::fmt_debug, Features::fmt_debug),
40 (sym::emscripten_wasm_eh, sym::cfg_emscripten_wasm_eh, Features::cfg_emscripten_wasm_eh),
41 (
42 sym::target_has_reliable_f16,
43 sym::cfg_target_has_reliable_f16_f128,
44Features::cfg_target_has_reliable_f16_f128,
45 ),
46 (
47 sym::target_has_reliable_f16_math,
48 sym::cfg_target_has_reliable_f16_f128,
49Features::cfg_target_has_reliable_f16_f128,
50 ),
51 (
52 sym::target_has_reliable_f128,
53 sym::cfg_target_has_reliable_f16_f128,
54Features::cfg_target_has_reliable_f16_f128,
55 ),
56 (
57 sym::target_has_reliable_f128_math,
58 sym::cfg_target_has_reliable_f16_f128,
59Features::cfg_target_has_reliable_f16_f128,
60 ),
61 (sym::target_object_format, sym::cfg_target_object_format, Features::cfg_target_object_format),
62];
6364/// Find a gated cfg determined by the `pred`icate which is given the cfg's name.
65pub fn find_gated_cfg(pred: impl Fn(Symbol) -> bool) -> Option<&'static GatedCfg> {
66GATED_CFGS.iter().find(|(cfg_sym, ..)| pred(*cfg_sym))
67}
6869#[derive(#[automatically_derived]
impl ::core::clone::Clone for AttributeGate {
#[inline]
fn clone(&self) -> AttributeGate {
let _: ::core::clone::AssertParamIsClone<Symbol>;
let _: ::core::clone::AssertParamIsClone<&'static str>;
let _: ::core::clone::AssertParamIsClone<fn(&Features) -> bool>;
let _: ::core::clone::AssertParamIsClone<&'static [&'static str]>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for AttributeGate {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
AttributeGate::Gated {
feature: __self_0,
message: __self_1,
check: __self_2,
notes: __self_3 } =>
::core::fmt::Formatter::debug_struct_field4_finish(f, "Gated",
"feature", __self_0, "message", __self_1, "check", __self_2,
"notes", &__self_3),
AttributeGate::Ungated =>
::core::fmt::Formatter::write_str(f, "Ungated"),
}
}
}Debug, #[automatically_derived]
impl ::core::marker::Copy for AttributeGate { }Copy)]
70pub enum AttributeGate {
71/// A gated attribute which requires a feature gate to be enabled.
72Gated {
73/// The feature gate, for example `#![feature(rustc_attrs)]` for rustc_* attributes.
74feature: Symbol,
75/// The error message displayed when an attempt is made to use the attribute without its feature gate.
76message: &'static str,
77/// Check function to be called during the `PostExpansionVisitor` pass.
78check: fn(&Features) -> bool,
79/// Notes to be displayed when an attempt is made to use the attribute without its feature gate.
80notes: &'static [&'static str],
81 },
82/// Ungated attribute, can be used on all release channels
83Ungated,
84}
8586// FIXME(jdonszelmann): move to rustc_hir::attrs
87/// A template that the attribute input must match.
88/// Only top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is considered now.
89#[derive(#[automatically_derived]
impl ::core::clone::Clone for AttributeTemplate {
#[inline]
fn clone(&self) -> AttributeTemplate {
let _: ::core::clone::AssertParamIsClone<bool>;
let _:
::core::clone::AssertParamIsClone<Option<&'static [&'static str]>>;
let _: ::core::clone::AssertParamIsClone<&'static [Symbol]>;
let _:
::core::clone::AssertParamIsClone<Option<&'static [&'static str]>>;
let _: ::core::clone::AssertParamIsClone<Option<&'static str>>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for AttributeTemplate { }Copy, #[automatically_derived]
impl ::core::default::Default for AttributeTemplate {
#[inline]
fn default() -> AttributeTemplate {
AttributeTemplate {
word: ::core::default::Default::default(),
list: ::core::default::Default::default(),
one_of: ::core::default::Default::default(),
name_value_str: ::core::default::Default::default(),
docs: ::core::default::Default::default(),
}
}
}Default)]
90pub struct AttributeTemplate {
91/// If `true`, the attribute is allowed to be a bare word like `#[test]`.
92pub word: bool,
93/// If `Some`, the attribute is allowed to take a list of items like `#[allow(..)]`.
94pub list: Option<&'static [&'static str]>,
95/// If non-empty, the attribute is allowed to take a list containing exactly
96 /// one of the listed words, like `#[coverage(off)]`.
97pub one_of: &'static [Symbol],
98/// If `Some`, the attribute is allowed to be a name/value pair where the
99 /// value is a string, like `#[must_use = "reason"]`.
100pub name_value_str: Option<&'static [&'static str]>,
101/// A link to the document for this attribute.
102pub docs: Option<&'static str>,
103}
104105pub enum AttrSuggestionStyle {
106/// The suggestion is styled for a normal attribute.
107 /// The `AttrStyle` determines whether this is an inner or outer attribute.
108Attribute(AttrStyle),
109/// The suggestion is styled for an attribute embedded into another attribute.
110 /// For example, attributes inside `#[cfg_attr(true, attr(...)]`.
111EmbeddedAttribute,
112/// The suggestion is styled for macros that are parsed with attribute parsers.
113 /// For example, the `cfg!(predicate)` macro.
114Macro,
115}
116117impl AttributeTemplate {
118pub fn suggestions(
119&self,
120 style: AttrSuggestionStyle,
121 name: impl std::fmt::Display,
122 ) -> Vec<String> {
123let (start, macro_call, end) = match style {
124 AttrSuggestionStyle::Attribute(AttrStyle::Outer) => ("#[", "", "]"),
125 AttrSuggestionStyle::Attribute(AttrStyle::Inner) => ("#![", "", "]"),
126 AttrSuggestionStyle::Macro => ("", "!", ""),
127 AttrSuggestionStyle::EmbeddedAttribute => ("", "", ""),
128 };
129130let mut suggestions = ::alloc::vec::Vec::new()vec![];
131132if self.word {
133if true {
if !macro_call.is_empty() {
{
::core::panicking::panic_fmt(format_args!("Macro suggestions use list style"));
}
};
};debug_assert!(macro_call.is_empty(), "Macro suggestions use list style");
134suggestions.push(::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}{1}{2}", start, name, end))
})format!("{start}{name}{end}"));
135 }
136if let Some(descr) = self.list {
137for descr in descr {
138 suggestions.push(::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}{1}{2}({3}){4}", start, name,
macro_call, descr, end))
})format!("{start}{name}{macro_call}({descr}){end}"));
139 }
140 }
141suggestions.extend(self.one_of.iter().map(|&word| ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}{1}({2}){3}", start, name, word,
end))
})format!("{start}{name}({word}){end}")));
142if let Some(descr) = self.name_value_str {
143if true {
if !macro_call.is_empty() {
{
::core::panicking::panic_fmt(format_args!("Macro suggestions use list style"));
}
};
};debug_assert!(macro_call.is_empty(), "Macro suggestions use list style");
144for descr in descr {
145 suggestions.push(::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}{1} = \"{2}\"{3}", start, name,
descr, end))
})format!("{start}{name} = \"{descr}\"{end}"));
146 }
147 }
148suggestions.sort();
149150suggestions151 }
152}
153154/// A convenience macro for constructing attribute templates.
155/// E.g., `template!(Word, List: "description")` means that the attribute
156/// supports forms `#[attr]` and `#[attr(description)]`.
157#[macro_export]
158macro_rules!template {
159 (Word) => { $crate::template!(@ true, None, &[], None, None) };
160 (Word, $link: literal) => { $crate::template!(@ true, None, &[], None, Some($link)) };
161 (List: $descr: expr) => { $crate::template!(@ false, Some($descr), &[], None, None) };
162 (List: $descr: expr, $link: literal) => { $crate::template!(@ false, Some($descr), &[], None, Some($link)) };
163 (OneOf: $one_of: expr) => { $crate::template!(@ false, None, $one_of, None, None) };
164 (NameValueStr: [$($descr: literal),* $(,)?]) => { $crate::template!(@ false, None, &[], Some(&[$($descr,)*]), None) };
165 (NameValueStr: [$($descr: literal),* $(,)?], $link: literal) => { $crate::template!(@ false, None, &[], Some(&[$($descr,)*]), Some($link)) };
166 (NameValueStr: $descr: literal) => { $crate::template!(@ false, None, &[], Some(&[$descr]), None) };
167 (NameValueStr: $descr: literal, $link: literal) => { $crate::template!(@ false, None, &[], Some(&[$descr]), Some($link)) };
168 (Word, List: $descr: expr) => { $crate::template!(@ true, Some($descr), &[], None, None) };
169 (Word, List: $descr: expr, $link: literal) => { $crate::template!(@ true, Some($descr), &[], None, Some($link)) };
170 (Word, NameValueStr: $descr: expr) => { $crate::template!(@ true, None, &[], Some(&[$descr]), None) };
171 (Word, NameValueStr: $descr: expr, $link: literal) => { $crate::template!(@ true, None, &[], Some(&[$descr]), Some($link)) };
172 (List: $descr1: expr, NameValueStr: $descr2: expr) => {
173$crate::template!(@ false, Some($descr1), &[], Some(&[$descr2]), None)
174 };
175 (List: $descr1: expr, NameValueStr: $descr2: expr, $link: literal) => {
176$crate::template!(@ false, Some($descr1), &[], Some(&[$descr2]), Some($link))
177 };
178 (Word, List: $descr1: expr, NameValueStr: $descr2: expr) => {
179$crate::template!(@ true, Some($descr1), &[], Some(&[$descr2]), None)
180 };
181 (Word, List: $descr1: expr, NameValueStr: $descr2: expr, $link: literal) => {
182$crate::template!(@ true, Some($descr1), &[], Some(&[$descr2]), Some($link))
183 };
184 (@ $word: expr, $list: expr, $one_of: expr, $name_value_str: expr, $link: expr) => { $crate::AttributeTemplate {
185 word: $word, list: $list, one_of: $one_of, name_value_str: $name_value_str, docs: $link,
186 } };
187}
188189macro_rules!ungated {
190 ($attr:ident $(,)?) => {
191 BuiltinAttribute { name: sym::$attr, gate: Ungated }
192 };
193}
194195macro_rules!gated {
196 ($attr:ident, $gate:ident, $message:expr $(,)?) => {
197 BuiltinAttribute {
198 name: sym::$attr,
199 gate: Gated {
200 feature: sym::$gate,
201 message: $message,
202 check: Features::$gate,
203 notes: &[],
204 },
205 }
206 };
207 ($attr:ident, $message:expr $(,)?) => {
208 BuiltinAttribute {
209 name: sym::$attr,
210 gate: Gated {
211 feature: sym::$attr,
212 message: $message,
213 check: Features::$attr,
214 notes: &[],
215 },
216 }
217 };
218}
219220macro_rules!rustc_attr {
221 (TEST, $attr:ident $(,)?) => {
222rustc_attr!(
223$attr,
224concat!(
225"the `#[",
226stringify!($attr),
227"]` attribute is used for rustc unit tests"
228),
229 )
230 };
231 ($attr:ident $(, $notes:expr)* $(,)?) => {
232 BuiltinAttribute {
233 name: sym::$attr,
234 gate: Gated {
235 feature: sym::rustc_attrs,
236 message: "use of an internal attribute",
237 check: Features::rustc_attrs,
238 notes: &[
239concat!("the `#[",
240stringify!($attr),
241"]` attribute is an internal implementation detail that will never be stable"),
242 $($notes),*
243 ]
244 },
245 }
246 };
247}
248249macro_rules!experimental {
250 ($attr:ident) => {
251concat!("the `#[", stringify!($attr), "]` attribute is an experimental feature")
252 };
253}
254255pub struct BuiltinAttribute {
256pub name: Symbol,
257pub gate: AttributeGate,
258}
259260/// Attributes that have a special meaning to rustc or rustdoc.
261#[rustfmt::skip]
262pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
263// ==========================================================================
264 // Stable attributes:
265 // ==========================================================================
266267 // Conditional compilation:
268BuiltinAttribute { name: sym::cfg, gate: Ungated }ungated!(cfg),
269BuiltinAttribute { name: sym::cfg_attr, gate: Ungated }ungated!(cfg_attr),
270271// Testing:
272BuiltinAttribute { name: sym::ignore, gate: Ungated }ungated!(ignore),
273BuiltinAttribute { name: sym::should_panic, gate: Ungated }ungated!(should_panic),
274275// Macros:
276BuiltinAttribute { name: sym::automatically_derived, gate: Ungated }ungated!(automatically_derived),
277BuiltinAttribute { name: sym::macro_use, gate: Ungated }ungated!(macro_use),
278BuiltinAttribute { name: sym::macro_escape, gate: Ungated }ungated!(macro_escape), // Deprecated synonym for `macro_use`.
279BuiltinAttribute { name: sym::macro_export, gate: Ungated }ungated!(macro_export),
280BuiltinAttribute { name: sym::proc_macro, gate: Ungated }ungated!(proc_macro),
281BuiltinAttribute { name: sym::proc_macro_derive, gate: Ungated }ungated!(proc_macro_derive),
282BuiltinAttribute { name: sym::proc_macro_attribute, gate: Ungated }ungated!(proc_macro_attribute),
283284// Lints:
285BuiltinAttribute { name: sym::warn, gate: Ungated }ungated!(warn),
286BuiltinAttribute { name: sym::allow, gate: Ungated }ungated!(allow),
287BuiltinAttribute { name: sym::expect, gate: Ungated }ungated!(expect),
288BuiltinAttribute { name: sym::forbid, gate: Ungated }ungated!(forbid),
289BuiltinAttribute { name: sym::deny, gate: Ungated }ungated!(deny),
290BuiltinAttribute { name: sym::must_use, gate: Ungated }ungated!(must_use),
291BuiltinAttribute {
name: sym::must_not_suspend,
gate: Gated {
feature: sym::must_not_suspend,
message: "the `#[must_not_suspend]` attribute is an experimental feature",
check: Features::must_not_suspend,
notes: &[],
},
}gated!(must_not_suspend, experimental!(must_not_suspend)),
292BuiltinAttribute { name: sym::deprecated, gate: Ungated }ungated!(deprecated),
293294// Crate properties:
295BuiltinAttribute { name: sym::crate_name, gate: Ungated }ungated!(crate_name),
296BuiltinAttribute { name: sym::crate_type, gate: Ungated }ungated!(crate_type),
297298// ABI, linking, symbols, and FFI
299BuiltinAttribute { name: sym::link, gate: Ungated }ungated!(link),
300BuiltinAttribute { name: sym::link_name, gate: Ungated }ungated!(link_name),
301BuiltinAttribute { name: sym::no_link, gate: Ungated }ungated!(no_link),
302BuiltinAttribute { name: sym::repr, gate: Ungated }ungated!(repr),
303// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
304BuiltinAttribute {
name: sym::rustc_align,
gate: Gated {
feature: sym::fn_align,
message: "the `#[rustc_align]` attribute is an experimental feature",
check: Features::fn_align,
notes: &[],
},
}gated!(rustc_align, fn_align, experimental!(rustc_align)),
305BuiltinAttribute {
name: sym::rustc_align_static,
gate: Gated {
feature: sym::static_align,
message: "the `#[rustc_align_static]` attribute is an experimental feature",
check: Features::static_align,
notes: &[],
},
}gated!(rustc_align_static, static_align, experimental!(rustc_align_static)),
306BuiltinAttribute { name: sym::export_name, gate: Ungated }ungated!(export_name),
307BuiltinAttribute { name: sym::link_section, gate: Ungated }ungated!(link_section),
308BuiltinAttribute { name: sym::no_mangle, gate: Ungated }ungated!(no_mangle),
309BuiltinAttribute { name: sym::used, gate: Ungated }ungated!(used),
310BuiltinAttribute { name: sym::link_ordinal, gate: Ungated }ungated!(link_ordinal),
311BuiltinAttribute { name: sym::naked, gate: Ungated }ungated!(naked),
312// See `TyAndLayout::pass_indirectly_in_non_rustic_abis` for details.
313BuiltinAttribute {
name: sym::rustc_pass_indirectly_in_non_rustic_abis,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_pass_indirectly_in_non_rustic_abis]` attribute is an internal implementation detail that will never be stable",
"types marked with `#[rustc_pass_indirectly_in_non_rustic_abis]` are always passed indirectly by non-Rustic ABIs"],
},
}rustc_attr!(rustc_pass_indirectly_in_non_rustic_abis, "types marked with `#[rustc_pass_indirectly_in_non_rustic_abis]` are always passed indirectly by non-Rustic ABIs"),
314315// Limits:
316BuiltinAttribute { name: sym::recursion_limit, gate: Ungated }ungated!(recursion_limit),
317BuiltinAttribute { name: sym::type_length_limit, gate: Ungated }ungated!(type_length_limit),
318BuiltinAttribute {
name: sym::move_size_limit,
gate: Gated {
feature: sym::large_assignments,
message: "the `#[move_size_limit]` attribute is an experimental feature",
check: Features::large_assignments,
notes: &[],
},
}gated!(move_size_limit, large_assignments, experimental!(move_size_limit)),
319320// Entry point:
321BuiltinAttribute { name: sym::no_main, gate: Ungated }ungated!(no_main),
322323// Modules, prelude, and resolution:
324BuiltinAttribute { name: sym::path, gate: Ungated }ungated!(path),
325BuiltinAttribute { name: sym::no_std, gate: Ungated }ungated!(no_std),
326BuiltinAttribute { name: sym::no_implicit_prelude, gate: Ungated }ungated!(no_implicit_prelude),
327BuiltinAttribute { name: sym::non_exhaustive, gate: Ungated }ungated!(non_exhaustive),
328329// Runtime
330BuiltinAttribute { name: sym::windows_subsystem, gate: Ungated }ungated!(windows_subsystem),
331BuiltinAttribute { name: sym::panic_handler, gate: Ungated }ungated!(panic_handler), // RFC 2070
332333 // Code generation:
334BuiltinAttribute { name: sym::inline, gate: Ungated }ungated!(inline),
335BuiltinAttribute { name: sym::cold, gate: Ungated }ungated!(cold),
336BuiltinAttribute { name: sym::no_builtins, gate: Ungated }ungated!(no_builtins),
337BuiltinAttribute { name: sym::target_feature, gate: Ungated }ungated!(target_feature),
338BuiltinAttribute { name: sym::track_caller, gate: Ungated }ungated!(track_caller),
339BuiltinAttribute { name: sym::instruction_set, gate: Ungated }ungated!(instruction_set),
340BuiltinAttribute {
name: sym::force_target_feature,
gate: Gated {
feature: sym::effective_target_features,
message: "the `#[force_target_feature]` attribute is an experimental feature",
check: Features::effective_target_features,
notes: &[],
},
}gated!(force_target_feature, effective_target_features, experimental!(force_target_feature)),
341BuiltinAttribute {
name: sym::sanitize,
gate: Gated {
feature: sym::sanitize,
message: "the `#[sanitize]` attribute is an experimental feature",
check: Features::sanitize,
notes: &[],
},
}gated!(sanitize, sanitize, experimental!(sanitize)),
342BuiltinAttribute {
name: sym::coverage,
gate: Gated {
feature: sym::coverage_attribute,
message: "the `#[coverage]` attribute is an experimental feature",
check: Features::coverage_attribute,
notes: &[],
},
}gated!(coverage, coverage_attribute, experimental!(coverage)),
343344BuiltinAttribute { name: sym::doc, gate: Ungated }ungated!(doc),
345346// Debugging
347BuiltinAttribute { name: sym::debugger_visualizer, gate: Ungated }ungated!(debugger_visualizer),
348BuiltinAttribute { name: sym::collapse_debuginfo, gate: Ungated }ungated!(collapse_debuginfo),
349350// ==========================================================================
351 // Unstable attributes:
352 // ==========================================================================
353354 // Linking:
355BuiltinAttribute {
name: sym::export_stable,
gate: Gated {
feature: sym::export_stable,
message: "the `#[export_stable]` attribute is an experimental feature",
check: Features::export_stable,
notes: &[],
},
}gated!(export_stable, experimental!(export_stable)),
356357// Testing:
358BuiltinAttribute {
name: sym::test_runner,
gate: Gated {
feature: sym::custom_test_frameworks,
message: "custom test frameworks are an unstable feature",
check: Features::custom_test_frameworks,
notes: &[],
},
}gated!(test_runner, custom_test_frameworks, "custom test frameworks are an unstable feature"),
359360BuiltinAttribute {
name: sym::reexport_test_harness_main,
gate: Gated {
feature: sym::custom_test_frameworks,
message: "custom test frameworks are an unstable feature",
check: Features::custom_test_frameworks,
notes: &[],
},
}gated!(reexport_test_harness_main, custom_test_frameworks, "custom test frameworks are an unstable feature"),
361362// RFC #1268
363BuiltinAttribute {
name: sym::marker,
gate: Gated {
feature: sym::marker_trait_attr,
message: "the `#[marker]` attribute is an experimental feature",
check: Features::marker_trait_attr,
notes: &[],
},
}gated!(marker, marker_trait_attr, experimental!(marker)),
364BuiltinAttribute {
name: sym::thread_local,
gate: Gated {
feature: sym::thread_local,
message: "`#[thread_local]` is an experimental feature, and does not currently handle destructors",
check: Features::thread_local,
notes: &[],
},
}gated!(thread_local, "`#[thread_local]` is an experimental feature, and does not currently handle destructors"),
365BuiltinAttribute {
name: sym::no_core,
gate: Gated {
feature: sym::no_core,
message: "the `#[no_core]` attribute is an experimental feature",
check: Features::no_core,
notes: &[],
},
}gated!(no_core, experimental!(no_core)),
366// RFC 2412
367BuiltinAttribute {
name: sym::optimize,
gate: Gated {
feature: sym::optimize_attribute,
message: "the `#[optimize]` attribute is an experimental feature",
check: Features::optimize_attribute,
notes: &[],
},
}gated!(optimize, optimize_attribute, experimental!(optimize)),
368369BuiltinAttribute {
name: sym::ffi_pure,
gate: Gated {
feature: sym::ffi_pure,
message: "the `#[ffi_pure]` attribute is an experimental feature",
check: Features::ffi_pure,
notes: &[],
},
}gated!(ffi_pure, experimental!(ffi_pure)),
370BuiltinAttribute {
name: sym::ffi_const,
gate: Gated {
feature: sym::ffi_const,
message: "the `#[ffi_const]` attribute is an experimental feature",
check: Features::ffi_const,
notes: &[],
},
}gated!(ffi_const, experimental!(ffi_const)),
371BuiltinAttribute {
name: sym::register_tool,
gate: Gated {
feature: sym::register_tool,
message: "the `#[register_tool]` attribute is an experimental feature",
check: Features::register_tool,
notes: &[],
},
}gated!(register_tool, experimental!(register_tool)),
372// `#[cfi_encoding = ""]`
373BuiltinAttribute {
name: sym::cfi_encoding,
gate: Gated {
feature: sym::cfi_encoding,
message: "the `#[cfi_encoding]` attribute is an experimental feature",
check: Features::cfi_encoding,
notes: &[],
},
}gated!(cfi_encoding, experimental!(cfi_encoding)),
374375// `#[coroutine]` attribute to be applied to closures to make them coroutines instead
376BuiltinAttribute {
name: sym::coroutine,
gate: Gated {
feature: sym::coroutines,
message: "the `#[coroutine]` attribute is an experimental feature",
check: Features::coroutines,
notes: &[],
},
}gated!(coroutine, coroutines, experimental!(coroutine)),
377378// RFC 3543
379 // `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]`
380BuiltinAttribute {
name: sym::patchable_function_entry,
gate: Gated {
feature: sym::patchable_function_entry,
message: "the `#[patchable_function_entry]` attribute is an experimental feature",
check: Features::patchable_function_entry,
notes: &[],
},
}gated!(patchable_function_entry, experimental!(patchable_function_entry)),
381382// The `#[loop_match]` and `#[const_continue]` attributes are part of the
383 // lang experiment for RFC 3720 tracked in:
384 //
385 // - https://github.com/rust-lang/rust/issues/132306
386BuiltinAttribute {
name: sym::const_continue,
gate: Gated {
feature: sym::loop_match,
message: "the `#[const_continue]` attribute is an experimental feature",
check: Features::loop_match,
notes: &[],
},
}gated!(const_continue, loop_match, experimental!(const_continue)),
387BuiltinAttribute {
name: sym::loop_match,
gate: Gated {
feature: sym::loop_match,
message: "the `#[loop_match]` attribute is an experimental feature",
check: Features::loop_match,
notes: &[],
},
}gated!(loop_match, loop_match, experimental!(loop_match)),
388389// The `#[pin_v2]` attribute is part of the `pin_ergonomics` experiment
390 // that allows structurally pinning, tracked in:
391 //
392 // - https://github.com/rust-lang/rust/issues/130494
393BuiltinAttribute {
name: sym::pin_v2,
gate: Gated {
feature: sym::pin_ergonomics,
message: "the `#[pin_v2]` attribute is an experimental feature",
check: Features::pin_ergonomics,
notes: &[],
},
}gated!(pin_v2, pin_ergonomics, experimental!(pin_v2)),
394395// ==========================================================================
396 // Internal attributes: Stability, deprecation, and unsafe:
397 // ==========================================================================
398399BuiltinAttribute { name: sym::feature, gate: Ungated }ungated!(feature),
400// DuplicatesOk since it has its own validation
401BuiltinAttribute { name: sym::stable, gate: Ungated }ungated!(stable),
402BuiltinAttribute { name: sym::unstable, gate: Ungated }ungated!(unstable),
403BuiltinAttribute { name: sym::unstable_feature_bound, gate: Ungated }ungated!(unstable_feature_bound),
404BuiltinAttribute { name: sym::unstable_removed, gate: Ungated }ungated!(unstable_removed),
405BuiltinAttribute { name: sym::rustc_const_unstable, gate: Ungated }ungated!(rustc_const_unstable),
406BuiltinAttribute { name: sym::rustc_const_stable, gate: Ungated }ungated!(rustc_const_stable),
407BuiltinAttribute { name: sym::rustc_default_body_unstable, gate: Ungated }ungated!(rustc_default_body_unstable),
408BuiltinAttribute {
name: sym::allow_internal_unstable,
gate: Gated {
feature: sym::allow_internal_unstable,
message: "allow_internal_unstable side-steps feature gating and stability checks",
check: Features::allow_internal_unstable,
notes: &[],
},
}gated!(
409 allow_internal_unstable,
410"allow_internal_unstable side-steps feature gating and stability checks",
411 ),
412BuiltinAttribute {
name: sym::allow_internal_unsafe,
gate: Gated {
feature: sym::allow_internal_unsafe,
message: "allow_internal_unsafe side-steps the unsafe_code lint",
check: Features::allow_internal_unsafe,
notes: &[],
},
}gated!(
413 allow_internal_unsafe,
414"allow_internal_unsafe side-steps the unsafe_code lint",
415 ),
416BuiltinAttribute {
name: sym::rustc_eii_foreign_item,
gate: Gated {
feature: sym::eii_internals,
message: "used internally to mark types with a `transparent` representation when it is guaranteed by the documentation",
check: Features::eii_internals,
notes: &[],
},
}gated!(
417 rustc_eii_foreign_item,
418 eii_internals,
419"used internally to mark types with a `transparent` representation when it is guaranteed by the documentation",
420 ),
421BuiltinAttribute {
name: sym::rustc_allowed_through_unstable_modules,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_allowed_through_unstable_modules]` attribute is an internal implementation detail that will never be stable",
"rustc_allowed_through_unstable_modules special cases accidental stabilizations of stable items \
through unstable paths"],
},
}rustc_attr!(
422 rustc_allowed_through_unstable_modules,
423"rustc_allowed_through_unstable_modules special cases accidental stabilizations of stable items \
424 through unstable paths"
425),
426BuiltinAttribute {
name: sym::rustc_deprecated_safe_2024,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_deprecated_safe_2024]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_deprecated_safe_2024]` is used to declare functions unsafe across the edition 2024 boundary"],
},
}rustc_attr!(
427 rustc_deprecated_safe_2024,
428"`#[rustc_deprecated_safe_2024]` is used to declare functions unsafe across the edition 2024 boundary",
429 ),
430BuiltinAttribute {
name: sym::rustc_pub_transparent,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_pub_transparent]` attribute is an internal implementation detail that will never be stable",
"used internally to mark types with a `transparent` representation when it is guaranteed by the documentation"],
},
}rustc_attr!(
431 rustc_pub_transparent,
432"used internally to mark types with a `transparent` representation when it is guaranteed by the documentation",
433 ),
434435436// ==========================================================================
437 // Internal attributes: Type system related:
438 // ==========================================================================
439440BuiltinAttribute {
name: sym::fundamental,
gate: Gated {
feature: sym::fundamental,
message: "the `#[fundamental]` attribute is an experimental feature",
check: Features::fundamental,
notes: &[],
},
}gated!(fundamental, experimental!(fundamental)),
441BuiltinAttribute {
name: sym::may_dangle,
gate: Gated {
feature: sym::dropck_eyepatch,
message: "`may_dangle` has unstable semantics and may be removed in the future",
check: Features::dropck_eyepatch,
notes: &[],
},
}gated!(
442 may_dangle,
443 dropck_eyepatch,
444"`may_dangle` has unstable semantics and may be removed in the future",
445 ),
446447BuiltinAttribute {
name: sym::rustc_never_type_options,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_never_type_options]` attribute is an internal implementation detail that will never be stable",
"`rustc_never_type_options` is used to experiment with never type fallback and work on \
never type stabilization"],
},
}rustc_attr!(
448 rustc_never_type_options,
449"`rustc_never_type_options` is used to experiment with never type fallback and work on \
450 never type stabilization"
451),
452453// ==========================================================================
454 // Internal attributes: Runtime related:
455 // ==========================================================================
456457BuiltinAttribute {
name: sym::rustc_allocator,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_allocator]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_allocator),
458BuiltinAttribute {
name: sym::rustc_nounwind,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_nounwind]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_nounwind),
459BuiltinAttribute {
name: sym::rustc_reallocator,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_reallocator]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_reallocator),
460BuiltinAttribute {
name: sym::rustc_deallocator,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_deallocator]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_deallocator),
461BuiltinAttribute {
name: sym::rustc_allocator_zeroed,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_allocator_zeroed]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_allocator_zeroed),
462BuiltinAttribute {
name: sym::rustc_allocator_zeroed_variant,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_allocator_zeroed_variant]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_allocator_zeroed_variant),
463BuiltinAttribute {
name: sym::default_lib_allocator,
gate: Gated {
feature: sym::allocator_internals,
message: "the `#[default_lib_allocator]` attribute is an experimental feature",
check: Features::allocator_internals,
notes: &[],
},
}gated!(
464 default_lib_allocator,
465 allocator_internals, experimental!(default_lib_allocator),
466 ),
467BuiltinAttribute {
name: sym::needs_allocator,
gate: Gated {
feature: sym::allocator_internals,
message: "the `#[needs_allocator]` attribute is an experimental feature",
check: Features::allocator_internals,
notes: &[],
},
}gated!(
468 needs_allocator,
469 allocator_internals, experimental!(needs_allocator),
470 ),
471BuiltinAttribute {
name: sym::panic_runtime,
gate: Gated {
feature: sym::panic_runtime,
message: "the `#[panic_runtime]` attribute is an experimental feature",
check: Features::panic_runtime,
notes: &[],
},
}gated!(
472 panic_runtime,
473experimental!(panic_runtime)
474 ),
475BuiltinAttribute {
name: sym::needs_panic_runtime,
gate: Gated {
feature: sym::needs_panic_runtime,
message: "the `#[needs_panic_runtime]` attribute is an experimental feature",
check: Features::needs_panic_runtime,
notes: &[],
},
}gated!(
476 needs_panic_runtime,
477experimental!(needs_panic_runtime)
478 ),
479BuiltinAttribute {
name: sym::compiler_builtins,
gate: Gated {
feature: sym::compiler_builtins,
message: "the `#[compiler_builtins]` attribute is used to identify the `compiler_builtins` crate \
which contains compiler-rt intrinsics and will never be stable",
check: Features::compiler_builtins,
notes: &[],
},
}gated!(
480 compiler_builtins,
481"the `#[compiler_builtins]` attribute is used to identify the `compiler_builtins` crate \
482 which contains compiler-rt intrinsics and will never be stable",
483 ),
484BuiltinAttribute {
name: sym::profiler_runtime,
gate: Gated {
feature: sym::profiler_runtime,
message: "the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate \
which contains the profiler runtime and will never be stable",
check: Features::profiler_runtime,
notes: &[],
},
}gated!(
485 profiler_runtime,
486"the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate \
487 which contains the profiler runtime and will never be stable",
488 ),
489490// ==========================================================================
491 // Internal attributes, Linkage:
492 // ==========================================================================
493494BuiltinAttribute {
name: sym::linkage,
gate: Gated {
feature: sym::linkage,
message: "the `linkage` attribute is experimental and not portable across platforms",
check: Features::linkage,
notes: &[],
},
}gated!(
495 linkage,
496"the `linkage` attribute is experimental and not portable across platforms",
497 ),
498BuiltinAttribute {
name: sym::rustc_std_internal_symbol,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_std_internal_symbol]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_std_internal_symbol),
499BuiltinAttribute {
name: sym::rustc_objc_class,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_objc_class]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_objc_class),
500BuiltinAttribute {
name: sym::rustc_objc_selector,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_objc_selector]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_objc_selector),
501502// ==========================================================================
503 // Internal attributes, Macro related:
504 // ==========================================================================
505506BuiltinAttribute {
name: sym::rustc_builtin_macro,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_builtin_macro]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_builtin_macro),
507BuiltinAttribute {
name: sym::rustc_proc_macro_decls,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_proc_macro_decls]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_proc_macro_decls),
508BuiltinAttribute {
name: sym::rustc_macro_transparency,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_macro_transparency]` attribute is an internal implementation detail that will never be stable",
"used internally for testing macro hygiene"],
},
}rustc_attr!(
509 rustc_macro_transparency,
510"used internally for testing macro hygiene",
511 ),
512BuiltinAttribute {
name: sym::rustc_autodiff,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_autodiff]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_autodiff),
513BuiltinAttribute {
name: sym::rustc_offload_kernel,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_offload_kernel]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_offload_kernel),
514// Traces that are left when `cfg` and `cfg_attr` attributes are expanded.
515 // The attributes are not gated, to avoid stability errors, but they cannot be used in stable
516 // or unstable code directly because `sym::cfg_(attr_)trace` are not valid identifiers, they
517 // can only be generated by the compiler.
518BuiltinAttribute { name: sym::cfg_trace, gate: Ungated }ungated!(cfg_trace),
519BuiltinAttribute { name: sym::cfg_attr_trace, gate: Ungated }ungated!(cfg_attr_trace),
520521// ==========================================================================
522 // Internal attributes, Diagnostics related:
523 // ==========================================================================
524525BuiltinAttribute {
name: sym::rustc_on_unimplemented,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_on_unimplemented]` attribute is an internal implementation detail that will never be stable",
"see `#[diagnostic::on_unimplemented]` for the stable equivalent of this attribute"],
},
}rustc_attr!(
526 rustc_on_unimplemented,
527"see `#[diagnostic::on_unimplemented]` for the stable equivalent of this attribute"
528),
529BuiltinAttribute {
name: sym::rustc_confusables,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_confusables]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_confusables),
530// Enumerates "identity-like" conversion methods to suggest on type mismatch.
531BuiltinAttribute {
name: sym::rustc_conversion_suggestion,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_conversion_suggestion]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_conversion_suggestion),
532// Prevents field reads in the marked trait or method to be considered
533 // during dead code analysis.
534BuiltinAttribute {
name: sym::rustc_trivial_field_reads,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_trivial_field_reads]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_trivial_field_reads),
535// Used by the `rustc::potential_query_instability` lint to warn methods which
536 // might not be stable during incremental compilation.
537BuiltinAttribute {
name: sym::rustc_lint_query_instability,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_lint_query_instability]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_lint_query_instability),
538// Used by the `rustc::untracked_query_information` lint to warn methods which
539 // might not be stable during incremental compilation.
540BuiltinAttribute {
name: sym::rustc_lint_untracked_query_information,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_lint_untracked_query_information]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_lint_untracked_query_information),
541// Used by the `rustc::bad_opt_access` lint to identify `DebuggingOptions` and `CodegenOptions`
542 // types (as well as any others in future).
543BuiltinAttribute {
name: sym::rustc_lint_opt_ty,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_lint_opt_ty]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_lint_opt_ty),
544// Used by the `rustc::bad_opt_access` lint on fields
545 // types (as well as any others in future).
546BuiltinAttribute {
name: sym::rustc_lint_opt_deny_field_access,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_lint_opt_deny_field_access]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_lint_opt_deny_field_access),
547548// ==========================================================================
549 // Internal attributes, Const related:
550 // ==========================================================================
551552BuiltinAttribute {
name: sym::rustc_promotable,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_promotable]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_promotable),
553BuiltinAttribute {
name: sym::rustc_legacy_const_generics,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_legacy_const_generics]` attribute is an internal implementation detail that will never be stable"],
},
}rustc_attr!(rustc_legacy_const_generics),
554// Do not const-check this function's body. It will always get replaced during CTFE via `hook_special_const_fn`.
555BuiltinAttribute {
name: sym::rustc_do_not_const_check,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_do_not_const_check]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_do_not_const_check]` skips const-check for this function's body"],
},
}rustc_attr!(
556 rustc_do_not_const_check,
557"`#[rustc_do_not_const_check]` skips const-check for this function's body",
558 ),
559BuiltinAttribute {
name: sym::rustc_const_stable_indirect,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_const_stable_indirect]` attribute is an internal implementation detail that will never be stable",
"this is an internal implementation detail"],
},
}rustc_attr!(
560 rustc_const_stable_indirect,
561"this is an internal implementation detail",
562 ),
563BuiltinAttribute {
name: sym::rustc_intrinsic_const_stable_indirect,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_intrinsic_const_stable_indirect]` attribute is an internal implementation detail that will never be stable",
"this is an internal implementation detail"],
},
}rustc_attr!(
564 rustc_intrinsic_const_stable_indirect,
565"this is an internal implementation detail",
566 ),
567BuiltinAttribute {
name: sym::rustc_allow_const_fn_unstable,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_allow_const_fn_unstable]` attribute is an internal implementation detail that will never be stable",
"rustc_allow_const_fn_unstable side-steps feature gating and stability checks"],
},
}rustc_attr!(
568 rustc_allow_const_fn_unstable,
569"rustc_allow_const_fn_unstable side-steps feature gating and stability checks"
570),
571572// ==========================================================================
573 // Internal attributes, Layout related:
574 // ==========================================================================
575576BuiltinAttribute {
name: sym::rustc_layout_scalar_valid_range_start,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_layout_scalar_valid_range_start]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_layout_scalar_valid_range_start]` attribute is just used to enable \
niche optimizations in the standard library"],
},
}rustc_attr!(
577 rustc_layout_scalar_valid_range_start,
578"the `#[rustc_layout_scalar_valid_range_start]` attribute is just used to enable \
579 niche optimizations in the standard library",
580 ),
581BuiltinAttribute {
name: sym::rustc_layout_scalar_valid_range_end,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_layout_scalar_valid_range_end]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_layout_scalar_valid_range_end]` attribute is just used to enable \
niche optimizations in the standard library"],
},
}rustc_attr!(
582 rustc_layout_scalar_valid_range_end,
583"the `#[rustc_layout_scalar_valid_range_end]` attribute is just used to enable \
584 niche optimizations in the standard library",
585 ),
586BuiltinAttribute {
name: sym::rustc_simd_monomorphize_lane_limit,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_simd_monomorphize_lane_limit]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_simd_monomorphize_lane_limit]` attribute is just used by std::simd \
for better error messages"],
},
}rustc_attr!(
587 rustc_simd_monomorphize_lane_limit,
588"the `#[rustc_simd_monomorphize_lane_limit]` attribute is just used by std::simd \
589 for better error messages",
590 ),
591BuiltinAttribute {
name: sym::rustc_nonnull_optimization_guaranteed,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_nonnull_optimization_guaranteed]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_nonnull_optimization_guaranteed]` attribute is just used to document \
guaranteed niche optimizations in the standard library",
"the compiler does not even check whether the type indeed is being non-null-optimized; \
it is your responsibility to ensure that the attribute is only used on types that are optimized"],
},
}rustc_attr!(
592 rustc_nonnull_optimization_guaranteed,
593"the `#[rustc_nonnull_optimization_guaranteed]` attribute is just used to document \
594 guaranteed niche optimizations in the standard library",
595"the compiler does not even check whether the type indeed is being non-null-optimized; \
596 it is your responsibility to ensure that the attribute is only used on types that are optimized",
597 ),
598599// ==========================================================================
600 // Internal attributes, Misc:
601 // ==========================================================================
602BuiltinAttribute {
name: sym::lang,
gate: Gated {
feature: sym::lang_items,
message: "lang items are subject to change",
check: Features::lang_items,
notes: &[],
},
}gated!(
603 lang, lang_items,
604"lang items are subject to change",
605 ),
606BuiltinAttribute {
name: sym::rustc_as_ptr,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_as_ptr]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_as_ptr]` is used to mark functions returning pointers to their inner allocations"],
},
}rustc_attr!(
607 rustc_as_ptr,
608"`#[rustc_as_ptr]` is used to mark functions returning pointers to their inner allocations"
609),
610BuiltinAttribute {
name: sym::rustc_should_not_be_called_on_const_items,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_should_not_be_called_on_const_items]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_should_not_be_called_on_const_items]` is used to mark methods that don't make sense to be called on interior mutable consts"],
},
}rustc_attr!(
611 rustc_should_not_be_called_on_const_items,
612"`#[rustc_should_not_be_called_on_const_items]` is used to mark methods that don't make sense to be called on interior mutable consts"
613),
614BuiltinAttribute {
name: sym::rustc_pass_by_value,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_pass_by_value]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_pass_by_value]` is used to mark types that must be passed by value instead of reference"],
},
}rustc_attr!(
615 rustc_pass_by_value,
616"`#[rustc_pass_by_value]` is used to mark types that must be passed by value instead of reference"
617),
618BuiltinAttribute {
name: sym::rustc_never_returns_null_ptr,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_never_returns_null_ptr]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_never_returns_null_ptr]` is used to mark functions returning non-null pointers"],
},
}rustc_attr!(
619 rustc_never_returns_null_ptr,
620"`#[rustc_never_returns_null_ptr]` is used to mark functions returning non-null pointers"
621),
622BuiltinAttribute {
name: sym::rustc_no_implicit_autorefs,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_no_implicit_autorefs]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_no_implicit_autorefs]` is used to mark functions for which an autoref to the dereference of a raw pointer should not be used as an argument"],
},
}rustc_attr!(
623 rustc_no_implicit_autorefs,
624"`#[rustc_no_implicit_autorefs]` is used to mark functions for which an autoref to the dereference of a raw pointer should not be used as an argument"
625),
626BuiltinAttribute {
name: sym::rustc_coherence_is_core,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_coherence_is_core]` attribute is an internal implementation detail that will never be stable",
"`#![rustc_coherence_is_core]` allows inherent methods on builtin types, only intended to be used in `core`"],
},
}rustc_attr!(
627 rustc_coherence_is_core,
628"`#![rustc_coherence_is_core]` allows inherent methods on builtin types, only intended to be used in `core`"
629),
630BuiltinAttribute {
name: sym::rustc_coinductive,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_coinductive]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_coinductive]` changes a trait to be coinductive, allowing cycles in the trait solver"],
},
}rustc_attr!(
631 rustc_coinductive,
632"`#[rustc_coinductive]` changes a trait to be coinductive, allowing cycles in the trait solver"
633),
634BuiltinAttribute {
name: sym::rustc_allow_incoherent_impl,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_allow_incoherent_impl]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_allow_incoherent_impl]` has to be added to all impl items of an incoherent inherent impl"],
},
}rustc_attr!(
635 rustc_allow_incoherent_impl,
636"`#[rustc_allow_incoherent_impl]` has to be added to all impl items of an incoherent inherent impl"
637),
638BuiltinAttribute {
name: sym::rustc_preserve_ub_checks,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_preserve_ub_checks]` attribute is an internal implementation detail that will never be stable",
"`#![rustc_preserve_ub_checks]` prevents the designated crate from evaluating whether UB checks are enabled when optimizing MIR"],
},
}rustc_attr!(
639 rustc_preserve_ub_checks,
640"`#![rustc_preserve_ub_checks]` prevents the designated crate from evaluating whether UB checks are enabled when optimizing MIR",
641 ),
642BuiltinAttribute {
name: sym::rustc_deny_explicit_impl,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_deny_explicit_impl]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_deny_explicit_impl]` enforces that a trait can have no user-provided impls"],
},
}rustc_attr!(
643 rustc_deny_explicit_impl,
644"`#[rustc_deny_explicit_impl]` enforces that a trait can have no user-provided impls"
645),
646BuiltinAttribute {
name: sym::rustc_dyn_incompatible_trait,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_dyn_incompatible_trait]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_dyn_incompatible_trait]` marks a trait as dyn-incompatible, \
even if it otherwise satisfies the requirements to be dyn-compatible."],
},
}rustc_attr!(
647 rustc_dyn_incompatible_trait,
648"`#[rustc_dyn_incompatible_trait]` marks a trait as dyn-incompatible, \
649 even if it otherwise satisfies the requirements to be dyn-compatible."
650),
651BuiltinAttribute {
name: sym::rustc_has_incoherent_inherent_impls,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_has_incoherent_inherent_impls]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_has_incoherent_inherent_impls]` allows the addition of incoherent inherent impls for \
the given type by annotating all impl items with `#[rustc_allow_incoherent_impl]`"],
},
}rustc_attr!(
652 rustc_has_incoherent_inherent_impls,
653"`#[rustc_has_incoherent_inherent_impls]` allows the addition of incoherent inherent impls for \
654 the given type by annotating all impl items with `#[rustc_allow_incoherent_impl]`"
655),
656BuiltinAttribute {
name: sym::rustc_non_const_trait_method,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_non_const_trait_method]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_non_const_trait_method]` should only used by the standard library to mark trait methods \
as non-const to allow large traits an easier transition to const"],
},
}rustc_attr!(
657 rustc_non_const_trait_method,
658"`#[rustc_non_const_trait_method]` should only used by the standard library to mark trait methods \
659 as non-const to allow large traits an easier transition to const"
660),
661662BuiltinAttribute {
663 name: sym::rustc_diagnostic_item,
664 gate: Gated {
665 feature: sym::rustc_attrs,
666 message: "use of an internal attribute",
667 check: Features::rustc_attrs,
668 notes: &["the `#[rustc_diagnostic_item]` attribute allows the compiler to reference types \
669 from the standard library for diagnostic purposes"],
670 },
671 },
672BuiltinAttribute {
name: sym::prelude_import,
gate: Gated {
feature: sym::prelude_import,
message: "`#[prelude_import]` is for use by rustc only",
check: Features::prelude_import,
notes: &[],
},
}gated!(
673// Used in resolve:
674prelude_import,
675"`#[prelude_import]` is for use by rustc only",
676 ),
677BuiltinAttribute {
name: sym::rustc_paren_sugar,
gate: Gated {
feature: sym::unboxed_closures,
message: "unboxed_closures are still evolving",
check: Features::unboxed_closures,
notes: &[],
},
}gated!(
678 rustc_paren_sugar,
679 unboxed_closures, "unboxed_closures are still evolving",
680 ),
681BuiltinAttribute {
name: sym::rustc_inherit_overflow_checks,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_inherit_overflow_checks]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_inherit_overflow_checks]` attribute is just used to control \
overflow checking behavior of several functions in the standard library that are inlined \
across crates"],
},
}rustc_attr!(
682 rustc_inherit_overflow_checks,
683"the `#[rustc_inherit_overflow_checks]` attribute is just used to control \
684 overflow checking behavior of several functions in the standard library that are inlined \
685 across crates",
686 ),
687BuiltinAttribute {
name: sym::rustc_reservation_impl,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_reservation_impl]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_reservation_impl]` attribute is internally used \
for reserving `impl<T> From<!> for T` as part of the effort to stabilize `!`"],
},
}rustc_attr!(
688 rustc_reservation_impl,
689"the `#[rustc_reservation_impl]` attribute is internally used \
690 for reserving `impl<T> From<!> for T` as part of the effort to stabilize `!`"
691),
692BuiltinAttribute {
name: sym::rustc_test_marker,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_test_marker]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_test_marker]` attribute is used internally to track tests"],
},
}rustc_attr!(
693 rustc_test_marker,
694"the `#[rustc_test_marker]` attribute is used internally to track tests",
695 ),
696BuiltinAttribute {
name: sym::rustc_unsafe_specialization_marker,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_unsafe_specialization_marker]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_unsafe_specialization_marker]` attribute is used to check specializations"],
},
}rustc_attr!(
697 rustc_unsafe_specialization_marker,
698"the `#[rustc_unsafe_specialization_marker]` attribute is used to check specializations"
699),
700BuiltinAttribute {
name: sym::rustc_specialization_trait,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_specialization_trait]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_specialization_trait]` attribute is used to check specializations"],
},
}rustc_attr!(
701 rustc_specialization_trait,
702"the `#[rustc_specialization_trait]` attribute is used to check specializations"
703),
704BuiltinAttribute {
name: sym::rustc_main,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_main]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_main]` attribute is used internally to specify test entry point function"],
},
}rustc_attr!(
705 rustc_main,
706"the `#[rustc_main]` attribute is used internally to specify test entry point function",
707 ),
708BuiltinAttribute {
name: sym::rustc_skip_during_method_dispatch,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_skip_during_method_dispatch]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_skip_during_method_dispatch]` attribute is used to exclude a trait \
from method dispatch when the receiver is of the following type, for compatibility in \
editions < 2021 (array) or editions < 2024 (boxed_slice)"],
},
}rustc_attr!(
709 rustc_skip_during_method_dispatch,
710"the `#[rustc_skip_during_method_dispatch]` attribute is used to exclude a trait \
711 from method dispatch when the receiver is of the following type, for compatibility in \
712 editions < 2021 (array) or editions < 2024 (boxed_slice)"
713),
714BuiltinAttribute {
name: sym::rustc_must_implement_one_of,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_must_implement_one_of]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_must_implement_one_of]` attribute is used to change minimal complete \
definition of a trait. Its syntax and semantics are highly experimental and will be \
subject to change before stabilization"],
},
}rustc_attr!(
715 rustc_must_implement_one_of,
716"the `#[rustc_must_implement_one_of]` attribute is used to change minimal complete \
717 definition of a trait. Its syntax and semantics are highly experimental and will be \
718 subject to change before stabilization",
719 ),
720BuiltinAttribute {
name: sym::rustc_doc_primitive,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_doc_primitive]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_doc_primitive]` attribute is used by the standard library \
to provide a way to generate documentation for primitive types"],
},
}rustc_attr!(
721 rustc_doc_primitive,
722"the `#[rustc_doc_primitive]` attribute is used by the standard library \
723 to provide a way to generate documentation for primitive types",
724 ),
725BuiltinAttribute {
name: sym::rustc_intrinsic,
gate: Gated {
feature: sym::intrinsics,
message: "the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items",
check: Features::intrinsics,
notes: &[],
},
}gated!(
726 rustc_intrinsic, intrinsics,
727"the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items",
728 ),
729BuiltinAttribute {
name: sym::rustc_no_mir_inline,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_no_mir_inline]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_no_mir_inline]` prevents the MIR inliner from inlining a function while not affecting codegen"],
},
}rustc_attr!(
730 rustc_no_mir_inline,
731"`#[rustc_no_mir_inline]` prevents the MIR inliner from inlining a function while not affecting codegen"
732),
733BuiltinAttribute {
name: sym::rustc_force_inline,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_force_inline]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_force_inline]` forces a free function to be inlined"],
},
}rustc_attr!(
734 rustc_force_inline,
735"`#[rustc_force_inline]` forces a free function to be inlined"
736),
737BuiltinAttribute {
name: sym::rustc_scalable_vector,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_scalable_vector]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_scalable_vector]` defines a scalable vector type"],
},
}rustc_attr!(
738 rustc_scalable_vector,
739"`#[rustc_scalable_vector]` defines a scalable vector type"
740),
741BuiltinAttribute {
name: sym::rustc_must_match_exhaustively,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_must_match_exhaustively]` attribute is an internal implementation detail that will never be stable",
"enums with `#[rustc_must_match_exhaustively]` must be matched on with a match block that mentions all variants explicitly"],
},
}rustc_attr!(
742 rustc_must_match_exhaustively,
743"enums with `#[rustc_must_match_exhaustively]` must be matched on with a match block that mentions all variants explicitly"
744),
745BuiltinAttribute {
name: sym::rustc_no_writable,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_no_writable]` attribute is an internal implementation detail that will never be stable",
"`#[rustc_no_writable]` stops the compiler from considering mutable reference arguments of this function as implicitly writable"],
},
}rustc_attr!(
746 rustc_no_writable,
747"`#[rustc_no_writable]` stops the compiler from considering mutable reference arguments of this function as implicitly writable"
748),
749750// ==========================================================================
751 // Internal attributes, Testing:
752 // ==========================================================================
753754BuiltinAttribute {
name: sym::rustc_effective_visibility,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_effective_visibility]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_effective_visibility]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_effective_visibility),
755BuiltinAttribute {
name: sym::rustc_dump_inferred_outlives,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_dump_inferred_outlives]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_dump_inferred_outlives]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_dump_inferred_outlives),
756BuiltinAttribute {
name: sym::rustc_capture_analysis,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_capture_analysis]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_capture_analysis]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_capture_analysis,),
757BuiltinAttribute {
name: sym::rustc_insignificant_dtor,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_insignificant_dtor]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_insignificant_dtor]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_insignificant_dtor),
758BuiltinAttribute {
name: sym::rustc_no_implicit_bounds,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_no_implicit_bounds]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_no_implicit_bounds]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_no_implicit_bounds),
759BuiltinAttribute {
name: sym::rustc_strict_coherence,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_strict_coherence]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_strict_coherence]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_strict_coherence),
760BuiltinAttribute {
name: sym::rustc_dump_variances,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_dump_variances]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_dump_variances]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_dump_variances),
761BuiltinAttribute {
name: sym::rustc_dump_variances_of_opaques,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_dump_variances_of_opaques]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_dump_variances_of_opaques]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_dump_variances_of_opaques),
762BuiltinAttribute {
name: sym::rustc_dump_hidden_type_of_opaques,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_dump_hidden_type_of_opaques]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_dump_hidden_type_of_opaques]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_dump_hidden_type_of_opaques),
763BuiltinAttribute {
name: sym::rustc_dump_layout,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_dump_layout]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_dump_layout]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_dump_layout),
764BuiltinAttribute {
name: sym::rustc_abi,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_abi]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_abi]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_abi),
765BuiltinAttribute {
name: sym::rustc_regions,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_regions]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_regions]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_regions),
766BuiltinAttribute {
name: sym::rustc_delayed_bug_from_inside_query,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_delayed_bug_from_inside_query]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_delayed_bug_from_inside_query]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_delayed_bug_from_inside_query),
767BuiltinAttribute {
name: sym::rustc_dump_user_args,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_dump_user_args]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_dump_user_args]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_dump_user_args),
768BuiltinAttribute {
name: sym::rustc_evaluate_where_clauses,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_evaluate_where_clauses]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_evaluate_where_clauses]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_evaluate_where_clauses),
769BuiltinAttribute {
name: sym::rustc_if_this_changed,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_if_this_changed]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_if_this_changed]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_if_this_changed),
770BuiltinAttribute {
name: sym::rustc_then_this_would_need,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_then_this_would_need]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_then_this_would_need]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_then_this_would_need),
771BuiltinAttribute {
name: sym::rustc_clean,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_clean]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_clean]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_clean),
772BuiltinAttribute {
name: sym::rustc_partition_reused,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_partition_reused]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_partition_reused]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_partition_reused),
773BuiltinAttribute {
name: sym::rustc_partition_codegened,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_partition_codegened]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_partition_codegened]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_partition_codegened),
774BuiltinAttribute {
name: sym::rustc_expected_cgu_reuse,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_expected_cgu_reuse]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_expected_cgu_reuse]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_expected_cgu_reuse),
775BuiltinAttribute {
name: sym::rustc_dump_symbol_name,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_dump_symbol_name]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_dump_symbol_name]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_dump_symbol_name),
776BuiltinAttribute {
name: sym::rustc_dump_def_path,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_dump_def_path]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_dump_def_path]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_dump_def_path),
777BuiltinAttribute {
name: sym::rustc_mir,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_mir]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_mir]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_mir),
778BuiltinAttribute {
name: sym::custom_mir,
gate: Gated {
feature: sym::custom_mir,
message: "the `#[custom_mir]` attribute is just used for the Rust test suite",
check: Features::custom_mir,
notes: &[],
},
}gated!(
779 custom_mir, "the `#[custom_mir]` attribute is just used for the Rust test suite",
780 ),
781BuiltinAttribute {
name: sym::rustc_dump_item_bounds,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_dump_item_bounds]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_dump_item_bounds]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_dump_item_bounds),
782BuiltinAttribute {
name: sym::rustc_dump_predicates,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_dump_predicates]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_dump_predicates]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_dump_predicates),
783BuiltinAttribute {
name: sym::rustc_dump_def_parents,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_dump_def_parents]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_dump_def_parents]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_dump_def_parents),
784BuiltinAttribute {
name: sym::rustc_dump_object_lifetime_defaults,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_dump_object_lifetime_defaults]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_dump_object_lifetime_defaults]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_dump_object_lifetime_defaults),
785BuiltinAttribute {
name: sym::rustc_dump_vtable,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_dump_vtable]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_dump_vtable]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_dump_vtable),
786BuiltinAttribute {
name: sym::rustc_dummy,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[rustc_dummy]` attribute is an internal implementation detail that will never be stable",
"the `#[rustc_dummy]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, rustc_dummy),
787BuiltinAttribute {
name: sym::pattern_complexity_limit,
gate: Gated {
feature: sym::rustc_attrs,
message: "use of an internal attribute",
check: Features::rustc_attrs,
notes: &["the `#[pattern_complexity_limit]` attribute is an internal implementation detail that will never be stable",
"the `#[pattern_complexity_limit]` attribute is used for rustc unit tests"],
},
}rustc_attr!(TEST, pattern_complexity_limit),
788];
789790pub fn is_builtin_attr_name(name: Symbol) -> bool {
791BUILTIN_ATTRIBUTE_MAP.get(&name).is_some()
792}
793794pub static BUILTIN_ATTRIBUTE_MAP: LazyLock<FxHashMap<Symbol, &BuiltinAttribute>> =
795LazyLock::new(|| {
796let mut map = FxHashMap::default();
797for attr in BUILTIN_ATTRIBUTES.iter() {
798if map.insert(attr.name, attr).is_some() {
799{
::core::panicking::panic_fmt(format_args!("duplicate builtin attribute `{0}`",
attr.name));
};panic!("duplicate builtin attribute `{}`", attr.name);
800 }
801 }
802map803 });