Skip to content

Commit 34c7111

Browse files
authored
Rollup merge of rust-lang#102556 - WaffleLapkin:implied_by_btree_new, r=Mark-Simulacrum
Make `feature(const_btree_len)` implied by `feature(const_btree_new)` ...this should fix code that used the old feature that was changed in rust-lang#102197 cc `@davidtwco` it seems like tidy doesn't check `implied_by`, should it?
2 parents 3ab4851 + da78c1f commit 34c7111

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

library/alloc/src/collections/btree/map.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -2392,7 +2392,11 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
23922392
/// ```
23932393
#[must_use]
23942394
#[stable(feature = "rust1", since = "1.0.0")]
2395-
#[rustc_const_unstable(feature = "const_btree_len", issue = "71835")]
2395+
#[rustc_const_unstable(
2396+
feature = "const_btree_len",
2397+
issue = "71835",
2398+
implied_by = "const_btree_new"
2399+
)]
23962400
pub const fn len(&self) -> usize {
23972401
self.length
23982402
}
@@ -2413,7 +2417,11 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
24132417
/// ```
24142418
#[must_use]
24152419
#[stable(feature = "rust1", since = "1.0.0")]
2416-
#[rustc_const_unstable(feature = "const_btree_len", issue = "71835")]
2420+
#[rustc_const_unstable(
2421+
feature = "const_btree_len",
2422+
issue = "71835",
2423+
implied_by = "const_btree_new"
2424+
)]
24172425
pub const fn is_empty(&self) -> bool {
24182426
self.len() == 0
24192427
}

library/alloc/src/collections/btree/set.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,11 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
11741174
/// ```
11751175
#[must_use]
11761176
#[stable(feature = "rust1", since = "1.0.0")]
1177-
#[rustc_const_unstable(feature = "const_btree_len", issue = "71835")]
1177+
#[rustc_const_unstable(
1178+
feature = "const_btree_len",
1179+
issue = "71835",
1180+
implied_by = "const_btree_new"
1181+
)]
11781182
pub const fn len(&self) -> usize {
11791183
self.map.len()
11801184
}
@@ -1193,7 +1197,11 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
11931197
/// ```
11941198
#[must_use]
11951199
#[stable(feature = "rust1", since = "1.0.0")]
1196-
#[rustc_const_unstable(feature = "const_btree_len", issue = "71835")]
1200+
#[rustc_const_unstable(
1201+
feature = "const_btree_len",
1202+
issue = "71835",
1203+
implied_by = "const_btree_new"
1204+
)]
11971205
pub const fn is_empty(&self) -> bool {
11981206
self.len() == 0
11991207
}

src/tools/tidy/src/features.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,9 @@ fn map_lib_features(
538538
becoming_feature = None;
539539
if line.contains("rustc_const_unstable(") {
540540
// `const fn` features are handled specially.
541-
let feature_name = match find_attr_val(line, "feature") {
541+
let feature_name = match find_attr_val(line, "feature").or_else(|| {
542+
iter_lines.peek().and_then(|next| find_attr_val(next.1, "feature"))
543+
}) {
542544
Some(name) => name,
543545
None => err!("malformed stability attribute: missing `feature` key"),
544546
};

0 commit comments

Comments
 (0)