Skip to content

Commit 3571e6e

Browse files
committed
Allow unstable_name_collisions
In recent nightlies we are hitting errors like the following: error: an associated constant with this name may be added to the standard library in the future --> libm/src/math/support/float_traits.rs:248:48 | 248 | const SIGN_MASK: Self::Int = 1 << (Self::BITS - 1); | ^^^^^^^^^^ ... 324 | / float_impl!( 325 | | f32, 326 | | u32, 327 | | i32, ... | 333 | | fmaf32 334 | | ); | |_- in this macro invocation | = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior! = note: for more information, see issue #48919 <rust-lang/rust#48919> = note: `-D unstable-name-collisions` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(unstable_name_collisions)]` = note: this error originates in the macro `float_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the fully qualified path to the associated const | 248 - const SIGN_MASK: Self::Int = 1 << (Self::BITS - 1); 248 + const SIGN_MASK: Self::Int = 1 << (<f32 as float_traits::Float>::BITS - 1); | help: add `#![feature(float_bits_const)]` to the crate attributes to enable `core::f32::<impl f32>::BITS` --> libm/src/lib.rs:26:1 | 26 + #![feature(float_bits_const)] | Using fully qualified syntax is verbose and `BITS` only exists since recently, so allow this lint instead.
1 parent 28e0556 commit 3571e6e

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

compiler-builtins/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
#![feature(repr_simd)]
1212
#![feature(macro_metavar_expr_concat)]
1313
#![feature(rustc_attrs)]
14-
#![feature(float_bits_const)]
1514
#![cfg_attr(f16_enabled, feature(f16))]
1615
#![cfg_attr(f128_enabled, feature(f128))]
1716
#![no_builtins]
1817
#![no_std]
18+
#![allow(unstable_name_collisions)] // FIXME(float_bits_const): remove when stable
1919
#![allow(unused_features)]
2020
#![allow(internal_features)]
2121
// `mem::swap` cannot be used because it may generate references to memcpy in unoptimized code.

libm-test/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![cfg_attr(f16_enabled, feature(f16))]
22
#![cfg_attr(f128_enabled, feature(f128))]
33
#![allow(clippy::unusual_byte_groupings)] // sometimes we group by sign_exp_sig
4+
#![allow(unstable_name_collisions)] // FIXME(float_bits_const): remove when stable
45

56
pub mod domain;
67
mod f8_impl;

libm/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
)]
99
#![cfg_attr(f128_enabled, feature(f128))]
1010
#![cfg_attr(f16_enabled, feature(f16))]
11+
#![allow(unstable_name_collisions)] // FIXME(float_bits_const): remove when stable
1112
#![allow(clippy::assign_op_pattern)]
1213
#![allow(clippy::deprecated_cfg_attr)]
1314
#![allow(clippy::eq_op)]

0 commit comments

Comments
 (0)