Skip to content

Commit ff9f2d2

Browse files
committed
Auto merge of #42712 - frewsxcv:rollup, r=frewsxcv
Rollup of 3 pull requests - Successful merges: #42660, #42662, #42705 - Failed merges:
2 parents 08d920c + 6062bf7 commit ff9f2d2

File tree

13 files changed

+80
-45
lines changed

13 files changed

+80
-45
lines changed

src/doc/book

Submodule book updated 84 files

src/liballoc/rc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ impl Rc<str> {
428428
#[doc(hidden)]
429429
#[unstable(feature = "rustc_private",
430430
reason = "for internal use in rustc",
431-
issue = "0")]
431+
issue = "27812")]
432432
pub fn __from_str(value: &str) -> Rc<str> {
433433
unsafe {
434434
// Allocate enough space for `RcBox<str>`.
@@ -453,7 +453,7 @@ impl<T> Rc<[T]> {
453453
#[doc(hidden)]
454454
#[unstable(feature = "rustc_private",
455455
reason = "for internal use in rustc",
456-
issue = "0")]
456+
issue = "27812")]
457457
pub fn __from_array(value: Box<[T]>) -> Rc<[T]> {
458458
unsafe {
459459
let ptr: *mut RcBox<[T]> =

src/libcore/hash/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ use mem;
9999
#[allow(deprecated)]
100100
pub use self::sip::SipHasher;
101101

102-
#[unstable(feature = "sip_hash_13", issue = "29754")]
102+
#[unstable(feature = "sip_hash_13", issue = "34767")]
103103
#[allow(deprecated)]
104104
pub use self::sip::{SipHasher13, SipHasher24};
105105

src/libcore/str/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2085,7 +2085,7 @@ pub trait StrExt {
20852085
fn is_char_boundary(&self, index: usize) -> bool;
20862086
#[stable(feature = "core", since = "1.6.0")]
20872087
fn as_bytes(&self) -> &[u8];
2088-
#[unstable(feature = "str_mut_extras", issue = "0")]
2088+
#[unstable(feature = "str_mut_extras", issue = "41119")]
20892089
unsafe fn as_bytes_mut(&mut self) -> &mut [u8];
20902090
#[stable(feature = "core", since = "1.6.0")]
20912091
fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize>;

src/libfmt_macros/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#![deny(warnings)]
2727

2828
#![cfg_attr(stage0, feature(staged_api))]
29-
#![feature(unicode)]
29+
#![feature(rustc_private)]
3030

3131
pub use self::Piece::*;
3232
pub use self::Position::*;

src/librustc/infer/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,4 +236,4 @@ yet, that's what we're trying to find! In our code, we opt to unify
236236

237237
We make use of a trait-like implementation strategy to consolidate
238238
duplicated code between subtypes, GLB, and LUB computations. See the
239-
section on "Type Combining" below for details.
239+
section on "Type Combining" in combine.rs for more details.

src/librustc_trans/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#![feature(quote)]
3434
#![feature(rustc_diagnostic_macros)]
3535
#![feature(slice_patterns)]
36-
#![feature(unicode)]
3736
#![feature(conservative_impl_trait)]
3837
#![feature(command_envs)]
3938

src/libstd/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ pub mod rt;
484484
// but it may be stabilized long-term. As a result we're exposing a hidden,
485485
// unstable module so we can get our build working.
486486
#[doc(hidden)]
487-
#[unstable(feature = "rand", issue = "0")]
487+
#[unstable(feature = "rand", issue = "27703")]
488488
pub mod __rand {
489489
pub use rand::{thread_rng, ThreadRng, Rng};
490490
}

src/libstd/rand/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
//! between the two sources. (Also note that, on some systems e.g. FreeBSD, both `/dev/random`
5757
//! and `/dev/urandom` may block once if the CSPRNG has not seeded yet.)
5858
59-
#![unstable(feature = "rand", issue = "0")]
59+
#![unstable(feature = "rand", issue = "27703")]
6060

6161
use cell::RefCell;
6262
use fmt;

src/libstd_unicode/char.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,9 @@ impl char {
599599
/// 'XID_Start' is a Unicode Derived Property specified in
600600
/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
601601
/// mostly similar to `ID_Start` but modified for closure under `NFKx`.
602-
#[unstable(feature = "unicode",
602+
#[unstable(feature = "rustc_private",
603603
reason = "mainly needed for compiler internals",
604-
issue = "0")]
604+
issue = "27812")]
605605
#[inline]
606606
pub fn is_xid_start(self) -> bool {
607607
derived_property::XID_Start(self)
@@ -613,9 +613,9 @@ impl char {
613613
/// 'XID_Continue' is a Unicode Derived Property specified in
614614
/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
615615
/// mostly similar to 'ID_Continue' but modified for closure under NFKx.
616-
#[unstable(feature = "unicode",
616+
#[unstable(feature = "rustc_private",
617617
reason = "mainly needed for compiler internals",
618-
issue = "0")]
618+
issue = "27812")]
619619
#[inline]
620620
pub fn is_xid_continue(self) -> bool {
621621
derived_property::XID_Continue(self)

src/tools/tidy/src/features.rs

+65-28
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub fn check(path: &Path, bad: &mut bool, quiet: bool) {
5656
let mut features = collect_lang_features(path);
5757
assert!(!features.is_empty());
5858

59-
let lib_features = collect_lib_features(path, bad, &features);
59+
let lib_features = get_and_check_lib_features(path, bad, &features);
6060
assert!(!lib_features.is_empty());
6161

6262
let mut contents = String::new();
@@ -217,10 +217,61 @@ pub fn collect_lang_features(base_src_path: &Path) -> Features {
217217
.collect()
218218
}
219219

220-
pub fn collect_lib_features(base_src_path: &Path,
221-
bad: &mut bool,
222-
features: &Features) -> Features {
220+
pub fn collect_lib_features(base_src_path: &Path) -> Features {
223221
let mut lib_features = Features::new();
222+
map_lib_features(base_src_path,
223+
&mut |res, _, _| {
224+
match res {
225+
Ok((name, feature)) => {
226+
if lib_features.get(name).is_some() {
227+
return;
228+
}
229+
lib_features.insert(name.to_owned(), feature);
230+
},
231+
Err(_) => (),
232+
}
233+
});
234+
lib_features
235+
}
236+
237+
fn get_and_check_lib_features(base_src_path: &Path,
238+
bad: &mut bool,
239+
lang_features: &Features) -> Features {
240+
let mut lib_features = Features::new();
241+
map_lib_features(base_src_path,
242+
&mut |res, file, line| {
243+
match res {
244+
Ok((name, f)) => {
245+
let mut err = |msg: &str| {
246+
tidy_error!(bad, "{}:{}: {}", file.display(), line, msg);
247+
};
248+
if lang_features.contains_key(name) {
249+
err("duplicating a lang feature");
250+
}
251+
if let Some(ref s) = lib_features.get(name) {
252+
if s.level != f.level {
253+
err("different stability level than before");
254+
}
255+
if s.since != f.since {
256+
err("different `since` than before");
257+
}
258+
if s.tracking_issue != f.tracking_issue {
259+
err("different `tracking_issue` than before");
260+
}
261+
}
262+
lib_features.insert(name.to_owned(), f);
263+
},
264+
Err(msg) => {
265+
tidy_error!(bad, "{}:{}: {}", file.display(), line, msg);
266+
},
267+
}
268+
269+
});
270+
lib_features
271+
}
272+
273+
fn map_lib_features(base_src_path: &Path,
274+
mf: &mut FnMut(Result<(&str, Feature), &str>, &Path, usize)) {
224275
let mut contents = String::new();
225276
super::walk(base_src_path,
226277
&mut |path| super::filter_dirs(path) || path.ends_with("src/test"),
@@ -236,16 +287,19 @@ pub fn collect_lib_features(base_src_path: &Path,
236287

237288
let mut becoming_feature: Option<(String, Feature)> = None;
238289
for (i, line) in contents.lines().enumerate() {
239-
let mut err = |msg: &str| {
240-
tidy_error!(bad, "{}:{}: {}", file.display(), i + 1, msg);
290+
macro_rules! err {
291+
($msg:expr) => {{
292+
mf(Err($msg), file, i + 1);
293+
continue;
294+
}};
241295
};
242296
if let Some((ref name, ref mut f)) = becoming_feature {
243297
if f.tracking_issue.is_none() {
244298
f.tracking_issue = find_attr_val(line, "issue")
245299
.map(|s| s.parse().unwrap());
246300
}
247301
if line.ends_with("]") {
248-
lib_features.insert(name.to_owned(), f.clone());
302+
mf(Ok((name, f.clone())), file, i + 1);
249303
} else if !line.ends_with(",") && !line.ends_with("\\") {
250304
// We need to bail here because we might have missed the
251305
// end of a stability attribute above because the "]"
@@ -254,7 +308,7 @@ pub fn collect_lib_features(base_src_path: &Path,
254308
// we continue parsing the file assuming the current stability
255309
// attribute has not ended, and ignoring possible feature
256310
// attributes in the process.
257-
err("malformed stability attribute");
311+
err!("malformed stability attribute");
258312
} else {
259313
continue;
260314
}
@@ -269,45 +323,28 @@ pub fn collect_lib_features(base_src_path: &Path,
269323
};
270324
let feature_name = match find_attr_val(line, "feature") {
271325
Some(name) => name,
272-
None => {
273-
err("malformed stability attribute");
274-
continue;
275-
}
326+
None => err!("malformed stability attribute"),
276327
};
277328
let since = match find_attr_val(line, "since") {
278329
Some(name) => name,
279330
None if level == Status::Stable => {
280-
err("malformed stability attribute");
281-
continue;
331+
err!("malformed stability attribute");
282332
}
283333
None => "None",
284334
};
285335
let tracking_issue = find_attr_val(line, "issue").map(|s| s.parse().unwrap());
286336

287-
if features.contains_key(feature_name) {
288-
err("duplicating a lang feature");
289-
}
290-
if let Some(ref s) = lib_features.get(feature_name) {
291-
if s.level != level {
292-
err("different stability level than before");
293-
}
294-
if s.since != since {
295-
err("different `since` than before");
296-
}
297-
continue;
298-
}
299337
let feature = Feature {
300338
level,
301339
since: since.to_owned(),
302340
has_gate_test: false,
303341
tracking_issue,
304342
};
305343
if line.contains("]") {
306-
lib_features.insert(feature_name.to_owned(), feature);
344+
mf(Ok((feature_name, feature)), file, i + 1);
307345
} else {
308346
becoming_feature = Some((feature_name.to_owned(), feature));
309347
}
310348
}
311349
});
312-
lib_features
313350
}

src/tools/tidy/src/unstable_book.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub fn check(path: &path::Path, bad: &mut bool) {
8787
// Library features
8888

8989
let lang_features = collect_lang_features(path);
90-
let lib_features = collect_lib_features(path, bad, &lang_features);
90+
let lib_features = collect_lib_features(path);
9191

9292
let unstable_lib_feature_names = collect_unstable_feature_names(&lib_features);
9393
let unstable_book_lib_features_section_file_names =

src/tools/unstable-book-gen/src/main.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ fn main() {
129129
let dest_path = Path::new(&dest_path_str).join("src");
130130

131131
let lang_features = collect_lang_features(src_path);
132-
let mut bad = false;
133-
let lib_features = collect_lib_features(src_path, &mut bad, &lang_features);
132+
let lib_features = collect_lib_features(src_path);
134133

135134
let doc_src_path = src_path.join(PATH_STR);
136135

0 commit comments

Comments
 (0)