Skip to content

Commit 29dba3e

Browse files
mejrsJonathanBrouwer
authored andcommitted
make nightly feature
1 parent 2a20dfa commit 29dba3e

4 files changed

Lines changed: 23 additions & 15 deletions

File tree

‎compiler/rustc_structures/Cargo.toml‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,19 @@ edition = "2024"
66
[dependencies]
77
# tidy-alphabetical-start
88
bitflags = "2.4.1"
9-
rustc_data_structures = { path = "../rustc_data_structures" }
10-
rustc_macros = { path = "../rustc_macros" }
11-
rustc_serialize = { path = "../rustc_serialize" }
9+
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
10+
rustc_macros = { path = "../rustc_macros", optional = true }
11+
rustc_serialize = { path = "../rustc_serialize", optional = true }
1212
schemars = "1.0.4"
1313
serde = "1.0.219"
1414
# tidy-alphabetical-end
15+
16+
[features]
17+
# tidy-alphabetical-start
18+
default = ["nightly"]
19+
nightly = [
20+
"dep:rustc_data_structures",
21+
"dep:rustc_macros",
22+
"dep:rustc_serialize",
23+
]
24+
# tidy-alphabetical-end

‎compiler/rustc_structures/src/lib.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![deny(unstable_features)]
2+
13
mod limit;
24
mod sanitizer_set;
35

‎compiler/rustc_structures/src/limit.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
use std::fmt;
22
use std::ops::{Div, Mul};
33

4+
#[cfg(feature = "nightly")]
45
use rustc_macros::{Decodable_NoContext, Encodable_NoContext, StableHash};
56

67
/// New-type wrapper around `usize` for representing limits. Ensures that comparisons against
78
/// limits are consistent throughout the compiler.
8-
#[derive(Clone, Copy, Debug, StableHash, Encodable_NoContext, Decodable_NoContext)]
9+
#[derive(Clone, Copy, Debug)]
10+
#[cfg_attr(feature = "nightly", derive(StableHash, Encodable_NoContext, Decodable_NoContext))]
911
pub struct Limit(pub usize);
1012

1113
impl Limit {

‎compiler/rustc_structures/src/sanitizer_set.rs‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
use core::fmt;
22
use std::str::FromStr;
33

4+
#[cfg(feature = "nightly")]
45
use rustc_macros::{Decodable_NoContext, Encodable_NoContext, StableHash};
56

6-
#[derive(
7-
Default,
8-
Clone,
9-
Copy,
10-
PartialEq,
11-
Eq,
12-
Hash,
13-
Encodable_NoContext,
14-
Decodable_NoContext,
15-
StableHash
16-
)]
7+
#[derive(Default, Clone, Copy, PartialEq, Eq, Hash)]
8+
#[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, StableHash))]
179
pub struct SanitizerSet(u16);
1810
bitflags::bitflags! {
1911
impl SanitizerSet: u16 {
@@ -33,6 +25,8 @@ bitflags::bitflags! {
3325
const REALTIME = 1 << 13;
3426
}
3527
}
28+
29+
#[cfg(feature = "nightly")]
3630
rustc_data_structures::external_bitflags_debug! { SanitizerSet }
3731

3832
impl SanitizerSet {

0 commit comments

Comments
 (0)