Skip to content

Commit

Permalink
Auto merge of rust-lang#42712 - frewsxcv:rollup, r=frewsxcv
Browse files Browse the repository at this point in the history
Rollup of 3 pull requests

- Successful merges: rust-lang#42660, rust-lang#42662, rust-lang#42705
- Failed merges:
  • Loading branch information
bors committed Jun 17, 2017
2 parents 08d920c + 6062bf7 commit ff9f2d2
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 45 deletions.
2 changes: 1 addition & 1 deletion src/doc/book
Submodule book updated 84 files
+1 −6 .travis.yml
+0 −50 ci/deploy.sh
+1 −1 first-edition/src/iterators.md
+5 −5 first-edition/src/procedural-macros.md
+3 −1 first-edition/src/the-stack-and-the-heap.md
+8 −10 redirects/README.md
+8 −10 redirects/SUMMARY.md
+9 −10 redirects/associated-types.md
+9 −10 redirects/attributes.md
+9 −10 redirects/bibliography.md
+9 −10 redirects/borrow-and-asref.md
+9 −10 redirects/casting-between-types.md
+9 −10 redirects/choosing-your-guarantees.md
+9 −10 redirects/closures.md
+9 −10 redirects/comments.md
+9 −10 redirects/concurrency.md
+9 −10 redirects/conditional-compilation.md
+9 −10 redirects/const-and-static.md
+9 −10 redirects/crates-and-modules.md
+9 −10 redirects/deref-coercions.md
+9 −10 redirects/documentation.md
+9 −10 redirects/drop.md
+9 −10 redirects/effective-rust.md
+9 −10 redirects/enums.md
+9 −10 redirects/error-handling.md
+9 −10 redirects/ffi.md
+9 −10 redirects/functions.md
+9 −10 redirects/generics.md
+9 −10 redirects/getting-started.md
+9 −10 redirects/glossary.md
+9 −10 redirects/guessing-game.md
+9 −10 redirects/if-let.md
+9 −10 redirects/if.md
+9 −10 redirects/iterators.md
+9 −10 redirects/lifetimes.md
+9 −10 redirects/loops.md
+9 −10 redirects/macros.md
+9 −10 redirects/match.md
+9 −10 redirects/method-syntax.md
+9 −10 redirects/mutability.md
+9 −10 redirects/operators-and-overloading.md
+9 −10 redirects/ownership.md
+9 −10 redirects/patterns.md
+9 −10 redirects/primitive-types.md
+9 −10 redirects/procedural-macros.md
+9 −10 redirects/raw-pointers.md
+9 −10 redirects/references-and-borrowing.md
+9 −10 redirects/release-channels.md
+9 −10 redirects/strings.md
+9 −10 redirects/structs.md
+9 −10 redirects/syntax-and-semantics.md
+9 −10 redirects/syntax-index.md
+9 −10 redirects/testing.md
+9 −10 redirects/the-stack-and-the-heap.md
+9 −10 redirects/trait-objects.md
+9 −10 redirects/traits.md
+9 −10 redirects/type-aliases.md
+9 −10 redirects/ufcs.md
+9 −10 redirects/unsafe.md
+9 −10 redirects/unsized-types.md
+9 −10 redirects/using-rust-without-the-standard-library.md
+9 −10 redirects/variable-bindings.md
+9 −10 redirects/vectors.md
+4 −1 second-edition/dictionary.txt
+1 −1 second-edition/nostarch/chapter05.md
+371 −389 second-edition/nostarch/chapter07.md
+ second-edition/nostarch/odt/chapter05.docx
+ second-edition/nostarch/odt/chapter07.docx
+25 −1 second-edition/src/appendix-07-newest-features.md
+10 −1 second-edition/src/ch01-02-hello-world.md
+2 −2 second-edition/src/ch03-01-variables-and-mutability.md
+1 −1 second-edition/src/ch03-02-data-types.md
+1 −1 second-edition/src/ch05-01-defining-structs.md
+15 −15 second-edition/src/ch07-00-modules.md
+145 −133 second-edition/src/ch07-01-mod-and-the-filesystem.md
+79 −76 second-edition/src/ch07-02-controlling-visibility-with-pub.md
+52 −48 second-edition/src/ch07-03-importing-names-with-use.md
+5 −13 second-edition/src/ch12-03-improving-error-handling-and-modularity.md
+7 −9 second-edition/src/ch12-05-working-with-environment-variables.md
+2 −2 second-edition/src/ch12-06-writing-to-stderr-instead-of-stdout.md
+2 −2 second-edition/src/ch14-02-publishing-to-crates-io.md
+8 −6 second-edition/src/ch19-01-unsafe-rust.md
+3 −2 second-edition/src/ch19-03-advanced-traits.md
+2 −5 second-edition/tools/docx-to-md.xsl
4 changes: 2 additions & 2 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ impl Rc<str> {
#[doc(hidden)]
#[unstable(feature = "rustc_private",
reason = "for internal use in rustc",
issue = "0")]
issue = "27812")]
pub fn __from_str(value: &str) -> Rc<str> {
unsafe {
// Allocate enough space for `RcBox<str>`.
Expand All @@ -453,7 +453,7 @@ impl<T> Rc<[T]> {
#[doc(hidden)]
#[unstable(feature = "rustc_private",
reason = "for internal use in rustc",
issue = "0")]
issue = "27812")]
pub fn __from_array(value: Box<[T]>) -> Rc<[T]> {
unsafe {
let ptr: *mut RcBox<[T]> =
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ use mem;
#[allow(deprecated)]
pub use self::sip::SipHasher;

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

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2085,7 +2085,7 @@ pub trait StrExt {
fn is_char_boundary(&self, index: usize) -> bool;
#[stable(feature = "core", since = "1.6.0")]
fn as_bytes(&self) -> &[u8];
#[unstable(feature = "str_mut_extras", issue = "0")]
#[unstable(feature = "str_mut_extras", issue = "41119")]
unsafe fn as_bytes_mut(&mut self) -> &mut [u8];
#[stable(feature = "core", since = "1.6.0")]
fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize>;
Expand Down
2 changes: 1 addition & 1 deletion src/libfmt_macros/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#![deny(warnings)]

#![cfg_attr(stage0, feature(staged_api))]
#![feature(unicode)]
#![feature(rustc_private)]

pub use self::Piece::*;
pub use self::Position::*;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,4 @@ yet, that's what we're trying to find! In our code, we opt to unify

We make use of a trait-like implementation strategy to consolidate
duplicated code between subtypes, GLB, and LUB computations. See the
section on "Type Combining" below for details.
section on "Type Combining" in combine.rs for more details.
1 change: 0 additions & 1 deletion src/librustc_trans/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(slice_patterns)]
#![feature(unicode)]
#![feature(conservative_impl_trait)]
#![feature(command_envs)]

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ pub mod rt;
// but it may be stabilized long-term. As a result we're exposing a hidden,
// unstable module so we can get our build working.
#[doc(hidden)]
#[unstable(feature = "rand", issue = "0")]
#[unstable(feature = "rand", issue = "27703")]
pub mod __rand {
pub use rand::{thread_rng, ThreadRng, Rng};
}
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/rand/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
//! between the two sources. (Also note that, on some systems e.g. FreeBSD, both `/dev/random`
//! and `/dev/urandom` may block once if the CSPRNG has not seeded yet.)
#![unstable(feature = "rand", issue = "0")]
#![unstable(feature = "rand", issue = "27703")]

use cell::RefCell;
use fmt;
Expand Down
8 changes: 4 additions & 4 deletions src/libstd_unicode/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,9 +599,9 @@ impl char {
/// 'XID_Start' is a Unicode Derived Property specified in
/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
/// mostly similar to `ID_Start` but modified for closure under `NFKx`.
#[unstable(feature = "unicode",
#[unstable(feature = "rustc_private",
reason = "mainly needed for compiler internals",
issue = "0")]
issue = "27812")]
#[inline]
pub fn is_xid_start(self) -> bool {
derived_property::XID_Start(self)
Expand All @@ -613,9 +613,9 @@ impl char {
/// 'XID_Continue' is a Unicode Derived Property specified in
/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
/// mostly similar to 'ID_Continue' but modified for closure under NFKx.
#[unstable(feature = "unicode",
#[unstable(feature = "rustc_private",
reason = "mainly needed for compiler internals",
issue = "0")]
issue = "27812")]
#[inline]
pub fn is_xid_continue(self) -> bool {
derived_property::XID_Continue(self)
Expand Down
93 changes: 65 additions & 28 deletions src/tools/tidy/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn check(path: &Path, bad: &mut bool, quiet: bool) {
let mut features = collect_lang_features(path);
assert!(!features.is_empty());

let lib_features = collect_lib_features(path, bad, &features);
let lib_features = get_and_check_lib_features(path, bad, &features);
assert!(!lib_features.is_empty());

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

pub fn collect_lib_features(base_src_path: &Path,
bad: &mut bool,
features: &Features) -> Features {
pub fn collect_lib_features(base_src_path: &Path) -> Features {
let mut lib_features = Features::new();
map_lib_features(base_src_path,
&mut |res, _, _| {
match res {
Ok((name, feature)) => {
if lib_features.get(name).is_some() {
return;
}
lib_features.insert(name.to_owned(), feature);
},
Err(_) => (),
}
});
lib_features
}

fn get_and_check_lib_features(base_src_path: &Path,
bad: &mut bool,
lang_features: &Features) -> Features {
let mut lib_features = Features::new();
map_lib_features(base_src_path,
&mut |res, file, line| {
match res {
Ok((name, f)) => {
let mut err = |msg: &str| {
tidy_error!(bad, "{}:{}: {}", file.display(), line, msg);
};
if lang_features.contains_key(name) {
err("duplicating a lang feature");
}
if let Some(ref s) = lib_features.get(name) {
if s.level != f.level {
err("different stability level than before");
}
if s.since != f.since {
err("different `since` than before");
}
if s.tracking_issue != f.tracking_issue {
err("different `tracking_issue` than before");
}
}
lib_features.insert(name.to_owned(), f);
},
Err(msg) => {
tidy_error!(bad, "{}:{}: {}", file.display(), line, msg);
},
}

});
lib_features
}

fn map_lib_features(base_src_path: &Path,
mf: &mut FnMut(Result<(&str, Feature), &str>, &Path, usize)) {
let mut contents = String::new();
super::walk(base_src_path,
&mut |path| super::filter_dirs(path) || path.ends_with("src/test"),
Expand All @@ -236,16 +287,19 @@ pub fn collect_lib_features(base_src_path: &Path,

let mut becoming_feature: Option<(String, Feature)> = None;
for (i, line) in contents.lines().enumerate() {
let mut err = |msg: &str| {
tidy_error!(bad, "{}:{}: {}", file.display(), i + 1, msg);
macro_rules! err {
($msg:expr) => {{
mf(Err($msg), file, i + 1);
continue;
}};
};
if let Some((ref name, ref mut f)) = becoming_feature {
if f.tracking_issue.is_none() {
f.tracking_issue = find_attr_val(line, "issue")
.map(|s| s.parse().unwrap());
}
if line.ends_with("]") {
lib_features.insert(name.to_owned(), f.clone());
mf(Ok((name, f.clone())), file, i + 1);
} else if !line.ends_with(",") && !line.ends_with("\\") {
// We need to bail here because we might have missed the
// end of a stability attribute above because the "]"
Expand All @@ -254,7 +308,7 @@ pub fn collect_lib_features(base_src_path: &Path,
// we continue parsing the file assuming the current stability
// attribute has not ended, and ignoring possible feature
// attributes in the process.
err("malformed stability attribute");
err!("malformed stability attribute");
} else {
continue;
}
Expand All @@ -269,45 +323,28 @@ pub fn collect_lib_features(base_src_path: &Path,
};
let feature_name = match find_attr_val(line, "feature") {
Some(name) => name,
None => {
err("malformed stability attribute");
continue;
}
None => err!("malformed stability attribute"),
};
let since = match find_attr_val(line, "since") {
Some(name) => name,
None if level == Status::Stable => {
err("malformed stability attribute");
continue;
err!("malformed stability attribute");
}
None => "None",
};
let tracking_issue = find_attr_val(line, "issue").map(|s| s.parse().unwrap());

if features.contains_key(feature_name) {
err("duplicating a lang feature");
}
if let Some(ref s) = lib_features.get(feature_name) {
if s.level != level {
err("different stability level than before");
}
if s.since != since {
err("different `since` than before");
}
continue;
}
let feature = Feature {
level,
since: since.to_owned(),
has_gate_test: false,
tracking_issue,
};
if line.contains("]") {
lib_features.insert(feature_name.to_owned(), feature);
mf(Ok((feature_name, feature)), file, i + 1);
} else {
becoming_feature = Some((feature_name.to_owned(), feature));
}
}
});
lib_features
}
2 changes: 1 addition & 1 deletion src/tools/tidy/src/unstable_book.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub fn check(path: &path::Path, bad: &mut bool) {
// Library features

let lang_features = collect_lang_features(path);
let lib_features = collect_lib_features(path, bad, &lang_features);
let lib_features = collect_lib_features(path);

let unstable_lib_feature_names = collect_unstable_feature_names(&lib_features);
let unstable_book_lib_features_section_file_names =
Expand Down
3 changes: 1 addition & 2 deletions src/tools/unstable-book-gen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ fn main() {
let dest_path = Path::new(&dest_path_str).join("src");

let lang_features = collect_lang_features(src_path);
let mut bad = false;
let lib_features = collect_lib_features(src_path, &mut bad, &lang_features);
let lib_features = collect_lib_features(src_path);

let doc_src_path = src_path.join(PATH_STR);

Expand Down

0 comments on commit ff9f2d2

Please sign in to comment.