Is `#[cold]` attribute stable right now?

I skimed a post in rust reddit and it seems #[cold] attribute is not stable 2 years ago. But is it stable right now?

#[cold] has been stable since Rust 1.0.0

3 Likes

But I saw some issues about unlikely in LLVM issues, does not Rust's #[cold] attribute relies on it?

"stable" in Rust means that you can use it on the regular (non-nightly, non-beta) toolchain and it is guaranteed to remain in the language in a backwards-compatible manner. Rust's stability guarantee has nothing to do with LLVM bugs. If LLVM has a bug, then the LLVM developers need to fix it.

5 Likes

Got it. Thanks for your patient repy!

No, not at all, actually. That attribute on a function can use the cold function attribute instead.

2 Likes