Skip to content

Commit e8d2321

Browse files
Rollup merge of #156830 - okaneco:phi_doc_alias, r=SimonSapin
Add `#[doc(alias = "phi")]` for float `GOLDEN_RATIO` constants - Adds "phi" doc alias for `f16`, `f32`, `f64`, and `f128` I knew this constant was stabilized but I couldn't remember what it was called. Searching "phi" in the docs only surfaces the π constant, `is_ascii_graphic`, and `spin_loop_hint` methods. This alias would make it much easier to find. https://doc.rust-lang.org/nightly/std/?search=phi
2 parents eb68b36 + 3a6cb05 commit e8d2321

4 files changed

Lines changed: 4 additions & 0 deletions

File tree

library/core/src/num/f128.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub mod consts {
3333
pub const TAU: f128 = 6.28318530717958647692528676655900576839433879875021164194989_f128;
3434

3535
/// The golden ratio (φ)
36+
#[doc(alias = "phi")]
3637
#[unstable(feature = "f128", issue = "116909")]
3738
pub const GOLDEN_RATIO: f128 =
3839
1.61803398874989484820458683436563811772030917980576286213545_f128;

library/core/src/num/f16.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub mod consts {
3535
pub const TAU: f16 = 6.28318530717958647692528676655900577_f16;
3636

3737
/// The golden ratio (φ)
38+
#[doc(alias = "phi")]
3839
#[unstable(feature = "f16", issue = "116909")]
3940
pub const GOLDEN_RATIO: f16 = 1.618033988749894848204586834365638118_f16;
4041

library/core/src/num/f32.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ pub mod consts {
292292
pub const TAU: f32 = 6.28318530717958647692528676655900577_f32;
293293

294294
/// The golden ratio (φ)
295+
#[doc(alias = "phi")]
295296
#[stable(feature = "euler_gamma_golden_ratio", since = "1.94.0")]
296297
pub const GOLDEN_RATIO: f32 = 1.618033988749894848204586834365638118_f32;
297298

library/core/src/num/f64.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ pub mod consts {
292292
pub const TAU: f64 = 6.28318530717958647692528676655900577_f64;
293293

294294
/// The golden ratio (φ)
295+
#[doc(alias = "phi")]
295296
#[stable(feature = "euler_gamma_golden_ratio", since = "1.94.0")]
296297
pub const GOLDEN_RATIO: f64 = 1.618033988749894848204586834365638118_f64;
297298

0 commit comments

Comments
 (0)