Skip to content

Commit

Permalink
Auto merge of #2028 - IsaacWoods:master, r=JohnTitor
Browse files Browse the repository at this point in the history
Fix error when building rustc with a custom libc

When pulling a custom `libc` into a `rustc` build (with the `rustc-dep-of-std` feature set), the following error occurs:
```
error: unused attribute
  --> /hdd/libc/src/lib.rs:29:1
   |
29 | #![no_std]
   | ^^^^^^^^^^
   |
   = note: `-D unused-attributes` implied by `-D warnings`

error: crate-level attribute should be in the root module
  --> /hdd/libc/src/lib.rs:29:1
   |
29 | #![no_std]
   | ^^^^^^^^^^
```

I think this is because both the `no_std` and `no_core` attributes are specified, although the error message doesn't make this very clear. This PR changes this so `no_std` is only supplied when the `rustc-dep-of-std` feature is not.
  • Loading branch information
bors committed Jan 11, 2021
2 parents 9cf7c6a + 48c4482 commit bb8fe9a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// Enable extra lints:
#![cfg_attr(feature = "extra_traits", deny(missing_debug_implementations))]
#![deny(missing_copy_implementations, safe_packed_borrows)]
#![no_std]
#![cfg_attr(not(feature = "rustc-dep-of-std"), no_std)]
#![cfg_attr(feature = "rustc-dep-of-std", no_core)]
#![cfg_attr(
any(feature = "rustc-dep-of-std", target_os = "redox"),
Expand Down

0 comments on commit bb8fe9a

Please sign in to comment.