Skip to content

Commit 7cbac14

Browse files
authored
Merge pull request #4167 from tgross35/backport-fix-rustc-dep-of-std
[0.2] Fix usage with `rustc-dep-of-std`
2 parents 0acb8d6 + 70b1487 commit 7cbac14

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

Diff for: ci/verify-build.sh

+5
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ test_target() {
7070
$cmd --no-default-features
7171
$cmd --no-default-features --features extra_traits
7272

73+
# Ensure the crate will build when used with `std`
74+
if [ "$rust" = "nightly" ]; then
75+
$cmd --no-default-features --features rustc-dep-of-std
76+
fi
77+
7378
# For tier 2 freebsd targets, check with the different versions we support
7479
# if on nightly or stable
7580
case "$rust-$target" in

Diff for: src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
// Attributes needed when building as part of the standard library
2222
#![cfg_attr(feature = "rustc-dep-of-std", feature(link_cfg, no_core))]
2323
#![cfg_attr(libc_thread_local, feature(thread_local))]
24+
#![cfg_attr(feature = "rustc-dep-of-std", allow(internal_features))]
25+
// DIFF(1.0): The thread local references that raise this lint were removed in 1.0
26+
#![cfg_attr(feature = "rustc-dep-of-std", allow(static_mut_refs))]
2427
// Enable extra lints:
2528
#![cfg_attr(feature = "extra_traits", deny(missing_debug_implementations))]
2629
#![deny(missing_copy_implementations, safe_packed_borrows)]

Diff for: src/macros.rs

+21-12
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ macro_rules! prelude {
7070
mod prelude {
7171
// Exports from `core`
7272
#[allow(unused_imports)]
73-
pub(crate) use core::clone::Clone;
73+
pub(crate) use ::core::clone::Clone;
7474
#[allow(unused_imports)]
75-
pub(crate) use core::marker::{Copy, Send, Sync};
75+
pub(crate) use ::core::marker::{Copy, Send, Sync};
7676
#[allow(unused_imports)]
77-
pub(crate) use core::option::Option;
77+
pub(crate) use ::core::option::Option;
7878
#[allow(unused_imports)]
79-
pub(crate) use core::{fmt, hash, iter, mem};
79+
pub(crate) use ::core::{fmt, hash, iter, mem};
8080

8181
// Commonly used types defined in this crate
8282
#[allow(unused_imports)]
@@ -108,8 +108,11 @@ macro_rules! s {
108108
(it: $(#[$attr:meta])* pub struct $i:ident { $($field:tt)* }) => (
109109
__item! {
110110
#[repr(C)]
111-
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
112-
#[derive(Copy, Clone)]
111+
#[cfg_attr(
112+
feature = "extra_traits",
113+
::core::prelude::v1::derive(Debug, Eq, Hash, PartialEq)
114+
)]
115+
#[::core::prelude::v1::derive(::core::clone::Clone, ::core::marker::Copy)]
113116
#[allow(deprecated)]
114117
$(#[$attr])*
115118
pub struct $i { $($field)* }
@@ -127,8 +130,11 @@ macro_rules! s_paren {
127130
pub struct $i:ident ( $($field:tt)* );
128131
)*) => ($(
129132
__item! {
130-
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
131-
#[derive(Copy, Clone)]
133+
#[cfg_attr(
134+
feature = "extra_traits",
135+
::core::prelude::v1::derive(Debug, Eq, Hash, PartialEq)
136+
)]
137+
#[::core::prelude::v1::derive(::core::clone::Clone, ::core::marker::Copy)]
132138
$(#[$attr])*
133139
pub struct $i ( $($field)* );
134140
}
@@ -149,7 +155,7 @@ macro_rules! s_no_extra_traits {
149155
(it: $(#[$attr:meta])* pub union $i:ident { $($field:tt)* }) => (
150156
__item! {
151157
#[repr(C)]
152-
#[derive(Copy, Clone)]
158+
#[::core::prelude::v1::derive(::core::clone::Clone, ::core::marker::Copy)]
153159
$(#[$attr])*
154160
pub union $i { $($field)* }
155161
}
@@ -158,7 +164,7 @@ macro_rules! s_no_extra_traits {
158164
(it: $(#[$attr:meta])* pub struct $i:ident { $($field:tt)* }) => (
159165
__item! {
160166
#[repr(C)]
161-
#[derive(Copy, Clone)]
167+
#[::core::prelude::v1::derive(::core::clone::Clone, ::core::marker::Copy)]
162168
$(#[$attr])*
163169
pub struct $i { $($field)* }
164170
}
@@ -186,8 +192,11 @@ macro_rules! e {
186192
pub enum $i:ident { $($field:tt)* }
187193
)*) => ($(
188194
__item! {
189-
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
190-
#[derive(Copy, Clone)]
195+
#[cfg_attr(
196+
feature = "extra_traits",
197+
::core::prelude::v1::derive(Debug, Eq, Hash, PartialEq)
198+
)]
199+
#[::core::prelude::v1::derive(::core::clone::Clone, ::core::marker::Copy)]
191200
$(#[$attr])*
192201
pub enum $i { $($field)* }
193202
}

0 commit comments

Comments
 (0)