error: unused attribute const_fn_union with incr-comp
spastorino opened this issue · 4 comments
spastorino commented
Every time I try to recompile the compiler using incremental compilation with ./x.py build -i --stage 1 --keep-stage 1 src/libstd
I get the following error ...
error: unused attribute
--> src/libcore/slice/mod.rs:66:5
|
66 | #[allow_internal_unstable(const_fn_union)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D unused-attributes` implied by `-D warnings`
error: unused attribute
--> src/libcore/str/mod.rs:2170:5
|
2170 | #[allow_internal_unstable(const_fn_union)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
error: could not compile `core`.
spastorino commented
The following change could be used as a workaround ...
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs
index b5462d98837..e55baded913 100644
--- a/src/libcore/slice/mod.rs
+++ b/src/libcore/slice/mod.rs
@@ -64,6 +64,7 @@ impl<T> [T] {
#[inline]
// SAFETY: const sound because we transmute out the length field as a usize (which it must be)
#[allow_internal_unstable(const_fn_union)]
+ #[allow(unused_attributes)]
pub const fn len(&self) -> usize {
unsafe {
crate::ptr::Repr { rust: self }.raw.len
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index ece61dde490..d02d232a20e 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -2168,6 +2168,7 @@ impl str {
#[inline(always)]
// SAFETY: const sound because we transmute two types with the same layout
#[allow_internal_unstable(const_fn_union)]
+ #[allow(unused_attributes)]
pub const fn as_bytes(&self) -> &[u8] {
#[repr(C)]
union Slices<'a> {
pnkfelix commented
closing as "worked-around", (we think this really only affects people working on rustc development itself).
((there are some notes about fixme's mentioned in linked prs but I'm not going to try to address those right now.))