mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 02:33:55 +00:00
Rollup merge of #26133 - steveklabnik:gh25573, r=alexcrichton
This obscures more than it helps. Fixes #25573
This commit is contained in:
commit
496fe4d51a
@ -78,7 +78,3 @@ Almost always, if you can choose between the two, choose `const`. It’s pretty
|
|||||||
rare that you actually want a memory location associated with your constant,
|
rare that you actually want a memory location associated with your constant,
|
||||||
and using a const allows for optimizations like constant propagation not only
|
and using a const allows for optimizations like constant propagation not only
|
||||||
in your crate but downstream crates.
|
in your crate but downstream crates.
|
||||||
|
|
||||||
A const can be thought of as a `#define` in C: it has metadata overhead but it
|
|
||||||
has no runtime overhead. “Should I use a #define or a static in C,” is largely
|
|
||||||
the same question as whether you should use a const or a static in Rust.
|
|
||||||
|
Loading…
Reference in New Issue
Block a user