1use std::str::FromStr;
2
3use rustc_abi::{Align, ExternAbi};
4use rustc_ast::expand::autodiff_attrs::{AutoDiffAttrs, DiffActivity, DiffMode};
5use rustc_ast::{LitKind, MetaItem, MetaItemInner, attr};
6use rustc_hir::attrs::{AttributeKind, InlineAttr, InstructionSetAttr, UsedBy};
7use rustc_hir::def::DefKind;
8use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId};
9use rustc_hir::weak_lang_items::WEAK_LANG_ITEMS;
10use rustc_hir::{self as hir, Attribute, LangItem, find_attr, lang_items};
11use rustc_middle::middle::codegen_fn_attrs::{
12 CodegenFnAttrFlags, CodegenFnAttrs, PatchableFunctionEntry,
13};
14use rustc_middle::query::Providers;
15use rustc_middle::span_bug;
16use rustc_middle::ty::{self as ty, TyCtxt};
17use rustc_session::lint;
18use rustc_session::parse::feature_err;
19use rustc_span::{Ident, Span, sym};
20use rustc_target::spec::SanitizerSet;
21
22use crate::errors;
23use crate::errors::NoMangleNameless;
24use crate::target_features::{
25 check_target_feature_trait_unsafe, check_tied_features, from_target_feature_attr,
26};
27
28fn try_fn_sig<'tcx>(
34 tcx: TyCtxt<'tcx>,
35 did: LocalDefId,
36 attr_span: Span,
37) -> Option<ty::EarlyBinder<'tcx, ty::PolyFnSig<'tcx>>> {
38 use DefKind::*;
39
40 let def_kind = tcx.def_kind(did);
41 if let Fn | AssocFn | Variant | Ctor(..) = def_kind {
42 Some(tcx.fn_sig(did))
43 } else {
44 tcx.dcx().span_delayed_bug(attr_span, "this attribute can only be applied to functions");
45 None
46 }
47}
48
49fn parse_instruction_set_attr(tcx: TyCtxt<'_>, attr: &Attribute) -> Option<InstructionSetAttr> {
51 let list = attr.meta_item_list()?;
52
53 match &list[..] {
54 [MetaItemInner::MetaItem(set)] => {
55 let segments = set.path.segments.iter().map(|x| x.ident.name).collect::<Vec<_>>();
56 match segments.as_slice() {
57 [sym::arm, sym::a32 | sym::t32] if !tcx.sess.target.has_thumb_interworking => {
58 tcx.dcx().emit_err(errors::UnsupportedInstructionSet { span: attr.span() });
59 None
60 }
61 [sym::arm, sym::a32] => Some(InstructionSetAttr::ArmA32),
62 [sym::arm, sym::t32] => Some(InstructionSetAttr::ArmT32),
63 _ => {
64 tcx.dcx().emit_err(errors::InvalidInstructionSet { span: attr.span() });
65 None
66 }
67 }
68 }
69 [] => {
70 tcx.dcx().emit_err(errors::BareInstructionSet { span: attr.span() });
71 None
72 }
73 _ => {
74 tcx.dcx().emit_err(errors::MultipleInstructionSet { span: attr.span() });
75 None
76 }
77 }
78}
79
80fn parse_no_sanitize_attr(tcx: TyCtxt<'_>, attr: &Attribute) -> Option<SanitizerSet> {
82 let list = attr.meta_item_list()?;
83 let mut sanitizer_set = SanitizerSet::empty();
84
85 for item in list.iter() {
86 match item.name() {
87 Some(sym::address) => {
88 sanitizer_set |= SanitizerSet::ADDRESS | SanitizerSet::KERNELADDRESS
89 }
90 Some(sym::cfi) => sanitizer_set |= SanitizerSet::CFI,
91 Some(sym::kcfi) => sanitizer_set |= SanitizerSet::KCFI,
92 Some(sym::memory) => sanitizer_set |= SanitizerSet::MEMORY,
93 Some(sym::memtag) => sanitizer_set |= SanitizerSet::MEMTAG,
94 Some(sym::shadow_call_stack) => sanitizer_set |= SanitizerSet::SHADOWCALLSTACK,
95 Some(sym::thread) => sanitizer_set |= SanitizerSet::THREAD,
96 Some(sym::hwaddress) => sanitizer_set |= SanitizerSet::HWADDRESS,
97 _ => {
98 tcx.dcx().emit_err(errors::InvalidNoSanitize { span: item.span() });
99 }
100 }
101 }
102
103 Some(sanitizer_set)
104}
105
106fn parse_patchable_function_entry(
108 tcx: TyCtxt<'_>,
109 attr: &Attribute,
110) -> Option<PatchableFunctionEntry> {
111 attr.meta_item_list().and_then(|l| {
112 let mut prefix = None;
113 let mut entry = None;
114 for item in l {
115 let Some(meta_item) = item.meta_item() else {
116 tcx.dcx().emit_err(errors::ExpectedNameValuePair { span: item.span() });
117 continue;
118 };
119
120 let Some(name_value_lit) = meta_item.name_value_literal() else {
121 tcx.dcx().emit_err(errors::ExpectedNameValuePair { span: item.span() });
122 continue;
123 };
124
125 let attrib_to_write = match meta_item.name() {
126 Some(sym::prefix_nops) => &mut prefix,
127 Some(sym::entry_nops) => &mut entry,
128 _ => {
129 tcx.dcx().emit_err(errors::UnexpectedParameterName {
130 span: item.span(),
131 prefix_nops: sym::prefix_nops,
132 entry_nops: sym::entry_nops,
133 });
134 continue;
135 }
136 };
137
138 let rustc_ast::LitKind::Int(val, _) = name_value_lit.kind else {
139 tcx.dcx().emit_err(errors::InvalidLiteralValue { span: name_value_lit.span });
140 continue;
141 };
142
143 let Ok(val) = val.get().try_into() else {
144 tcx.dcx().emit_err(errors::OutOfRangeInteger { span: name_value_lit.span });
145 continue;
146 };
147
148 *attrib_to_write = Some(val);
149 }
150
151 if let (None, None) = (prefix, entry) {
152 tcx.dcx().span_err(attr.span(), "must specify at least one parameter");
153 }
154
155 Some(PatchableFunctionEntry::from_prefix_and_entry(prefix.unwrap_or(0), entry.unwrap_or(0)))
156 })
157}
158
159#[derive(Default)]
162struct InterestingAttributeDiagnosticSpans {
163 link_ordinal: Option<Span>,
164 no_sanitize: Option<Span>,
165 inline: Option<Span>,
166 no_mangle: Option<Span>,
167}
168
169fn process_builtin_attrs(
172 tcx: TyCtxt<'_>,
173 did: LocalDefId,
174 attrs: &[Attribute],
175 codegen_fn_attrs: &mut CodegenFnAttrs,
176) -> InterestingAttributeDiagnosticSpans {
177 let mut interesting_spans = InterestingAttributeDiagnosticSpans::default();
178 let rust_target_features = tcx.rust_target_features(LOCAL_CRATE);
179
180 for attr in attrs.iter() {
181 if let hir::Attribute::Parsed(p) = attr {
182 match p {
183 AttributeKind::Cold(_) => codegen_fn_attrs.flags |= CodegenFnAttrFlags::COLD,
184 AttributeKind::ExportName { name, .. } => {
185 codegen_fn_attrs.export_name = Some(*name)
186 }
187 AttributeKind::Inline(inline, span) => {
188 codegen_fn_attrs.inline = *inline;
189 interesting_spans.inline = Some(*span);
190 }
191 AttributeKind::Naked(_) => codegen_fn_attrs.flags |= CodegenFnAttrFlags::NAKED,
192 AttributeKind::Align { align, .. } => codegen_fn_attrs.alignment = Some(*align),
193 AttributeKind::LinkName { name, .. } => codegen_fn_attrs.link_name = Some(*name),
194 AttributeKind::LinkOrdinal { ordinal, span } => {
195 codegen_fn_attrs.link_ordinal = Some(*ordinal);
196 interesting_spans.link_ordinal = Some(*span);
197 }
198 AttributeKind::LinkSection { name, .. } => {
199 codegen_fn_attrs.link_section = Some(*name)
200 }
201 AttributeKind::NoMangle(attr_span) => {
202 interesting_spans.no_mangle = Some(*attr_span);
203 if tcx.opt_item_name(did.to_def_id()).is_some() {
204 codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_MANGLE;
205 } else {
206 tcx.dcx().emit_err(NoMangleNameless {
207 span: *attr_span,
208 definition: format!(
209 "{} {}",
210 tcx.def_descr_article(did.to_def_id()),
211 tcx.def_descr(did.to_def_id())
212 ),
213 });
214 }
215 }
216 AttributeKind::Optimize(optimize, _) => codegen_fn_attrs.optimize = *optimize,
217 AttributeKind::TargetFeature(features, attr_span) => {
218 let Some(sig) = tcx.hir_node_by_def_id(did).fn_sig() else {
219 tcx.dcx().span_delayed_bug(*attr_span, "target_feature applied to non-fn");
220 continue;
221 };
222 let safe_target_features =
223 matches!(sig.header.safety, hir::HeaderSafety::SafeTargetFeatures);
224 codegen_fn_attrs.safe_target_features = safe_target_features;
225 if safe_target_features {
226 if tcx.sess.target.is_like_wasm || tcx.sess.opts.actually_rustdoc {
227 } else {
249 check_target_feature_trait_unsafe(tcx, did, *attr_span);
250 }
251 }
252 from_target_feature_attr(
253 tcx,
254 did,
255 features,
256 rust_target_features,
257 &mut codegen_fn_attrs.target_features,
258 );
259 }
260 AttributeKind::TrackCaller(attr_span) => {
261 let is_closure = tcx.is_closure_like(did.to_def_id());
262
263 if !is_closure
264 && let Some(fn_sig) = try_fn_sig(tcx, did, *attr_span)
265 && fn_sig.skip_binder().abi() != ExternAbi::Rust
266 {
267 tcx.dcx().emit_err(errors::RequiresRustAbi { span: *attr_span });
268 }
269 if is_closure
270 && !tcx.features().closure_track_caller()
271 && !attr_span.allows_unstable(sym::closure_track_caller)
272 {
273 feature_err(
274 &tcx.sess,
275 sym::closure_track_caller,
276 *attr_span,
277 "`#[track_caller]` on closures is currently unstable",
278 )
279 .emit();
280 }
281 codegen_fn_attrs.flags |= CodegenFnAttrFlags::TRACK_CALLER
282 }
283 AttributeKind::Used { used_by, .. } => match used_by {
284 UsedBy::Compiler => codegen_fn_attrs.flags |= CodegenFnAttrFlags::USED_COMPILER,
285 UsedBy::Linker => codegen_fn_attrs.flags |= CodegenFnAttrFlags::USED_LINKER,
286 },
287 AttributeKind::FfiConst(_) => {
288 codegen_fn_attrs.flags |= CodegenFnAttrFlags::FFI_CONST
289 }
290 AttributeKind::FfiPure(_) => codegen_fn_attrs.flags |= CodegenFnAttrFlags::FFI_PURE,
291 AttributeKind::StdInternalSymbol(_) => {
292 codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL
293 }
294 AttributeKind::Linkage(linkage, _) => {
295 let linkage = Some(*linkage);
296
297 if tcx.is_foreign_item(did) {
298 codegen_fn_attrs.import_linkage = linkage;
299
300 if tcx.is_mutable_static(did.into()) {
301 let mut diag = tcx.dcx().struct_span_err(
302 attr.span(),
303 "extern mutable statics are not allowed with `#[linkage]`",
304 );
305 diag.note(
306 "marking the extern static mutable would allow changing which \
307 symbol the static references rather than make the target of the \
308 symbol mutable",
309 );
310 diag.emit();
311 }
312 } else {
313 codegen_fn_attrs.linkage = linkage;
314 }
315 }
316 _ => {}
317 }
318 }
319
320 let Some(Ident { name, .. }) = attr.ident() else {
321 continue;
322 };
323
324 match name {
325 sym::rustc_allocator => codegen_fn_attrs.flags |= CodegenFnAttrFlags::ALLOCATOR,
326 sym::rustc_nounwind => codegen_fn_attrs.flags |= CodegenFnAttrFlags::NEVER_UNWIND,
327 sym::rustc_reallocator => codegen_fn_attrs.flags |= CodegenFnAttrFlags::REALLOCATOR,
328 sym::rustc_deallocator => codegen_fn_attrs.flags |= CodegenFnAttrFlags::DEALLOCATOR,
329 sym::rustc_allocator_zeroed => {
330 codegen_fn_attrs.flags |= CodegenFnAttrFlags::ALLOCATOR_ZEROED
331 }
332 sym::thread_local => codegen_fn_attrs.flags |= CodegenFnAttrFlags::THREAD_LOCAL,
333 sym::no_sanitize => {
334 interesting_spans.no_sanitize = Some(attr.span());
335 codegen_fn_attrs.no_sanitize |=
336 parse_no_sanitize_attr(tcx, attr).unwrap_or_default();
337 }
338 sym::instruction_set => {
339 codegen_fn_attrs.instruction_set = parse_instruction_set_attr(tcx, attr)
340 }
341 sym::patchable_function_entry => {
342 codegen_fn_attrs.patchable_function_entry =
343 parse_patchable_function_entry(tcx, attr);
344 }
345 _ => {}
346 }
347 }
348
349 interesting_spans
350}
351
352fn apply_overrides(tcx: TyCtxt<'_>, did: LocalDefId, codegen_fn_attrs: &mut CodegenFnAttrs) {
355 codegen_fn_attrs.alignment =
359 Ord::max(codegen_fn_attrs.alignment, tcx.sess.opts.unstable_opts.min_function_alignment);
360
361 codegen_fn_attrs.alignment = Ord::max(codegen_fn_attrs.alignment, tcx.inherited_align(did));
363
364 if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NAKED) {
368 codegen_fn_attrs.inline = InlineAttr::Never;
369 }
370
371 if tcx.is_closure_like(did.to_def_id()) && codegen_fn_attrs.inline != InlineAttr::Always {
385 let owner_id = tcx.parent(did.to_def_id());
386 if tcx.def_kind(owner_id).has_codegen_attrs() {
387 codegen_fn_attrs
388 .target_features
389 .extend(tcx.codegen_fn_attrs(owner_id).target_features.iter().copied());
390 }
391 }
392
393 let crate_attrs = tcx.hir_attrs(rustc_hir::CRATE_HIR_ID);
396 let no_builtins = attr::contains_name(crate_attrs, sym::no_builtins);
397 if no_builtins {
398 codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_BUILTINS;
399 }
400
401 if tcx.should_inherit_track_caller(did) {
403 codegen_fn_attrs.flags |= CodegenFnAttrFlags::TRACK_CALLER;
404 }
405
406 if tcx.is_foreign_item(did) {
408 if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL) {
410 } else if codegen_fn_attrs.link_name.is_some() {
414 } else {
416 codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_MANGLE;
424 }
425 }
426}
427
428fn check_result(
429 tcx: TyCtxt<'_>,
430 did: LocalDefId,
431 interesting_spans: InterestingAttributeDiagnosticSpans,
432 codegen_fn_attrs: &CodegenFnAttrs,
433) {
434 if !codegen_fn_attrs.target_features.is_empty()
448 && matches!(codegen_fn_attrs.inline, InlineAttr::Always)
449 && let Some(span) = interesting_spans.inline
450 {
451 tcx.dcx().span_err(span, "cannot use `#[inline(always)]` with `#[target_feature]`");
452 }
453
454 if !codegen_fn_attrs.no_sanitize.is_empty()
456 && codegen_fn_attrs.inline.always()
457 && let (Some(no_sanitize_span), Some(inline_span)) =
458 (interesting_spans.no_sanitize, interesting_spans.inline)
459 {
460 let hir_id = tcx.local_def_id_to_hir_id(did);
461 tcx.node_span_lint(lint::builtin::INLINE_NO_SANITIZE, hir_id, no_sanitize_span, |lint| {
462 lint.primary_message("`no_sanitize` will have no effect after inlining");
463 lint.span_note(inline_span, "inlining requested here");
464 })
465 }
466
467 if let Some(_) = codegen_fn_attrs.link_name
469 && let Some(_) = codegen_fn_attrs.link_ordinal
470 {
471 let msg = "cannot use `#[link_name]` with `#[link_ordinal]`";
472 if let Some(span) = interesting_spans.link_ordinal {
473 tcx.dcx().span_err(span, msg);
474 } else {
475 tcx.dcx().err(msg);
476 }
477 }
478
479 if let Some(features) = check_tied_features(
480 tcx.sess,
481 &codegen_fn_attrs
482 .target_features
483 .iter()
484 .map(|features| (features.name.as_str(), true))
485 .collect(),
486 ) {
487 let span =
488 find_attr!(tcx.get_all_attrs(did), AttributeKind::TargetFeature(_, span) => *span)
489 .unwrap_or_else(|| tcx.def_span(did));
490
491 tcx.dcx()
492 .create_err(errors::TargetFeatureDisableOrEnable {
493 features,
494 span: Some(span),
495 missing_features: Some(errors::MissingFeatures),
496 })
497 .emit();
498 }
499}
500
501fn handle_lang_items(
502 tcx: TyCtxt<'_>,
503 did: LocalDefId,
504 interesting_spans: &InterestingAttributeDiagnosticSpans,
505 attrs: &[Attribute],
506 codegen_fn_attrs: &mut CodegenFnAttrs,
507) {
508 let lang_item = lang_items::extract(attrs).and_then(|(name, _)| LangItem::from_name(name));
509
510 if let Some(lang_item) = lang_item {
516 if WEAK_LANG_ITEMS.contains(&lang_item) {
517 codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL;
518 }
519 if let Some(link_name) = lang_item.link_name() {
520 codegen_fn_attrs.export_name = Some(link_name);
521 codegen_fn_attrs.link_name = Some(link_name);
522 }
523 }
524
525 if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL)
527 && codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NO_MANGLE)
528 {
529 let mut err = tcx
530 .dcx()
531 .struct_span_err(
532 interesting_spans.no_mangle.unwrap_or_default(),
533 "`#[no_mangle]` cannot be used on internal language items",
534 )
535 .with_note("Rustc requires this item to have a specific mangled name.")
536 .with_span_label(tcx.def_span(did), "should be the internal language item");
537 if let Some(lang_item) = lang_item
538 && let Some(link_name) = lang_item.link_name()
539 {
540 err = err
541 .with_note("If you are trying to prevent mangling to ease debugging, many")
542 .with_note(format!("debuggers support a command such as `rbreak {link_name}` to"))
543 .with_note(format!(
544 "match `.*{link_name}.*` instead of `break {link_name}` on a specific name"
545 ))
546 }
547 err.emit();
548 }
549}
550
551fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
560 if cfg!(debug_assertions) {
561 let def_kind = tcx.def_kind(did);
562 assert!(
563 def_kind.has_codegen_attrs(),
564 "unexpected `def_kind` in `codegen_fn_attrs`: {def_kind:?}",
565 );
566 }
567
568 let mut codegen_fn_attrs = CodegenFnAttrs::new();
569 let attrs = tcx.hir_attrs(tcx.local_def_id_to_hir_id(did));
570
571 let interesting_spans = process_builtin_attrs(tcx, did, attrs, &mut codegen_fn_attrs);
572 handle_lang_items(tcx, did, &interesting_spans, attrs, &mut codegen_fn_attrs);
573 apply_overrides(tcx, did, &mut codegen_fn_attrs);
574 check_result(tcx, did, interesting_spans, &codegen_fn_attrs);
575
576 codegen_fn_attrs
577}
578
579fn opt_trait_item(tcx: TyCtxt<'_>, def_id: DefId) -> Option<DefId> {
581 let impl_item = tcx.opt_associated_item(def_id)?;
582 match impl_item.container {
583 ty::AssocItemContainer::Impl => impl_item.trait_item_def_id,
584 _ => None,
585 }
586}
587
588fn should_inherit_track_caller(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
591 let Some(trait_item) = opt_trait_item(tcx, def_id) else { return false };
592 tcx.codegen_fn_attrs(trait_item).flags.intersects(CodegenFnAttrFlags::TRACK_CALLER)
593}
594
595fn inherited_align<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<Align> {
598 tcx.codegen_fn_attrs(opt_trait_item(tcx, def_id)?).alignment
599}
600
601pub fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> Option<AutoDiffAttrs> {
608 let attrs = tcx.get_attrs(id, sym::rustc_autodiff);
609
610 let attrs = attrs.filter(|attr| attr.has_name(sym::rustc_autodiff)).collect::<Vec<_>>();
611
612 let attr = match &attrs[..] {
615 [] => return None,
616 [attr] => attr,
617 _ => {
618 span_bug!(attrs[1].span(), "cg_ssa: rustc_autodiff should only exist once per source");
619 }
620 };
621
622 let list = attr.meta_item_list().unwrap_or_default();
623
624 if list.is_empty() {
626 return Some(AutoDiffAttrs::source());
627 }
628
629 let [mode, width_meta, input_activities @ .., ret_activity] = &list[..] else {
630 span_bug!(attr.span(), "rustc_autodiff attribute must contain mode, width and activities");
631 };
632 let mode = if let MetaItemInner::MetaItem(MetaItem { path: p1, .. }) = mode {
633 p1.segments.first().unwrap().ident
634 } else {
635 span_bug!(attr.span(), "rustc_autodiff attribute must contain mode");
636 };
637
638 let mode = match mode.as_str() {
640 "Forward" => DiffMode::Forward,
641 "Reverse" => DiffMode::Reverse,
642 _ => {
643 span_bug!(mode.span, "rustc_autodiff attribute contains invalid mode");
644 }
645 };
646
647 let width: u32 = match width_meta {
648 MetaItemInner::MetaItem(MetaItem { path: p1, .. }) => {
649 let w = p1.segments.first().unwrap().ident;
650 match w.as_str().parse() {
651 Ok(val) => val,
652 Err(_) => {
653 span_bug!(w.span, "rustc_autodiff width should fit u32");
654 }
655 }
656 }
657 MetaItemInner::Lit(lit) => {
658 if let LitKind::Int(val, _) = lit.kind {
659 match val.get().try_into() {
660 Ok(val) => val,
661 Err(_) => {
662 span_bug!(lit.span, "rustc_autodiff width should fit u32");
663 }
664 }
665 } else {
666 span_bug!(lit.span, "rustc_autodiff width should be an integer");
667 }
668 }
669 };
670
671 let ret_symbol = if let MetaItemInner::MetaItem(MetaItem { path: p1, .. }) = ret_activity {
673 p1.segments.first().unwrap().ident
674 } else {
675 span_bug!(attr.span(), "rustc_autodiff attribute must contain the return activity");
676 };
677
678 let Ok(ret_activity) = DiffActivity::from_str(ret_symbol.as_str()) else {
680 span_bug!(ret_symbol.span, "invalid return activity");
681 };
682
683 let mut arg_activities: Vec<DiffActivity> = vec![];
685 for arg in input_activities {
686 let arg_symbol = if let MetaItemInner::MetaItem(MetaItem { path: p2, .. }) = arg {
687 match p2.segments.first() {
688 Some(x) => x.ident,
689 None => {
690 span_bug!(
691 arg.span(),
692 "rustc_autodiff attribute must contain the input activity"
693 );
694 }
695 }
696 } else {
697 span_bug!(arg.span(), "rustc_autodiff attribute must contain the input activity");
698 };
699
700 match DiffActivity::from_str(arg_symbol.as_str()) {
701 Ok(arg_activity) => arg_activities.push(arg_activity),
702 Err(_) => {
703 span_bug!(arg_symbol.span, "invalid input activity");
704 }
705 }
706 }
707
708 Some(AutoDiffAttrs { mode, width, ret_activity, input_activity: arg_activities })
709}
710
711pub(crate) fn provide(providers: &mut Providers) {
712 *providers =
713 Providers { codegen_fn_attrs, should_inherit_track_caller, inherited_align, ..*providers };
714}