Create utilities for using Rust static strings in C

This is a continuation of #25127 (moved), to provide some utilities for working with static strings across the FFI boundary without accidentally introducing leaks.