Skip to content

error: unused attribute const_fn_union with incr-comp  #65023

Closed

Description

@spastorino

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

Activity

  1. added
    C-bugCategory: This is a bug.
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Oct 2, 2019
  2. Centril commented on Oct 3, 2019

    @Centril
    Contributor

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

  3. self-assigned this
    on Oct 3, 2019
  4. spastorino commented on Oct 3, 2019

    @spastorino
    MemberAuthor

    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> {
    
  5. added a commit that references this issue on Oct 4, 2019
  6. added 2 commits that reference this issue on Oct 5, 2019
  7. added a commit that references this issue on Jan 8, 2020
  8. pnkfelix commented on Mar 25, 2020

    @pnkfelix
    Contributor
  9. added a commit that references this issue on May 29, 2020
  10. pnkfelix commented on Oct 6, 2020

    @pnkfelix
    Contributor

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

  11. added
    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)
    on Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)A-incr-compArea: Incremental compilationC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-incr-compWorking group: Incremental compilation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions