Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: unused attribute const_fn_union with incr-comp #65023

Closed
spastorino opened this issue Oct 2, 2019 · 4 comments
Closed

error: unused attribute const_fn_union with incr-comp #65023

spastorino opened this issue Oct 2, 2019 · 4 comments
Assignees
Labels
A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-incr-comp Working group: Incremental compilation

Comments

@spastorino
Copy link
Member

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 spastorino added A-incr-comp Area: Incremental compilation WG-incr-comp Working group: Incremental compilation labels Oct 2, 2019
@jonas-schievink jonas-schievink added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 2, 2019
@Centril
Copy link
Contributor

Centril commented Oct 3, 2019

@oli-obk, J'Accuse…! :)

@oli-obk oli-obk self-assigned this Oct 3, 2019
@spastorino
Copy link
Member Author

spastorino commented Oct 3, 2019

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> {

@jonas-schievink jonas-schievink added the A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. label Oct 4, 2019
Centril added a commit to Centril/rust that referenced this issue Oct 4, 2019
…r=Centril

Allow unused attributes to avoid incremental bug

cc rust-lang#65023

This isn't labeled as fixing that issue because it's not really a fix, just a patch.
tmandry added a commit to tmandry/rust that referenced this issue Oct 5, 2019
…r=Centril

Allow unused attributes to avoid incremental bug

cc rust-lang#65023

This isn't labeled as fixing that issue because it's not really a fix, just a patch.
tmandry added a commit to tmandry/rust that referenced this issue Oct 6, 2019
…r=Centril

Allow unused attributes to avoid incremental bug

cc rust-lang#65023

This isn't labeled as fixing that issue because it's not really a fix, just a patch.
anp added a commit to anp/rust that referenced this issue Jan 5, 2020
The same problem as in rust-lang#65023 was
introduced by rust-lang#67657. This works
around the current incrcomp issue with these attributes by allowing it
here.
Centril added a commit to Centril/rust that referenced this issue Jan 8, 2020
Fix incremental builds of core by allowing unused attribute.

I *think* that the same problem as in rust-lang#65023 was introduced by rust-lang#67657. This works around the current incrcomp issue with these attributes by allowing it here. This resolves the near-term issue for me, at least.
@pnkfelix
Copy link
Member

cc #58633

jonas-schievink added a commit that referenced this issue May 28, 2020
This should hopefully work around #65023, which currently makes almost every bootstrap fail for me.
JohnTitor added a commit to JohnTitor/rust that referenced this issue May 29, 2020
…r=Mark-Simulacrum

Whitelist #[allow_internal_unstable]

This should hopefully work around rust-lang#65023, which currently makes almost every bootstrap fail for me.
@pnkfelix
Copy link
Member

pnkfelix commented Oct 6, 2020

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.))

@pnkfelix pnkfelix closed this as completed Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-incr-comp Working group: Incremental compilation
Projects
None yet
Development

No branches or pull requests

5 participants