rust-lang / miri

An interpreter for Rust's mid-level intermediate representation
Apache License 2.0
4.6k stars 346 forks source link

String de-duplication for ``localtime_r`` #4025

Open tiif opened 2 days ago

tiif commented 2 days ago

Since this is already brought up in https://github.com/rust-lang/miri/issues/3470#issuecomment-2460600407, I will just open a new issue for this.

To resolve the FIXME here, https://github.com/rust-lang/miri/blob/052bdcb72dda94f0ac0284304503d25de28acc6b/src/shims/time.rs#L198-L199

we could do:

We should have allocate_bytes which allocates a byte slice, and that should use the cache. allocate_str can call that, and transmute the result to &str.

tiif commented 2 days ago

@rustbot label +C-enhancement