You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a function attribute that pins a declaration's generated Rust symbol, for
FFI/autogen boundaries and compiler transitions. Follows the existing
`#deprecated("...")` attribute convention.
- Parser: extend the function attribute loop to accept `#lower_name("...")`;
store it on `FunctionDecl.lower_name`.
- Lowering: a per-run thread-local override map (populated from the program's
pins) is consulted by the canonical name-lowering helpers (`rust_function_ident`,
`rust_qualified_function_ident`, and `lower_callee`'s free-call path), so the
pinned symbol is used at the definition and every call site.
- Inventory: `symbol_inventory` installs the same overrides so `lowered_name`
reports the pinned symbol.
- Checker (RS0035): a pin must be a valid Rust identifier and must not collide
with another function's final backend name.
- Formatter round-trips the attribute.
Tests: symbol-inventory pin test, definition+call-site lowering test, pass
fixture, two fail fixtures (conflict + invalid), formatter round-trip. Full
`cargo test -p rsscript` green; clippy clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
explanation:"`effects(noalloc)` is a guarantee that the function performs no heap allocation. Calls inside it must target enum variants or functions also declared `effects(noalloc)`, while direct constructors and `manage` are allocation diagnostics.",
447
448
},
449
+
DiagnosticExplanation{
450
+
code: code::LOWER_NAME_CONFLICT,
451
+
title:"lowered name conflict",
452
+
explanation:"A `#lower_name(\"...\")` pin must be a valid Rust identifier and must not collide with any other declaration's lowered backend name, so generated symbols stay unique.",
0 commit comments