diff --git a/src/Cargo.lock b/src/Cargo.lock index 23ec918a8657d..1393dd46d6bd6 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -928,6 +928,11 @@ dependencies = [ "xz2 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "is-match" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "itertools" version = "0.6.5" @@ -936,6 +941,14 @@ dependencies = [ "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "itertools" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "itoa" version = "0.3.4" @@ -1129,23 +1142,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "mdbook" -version = "0.0.28" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "handlebars 0.29.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "open 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "toml-query 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1695,7 +1713,7 @@ name = "rustbook" version = "0.1.0" dependencies = [ "clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)", - "mdbook 0.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "mdbook 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2379,6 +2397,11 @@ name = "shell-escape" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "shlex" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "siphasher" version = "0.2.2" @@ -2702,6 +2725,18 @@ dependencies = [ "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "toml-query" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "is-match 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "unicode-bidi" version = "0.3.4" @@ -2992,7 +3027,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d" "checksum if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "61bb90bdd39e3af69b0172dfc6130f6cd6332bf040fbb9bdd4401d37adbd48b8" "checksum ignore 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bb2f0238094bd1b41800fb6eb9b16fdd5e9832ed6053ed91409f0cd5bf28dcfd" +"checksum is-match 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7e5b386aef33a1c677be65237cb9d32c3f3ef56bd035949710c4bb13083eb053" "checksum itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d3f2be4da1690a039e9ae5fd575f706a63ad5a2120f161b1d653c9da3930dd21" +"checksum itertools 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b07332223953b5051bceb67e8c4700aa65291535568e1f12408c43c4a42c0394" "checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" "checksum jobserver 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "565f6106bd87b394398f813bea4e5ecad6d6b0f6aa077592d088f882a506481d" "checksum json 0.11.12 (registry+https://github.com/rust-lang/crates.io-index)" = "39ebf0fac977ee3a4a3242b6446004ff64514889e3e2730bbd4f764a67a2e483" @@ -3014,7 +3051,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" "checksum markup5ever 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "047150a0e03b57e638fc45af33a0b63a0362305d5b9f92ecef81df472a4cceb0" "checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" -"checksum mdbook 0.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "1ee8ba20c002000546681dc78d7f7e91fd35832058b1e2fdd492ca842bb6e9be" +"checksum mdbook 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fef236caad7ba3b5b3944df946f19ab3e190bca53c111dd00fe05fa8d879f2fd" "checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" "checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d" "checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4" @@ -3094,6 +3131,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum serde_json 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c9db7266c7d63a4c4b7fe8719656ccdd51acf1bed6124b174f933b009fb10bcb" "checksum shared_child 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "099b38928dbe4a0a01fcd8c233183072f14a7d126a34bed05880869be66e14cc" "checksum shell-escape 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "dd5cc96481d54583947bfe88bf30c23d53f883c6cd0145368b69989d97b84ef8" +"checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" "checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537" "checksum smallvec 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4f8266519bc1d17d0b5b16f6c21295625d562841c708f6376f49028a43e9c11e" "checksum smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44db0ecb22921ef790d17ae13a3f6d15784183ff5f2a01aa32098c7498d2b4b9" @@ -3122,6 +3160,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "a15375f1df02096fb3317256ce2cee6a1f42fc84ea5ad5fc8c421cfe40c73098" "checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" "checksum toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7540f4ffc193e0d3c94121edb19b055670d369f77d5804db11ae053a45b6e7e" +"checksum toml-query 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6854664bfc6df0360c695480836ee90e2d0c965f06db291d10be9344792d43e8" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "51ccda9ef9efa3f7ef5d91e8f9b83bbe6955f9bf86aec89d5cce2c874625920f" "checksum unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8083c594e02b8ae1654ae26f0ade5158b119bd88ad0e8227a5d8fcd72407946" diff --git a/src/doc/book b/src/doc/book index 194eb8d5f1753..a645960fe4894 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit 194eb8d5f1753fb5f4501011cebdc1b585712474 +Subproject commit a645960fe48946153936dd5628df4a90bd837981 diff --git a/src/doc/reference b/src/doc/reference index 1d791b55b23ec..e6a5d5d10aa2f 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 1d791b55b23ec5389fbd5b3cee80db3f8bbdd162 +Subproject commit e6a5d5d10aa2fde0baed7b29bf672bd9f3af8962 diff --git a/src/doc/unstable-book/src/language-features/use-nested-groups.md b/src/doc/unstable-book/src/language-features/use-nested-groups.md deleted file mode 100644 index 47b635bad736f..0000000000000 --- a/src/doc/unstable-book/src/language-features/use-nested-groups.md +++ /dev/null @@ -1,90 +0,0 @@ -# `use_nested_groups` - -The tracking issue for this feature is: [#44494] - -[#44494]: https://github.com/rust-lang/rust/issues/44494 - ------------------------- - -The `use_nested_groups` feature allows you to import multiple items from a -complex module tree easily, by nesting different imports in the same -declaration. For example: - -```rust -#![feature(use_nested_groups)] -# #![allow(unused_imports, dead_code)] -# -# mod foo { -# pub mod bar { -# pub type Foo = (); -# } -# pub mod baz { -# pub mod quux { -# pub type Bar = (); -# } -# } -# } - -use foo::{ - bar::{self, Foo}, - baz::{*, quux::Bar}, -}; -# -# fn main() {} -``` - -## Snippet for the book's new features appendix - -When stabilizing, add this to -`src/doc/book/second-edition/src/appendix-07-newest-features.md`: - -### Nested groups in `use` declarations - -If you have a complex module tree with many different submodules and you need -to import a few items from each one, it might be useful to group all the -imports in the same declaration to keep your code clean and avoid repeating the -base modules' name. - -The `use` declaration supports nesting to help you in those cases, both with -simple imports and glob ones. For example this snippets imports `bar`, `Foo`, -all the items in `baz` and `Bar`: - -```rust -# #![feature(use_nested_groups)] -# #![allow(unused_imports, dead_code)] -# -# mod foo { -# pub mod bar { -# pub type Foo = (); -# } -# pub mod baz { -# pub mod quux { -# pub type Bar = (); -# } -# } -# } -# -use foo::{ - bar::{self, Foo}, - baz::{*, quux::Bar}, -}; -# -# fn main() {} -``` - -## Updated reference - -When stabilizing, replace the shortcut list in -`src/doc/reference/src/items/use-declarations.md` with this updated one: - -* Simultaneously binding a list of paths with a common prefix, using the - glob-like brace syntax `use a::b::{c, d, e::f, g::h::i};` -* Simultaneously binding a list of paths with a common prefix and their common - parent module, using the `self` keyword, such as `use a::b::{self, c, d::e};` -* Rebinding the target name as a new local name, using the syntax `use p::q::r - as x;`. This can also be used with the last two features: - `use a::b::{self as ab, c as abc}`. -* Binding all paths matching a given prefix, using the asterisk wildcard syntax - `use a::b::*;`. -* Nesting groups of the previous features multiple times, such as - `use a::b::{self as ab, c d::{*, e::f}};` diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index e815d72d36646..d3a83dc795c85 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -141,9 +141,9 @@ pub trait AsRef { /// /// # Generic Implementations /// -/// - `AsMut` auto-dereferences if the inner type is a reference or a mutable -/// reference (e.g.: `foo.as_ref()` will work the same if `foo` has type -/// `&mut Foo` or `&&mut Foo`) +/// - `AsMut` auto-dereferences if the inner type is a mutable reference +/// (e.g.: `foo.as_mut()` will work the same if `foo` has type `&mut Foo` +/// or `&mut &mut Foo`) /// /// # Examples /// diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index 929d5e7ec62bb..ed937046e5ed7 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -1042,11 +1042,20 @@ pub fn check_ast_crate(sess: &Session, krate: &ast::Crate) { // Put the lint store levels and passes back in the session. cx.lint_sess.restore(&sess.lint_store); - // Emit all buffered lints from early on in the session now that we've - // calculated the lint levels for all AST nodes. - for (_id, lints) in cx.buffered.map { - for early_lint in lints { - span_bug!(early_lint.span, "failed to process buffered lint here"); + // All of the buffered lints should have been emitted at this point. + // If not, that means that we somehow buffered a lint for a node id + // that was not lint-checked (perhaps it doesn't exist?). This is a bug. + // + // Rustdoc runs everybody-loops before the early lints and removes + // function bodies, so it's totally possible for linted + // node ids to not exist (e.g. macros defined within functions for the + // unused_macro lint) anymore. So we only run this check + // when we're not in rustdoc mode. (see issue #47639) + if !sess.opts.actually_rustdoc { + for (_id, lints) in cx.buffered.map { + for early_lint in lints { + span_bug!(early_lint.span, "failed to process buffered lint here"); + } } } } diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 84ca2a9318ab3..738c0d82ee1b5 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -1068,22 +1068,12 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { }; match cause { - mc::AliasableStatic => { - // This happens when we have an `&mut` or assignment to a - // static. We should have already reported a mutability - // violation first, but may have continued compiling. - self.tcx.sess.delay_span_bug( - span, - &format!("aliasability violation for static `{}`", prefix) - ); - return; - } mc::AliasableStaticMut => { // This path cannot occur. `static mut X` is not checked // for aliasability violations. span_bug!(span, "aliasability violation for static mut `{}`", prefix) } - mc::AliasableBorrowed => {} + mc::AliasableStatic | mc::AliasableBorrowed => {} }; let blame = cmt.immutability_blame(); let mut err = match blame { diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 2e494fdfad8b8..841350bdb68e1 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -791,7 +791,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { field_ref: &ast::Field, variant: &ty::VariantDef, ) -> Option { - let f = variant.field_named(field_ref.ident.node.name); + let f = variant.find_field_named(field_ref.ident.node.name)?; // We don't really need a sub-span here, but no harm done let sub_span = self.span_utils.span_for_last_ident(field_ref.ident.span); filter!(self.span_utils, sub_span, field_ref.ident.span, None); @@ -870,6 +870,17 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { result.push_str(&val.as_str()); } result.push('\n'); + } else if let Some(meta_list) = attr.meta_item_list() { + meta_list.into_iter() + .filter(|it| it.check_name("include")) + .filter_map(|it| it.meta_item_list().map(|l| l.to_owned())) + .flat_map(|it| it) + .filter(|meta| meta.check_name("contents")) + .filter_map(|meta| meta.value_str()) + .for_each(|val| { + result.push_str(&val.as_str()); + result.push('\n'); + }); } } } diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index a19fe825f21fa..e91d3a32a50cd 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -1026,9 +1026,9 @@ impl CStr { /// The returned slice will **not** contain the trailing nul terminator that this C /// string has. /// - /// > **Note**: This method is currently implemented as a 0-cost cast, but - /// > it is planned to alter its definition in the future to perform the - /// > length calculation whenever this method is called. + /// > **Note**: This method is currently implemented as a constant-time + /// > cast, but it is planned to alter its definition in the future to + /// > perform the length calculation whenever this method is called. /// /// # Examples /// @@ -1077,9 +1077,9 @@ impl CStr { /// it will return an error with details of where UTF-8 validation failed. /// /// > **Note**: This method is currently implemented to check for validity - /// > after a 0-cost cast, but it is planned to alter its definition in the - /// > future to perform the length calculation in addition to the UTF-8 - /// > check whenever this method is called. + /// > after a constant-time cast, but it is planned to alter its definition + /// > in the future to perform the length calculation in addition to the + /// > UTF-8 check whenever this method is called. /// /// [`&str`]: ../primitive.str.html /// @@ -1110,9 +1110,9 @@ impl CStr { /// with the result. /// /// > **Note**: This method is currently implemented to check for validity - /// > after a 0-cost cast, but it is planned to alter its definition in the - /// > future to perform the length calculation in addition to the UTF-8 - /// > check whenever this method is called. + /// > after a constant-time cast, but it is planned to alter its definition + /// > in the future to perform the length calculation in addition to the + /// > UTF-8 check whenever this method is called. /// /// [`Cow`]: ../borrow/enum.Cow.html /// [`Borrowed`]: ../borrow/enum.Cow.html#variant.Borrowed diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 3e858c3b923a1..9c6520cd874a8 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -423,9 +423,6 @@ declare_features! ( // In-band lifetime bindings (e.g. `fn foo(x: &'a u8) -> &'a u8`) (active, in_band_lifetimes, "1.23.0", Some(44524)), - // Nested groups in `use` (RFC 2128) - (active, use_nested_groups, "1.23.0", Some(44494)), - // generic associated types (RFC 1598) (active, generic_associated_types, "1.23.0", Some(44265)), @@ -544,6 +541,8 @@ declare_features! ( (accepted, repr_align, "1.24.0", Some(33626)), // allow '|' at beginning of match arms (RFC 1925) (accepted, match_beginning_vert, "1.25.0", Some(44101)), + // Nested groups in `use` (RFC 2128) + (accepted, use_nested_groups, "1.25.0", Some(44494)), ); // If you change this, please modify src/doc/unstable-book as well. You must @@ -1805,29 +1804,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { visit::walk_path(self, path); } - fn visit_use_tree(&mut self, use_tree: &'a ast::UseTree, id: NodeId, nested: bool) { - if nested { - match use_tree.kind { - ast::UseTreeKind::Simple(_) => { - if use_tree.prefix.segments.len() != 1 { - gate_feature_post!(&self, use_nested_groups, use_tree.span, - "paths in `use` groups are experimental"); - } - } - ast::UseTreeKind::Glob => { - gate_feature_post!(&self, use_nested_groups, use_tree.span, - "glob imports in `use` groups are experimental"); - } - ast::UseTreeKind::Nested(_) => { - gate_feature_post!(&self, use_nested_groups, use_tree.span, - "nested groups in `use` are experimental"); - } - } - } - - visit::walk_use_tree(self, use_tree, id); - } - fn visit_vis(&mut self, vis: &'a ast::Visibility) { if let ast::Visibility::Crate(span, ast::CrateSugar::JustCrate) = *vis { gate_feature_post!(&self, crate_visibility_modifier, span, diff --git a/src/libsyntax_ext/asm.rs b/src/libsyntax_ext/asm.rs index 3742fb8c804d7..d1de4dccd0043 100644 --- a/src/libsyntax_ext/asm.rs +++ b/src/libsyntax_ext/asm.rs @@ -239,6 +239,12 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, } } + // If there are no outputs, the inline assembly is executed just for its side effects, + // so ensure that it is volatile + if outputs.is_empty() { + volatile = true; + } + MacEager::expr(P(ast::Expr { id: ast::DUMMY_NODE_ID, node: ast::ExprKind::InlineAsm(P(ast::InlineAsm { diff --git a/src/test/ui/feature-gate-use_nested_groups.rs b/src/test/codegen/no-output-asm-is-volatile.rs similarity index 50% rename from src/test/ui/feature-gate-use_nested_groups.rs rename to src/test/codegen/no-output-asm-is-volatile.rs index 56413a999d7f7..457d706a8ffef 100644 --- a/src/test/ui/feature-gate-use_nested_groups.rs +++ b/src/test/codegen/no-output-asm-is-volatile.rs @@ -8,24 +8,19 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unused_imports, dead_code)] +// compile-flags: -O -mod a { - pub enum B {} - pub enum C {} +// ignore-asmjs - pub mod d { - pub enum E {} - pub enum F {} +#![feature(asm)] +#![crate_type = "lib"] - pub mod g { - pub enum H {} - } - } -} - -use a::{B, d::{*, g::H}}; //~ ERROR glob imports in `use` groups are experimental - //~^ ERROR nested groups in `use` are experimental - //~^^ ERROR paths in `use` groups are experimental +// Check that inline assembly expressions without any outputs +// are marked as having side effects / being volatile -fn main() {} +// CHECK-LABEL: @assembly +#[no_mangle] +pub fn assembly() { + unsafe { asm!("") } +// CHECK: tail call void asm sideeffect "", {{.*}} +} diff --git a/src/test/compile-fail/absolute-paths-in-nested-use-groups.rs b/src/test/compile-fail/absolute-paths-in-nested-use-groups.rs index 8e5ba489c565e..fe052f2f47ffd 100644 --- a/src/test/compile-fail/absolute-paths-in-nested-use-groups.rs +++ b/src/test/compile-fail/absolute-paths-in-nested-use-groups.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(use_nested_groups)] #![allow(unused_imports)] mod foo {} diff --git a/src/test/compile-fail/issue-42344.rs b/src/test/compile-fail/issue-42344.rs new file mode 100644 index 0000000000000..2f11ff402beed --- /dev/null +++ b/src/test/compile-fail/issue-42344.rs @@ -0,0 +1,17 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +static TAB: [&mut [u8]; 0] = []; + +pub unsafe fn test() { + TAB[0].iter_mut(); //~ ERROR cannot borrow data mutably in a `&` reference [E0389] +} + +pub fn main() {} diff --git a/src/test/compile-fail/issue-44415.rs b/src/test/compile-fail/issue-44415.rs new file mode 100644 index 0000000000000..3b7089f497526 --- /dev/null +++ b/src/test/compile-fail/issue-44415.rs @@ -0,0 +1,22 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(const_fn)] +#![feature(core_intrinsics)] + +use std::intrinsics; + +struct Foo { + bytes: [u8; unsafe { intrinsics::size_of::() }], + //~^ ERROR unsupported cyclic reference between types/traits detected + x: usize, +} + +fn main() {} diff --git a/src/test/compile-fail/issue-46604.rs b/src/test/compile-fail/issue-46604.rs index 06aa4c343fea3..dc14eca1e6734 100644 --- a/src/test/compile-fail/issue-46604.rs +++ b/src/test/compile-fail/issue-46604.rs @@ -17,5 +17,6 @@ fn write>(buffer: T) { } fn main() { write(&buf); - buf[0]=2; //[mir]~ ERROR E0594 + buf[0]=2; //[ast]~ ERROR E0389 + //[mir]~^ ERROR E0594 } diff --git a/src/test/run-make/save-analysis-fail/foo.rs b/src/test/run-make/save-analysis-fail/foo.rs index 8a1b579398946..07322d8bbc325 100644 --- a/src/test/run-make/save-analysis-fail/foo.rs +++ b/src/test/run-make/save-analysis-fail/foo.rs @@ -451,3 +451,11 @@ extern { static EXTERN_FOO: u8; fn extern_foo(a: u8, b: i32) -> String; } + +struct Rls699 { + f: u32, +} + +fn new(f: u32) -> Rls699 { + Rls699 { fs } +} diff --git a/src/test/run-make/save-analysis/extra-docs.md b/src/test/run-make/save-analysis/extra-docs.md new file mode 100644 index 0000000000000..0605ca517ff3b --- /dev/null +++ b/src/test/run-make/save-analysis/extra-docs.md @@ -0,0 +1 @@ +Extra docs for this struct. diff --git a/src/test/run-make/save-analysis/foo.rs b/src/test/run-make/save-analysis/foo.rs index 834a7554a555d..5b4e4802957af 100644 --- a/src/test/run-make/save-analysis/foo.rs +++ b/src/test/run-make/save-analysis/foo.rs @@ -12,6 +12,7 @@ #![feature(box_syntax)] #![feature(rustc_private)] #![feature(associated_type_defaults)] +#![feature(external_doc)] extern crate graphviz; // A simple rust project @@ -461,3 +462,6 @@ impl Iterator for SilenceGenerator { trait Foo { type Bar = FrameBuffer; } + +#[doc(include="extra-docs.md")] +struct StructWithDocs; diff --git a/src/test/run-pass/issue-47673.rs b/src/test/run-pass/issue-47673.rs index 92f54a44f63c9..22f7f169e2988 100644 --- a/src/test/run-pass/issue-47673.rs +++ b/src/test/run-pass/issue-47673.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(use_nested_groups)] #![allow(unused_import)] use {{}, {}}; diff --git a/src/test/run-pass/use-nested-groups.rs b/src/test/run-pass/use-nested-groups.rs index a28f8da9ff882..be06e463e3b37 100644 --- a/src/test/run-pass/use-nested-groups.rs +++ b/src/test/run-pass/use-nested-groups.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(use_nested_groups)] - mod a { pub enum B {} diff --git a/src/test/rustdoc/issue-47639.rs b/src/test/rustdoc/issue-47639.rs new file mode 100644 index 0000000000000..167c3aaec4ab6 --- /dev/null +++ b/src/test/rustdoc/issue-47639.rs @@ -0,0 +1,16 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// This should not ICE +pub fn test() { + macro_rules! foo { + () => () + } +} diff --git a/src/test/ui/feature-gate-use_nested_groups.stderr b/src/test/ui/feature-gate-use_nested_groups.stderr deleted file mode 100644 index 6ae691c384be8..0000000000000 --- a/src/test/ui/feature-gate-use_nested_groups.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error[E0658]: nested groups in `use` are experimental (see issue #44494) - --> $DIR/feature-gate-use_nested_groups.rs:27:12 - | -27 | use a::{B, d::{*, g::H}}; //~ ERROR glob imports in `use` groups are experimental - | ^^^^^^^^^^^^ - | - = help: add #![feature(use_nested_groups)] to the crate attributes to enable - -error[E0658]: glob imports in `use` groups are experimental (see issue #44494) - --> $DIR/feature-gate-use_nested_groups.rs:27:16 - | -27 | use a::{B, d::{*, g::H}}; //~ ERROR glob imports in `use` groups are experimental - | ^ - | - = help: add #![feature(use_nested_groups)] to the crate attributes to enable - -error[E0658]: paths in `use` groups are experimental (see issue #44494) - --> $DIR/feature-gate-use_nested_groups.rs:27:19 - | -27 | use a::{B, d::{*, g::H}}; //~ ERROR glob imports in `use` groups are experimental - | ^^^^ - | - = help: add #![feature(use_nested_groups)] to the crate attributes to enable - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/use-nested-groups-error.rs b/src/test/ui/use-nested-groups-error.rs index a9b6b3ee70d57..0a68d34ade9fa 100644 --- a/src/test/ui/use-nested-groups-error.rs +++ b/src/test/ui/use-nested-groups-error.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(use_nested_groups)] - mod a { pub mod b1 { pub enum C2 {} diff --git a/src/test/ui/use-nested-groups-error.stderr b/src/test/ui/use-nested-groups-error.stderr index cae34684c8e38..c4edb626be0bb 100644 --- a/src/test/ui/use-nested-groups-error.stderr +++ b/src/test/ui/use-nested-groups-error.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `a::b1::C1` - --> $DIR/use-nested-groups-error.rs:21:14 + --> $DIR/use-nested-groups-error.rs:19:14 | -21 | use a::{b1::{C1, C2}, B2}; +19 | use a::{b1::{C1, C2}, B2}; | ^^ no `C1` in `a::b1`. Did you mean to use `C2`? error: aborting due to previous error diff --git a/src/tools/rustbook/Cargo.toml b/src/tools/rustbook/Cargo.toml index bc35cbe9fbba6..539b434e9eca5 100644 --- a/src/tools/rustbook/Cargo.toml +++ b/src/tools/rustbook/Cargo.toml @@ -8,5 +8,5 @@ license = "MIT/Apache-2.0" clap = "2.25.0" [dependencies.mdbook] -version = "0.0.28" +version = "0.1.2" default-features = false diff --git a/src/tools/rustbook/src/main.rs b/src/tools/rustbook/src/main.rs index 50f4364e448f7..87a63a34cb642 100644 --- a/src/tools/rustbook/src/main.rs +++ b/src/tools/rustbook/src/main.rs @@ -13,7 +13,6 @@ extern crate mdbook; extern crate clap; use std::env; -use std::io::{self, Write}; use std::path::{Path, PathBuf}; use clap::{App, ArgMatches, SubCommand, AppSettings}; @@ -45,14 +44,19 @@ fn main() { }; if let Err(e) = res { - writeln!(&mut io::stderr(), "An error occured:\n{}", e).ok(); + eprintln!("Error: {}", e); + + for cause in e.iter().skip(1) { + eprintln!("\tCaused By: {}", cause); + } + ::std::process::exit(101); } } // Build command implementation pub fn build(args: &ArgMatches) -> Result<()> { let book_dir = get_book_dir(args); - let mut book = MDBook::new(&book_dir).read_config()?; + let mut book = MDBook::load(&book_dir)?; // Set this to allow us to catch bugs in advance. book.config.build.create_missing = false; diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index bc2767c7bcc5d..159c9e035b7a2 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -33,6 +33,8 @@ static EXCEPTIONS: &'static [&'static str] = &[ "openssl", // BSD+advertising clause, cargo, mdbook "pest", // MPL2, mdbook via handlebars "thread-id", // Apache-2.0, mdbook + "toml-query", // MPL-2.0, mdbook + "is-match", // MPL-2.0, mdbook "cssparser", // MPL-2.0, rustdoc "smallvec", // MPL-2.0, rustdoc "fuchsia-zircon-sys", // BSD-3-Clause, rustdoc, rustc, cargo