diff options
| author | bors <bors@rust-lang.org> | 2018-10-24 19:58:23 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-10-24 19:58:23 +0000 |
| commit | da5f414c2c0bfe5198934493f04c676e2b23ff2e (patch) | |
| tree | 77e27fd6f1bcc0912e4a1085ddfc6f5c9861ecfc /src | |
| parent | f33946f81adec4739b84975805dcdeeb77f5a039 (diff) | |
| parent | 4a0c8d12f73e93af70e363fced9f335d26eb149d (diff) | |
| download | rust-1.30.0.tar.gz rust-1.30.0.zip | |
Auto merge of #55315 - pietroalbini:release-1.30.0, r=Mark-Simulacrum 1.30.0
Stable release 1.30 This PR also reverts the stabilization of `non_modrs_mods` and the 2018 edition. r? @Mark-Simulacrum cc @rust-lang/release
Diffstat (limited to 'src')
| -rwxr-xr-x | src/ci/run.sh | 2 | ||||
| -rw-r--r-- | src/doc/rustdoc/src/command-line-arguments.md | 14 | ||||
| -rw-r--r-- | src/doc/rustdoc/src/unstable-features.md | 13 | ||||
| -rw-r--r-- | src/librustdoc/lib.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 33 | ||||
| -rw-r--r-- | src/libsyntax_pos/edition.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/directory_ownership/mod_file_not_owning.rs | 15 | ||||
| -rw-r--r-- | src/test/ui/directory_ownership/mod_file_not_owning.stderr | 15 | ||||
| -rw-r--r-- | src/test/ui/directory_ownership/unowned_mod_with_path.rs | 15 | ||||
| -rw-r--r-- | src/test/ui/directory_ownership/unowned_mod_with_path.stderr | 15 | ||||
| -rw-r--r-- | src/test/ui/non_modrs_mods/non_modrs_mods.rs | 28 | ||||
| -rw-r--r-- | src/test/ui/non_modrs_mods/non_modrs_mods.stderr | 39 | ||||
| -rw-r--r-- | src/test/ui/run-pass/non_modrs_mods/non_modrs_mods.rs | 28 | ||||
| m--------- | src/tools/cargo | 0 |
14 files changed, 201 insertions, 20 deletions
diff --git a/src/ci/run.sh b/src/ci/run.sh index a965c44031a..7b89ab5a9f8 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -51,7 +51,7 @@ fi # # FIXME: need a scheme for changing this `nightly` value to `beta` and `stable` # either automatically or manually. -export RUST_RELEASE_CHANNEL=beta +export RUST_RELEASE_CHANNEL=stable if [ "$DEPLOY$DEPLOY_ALT" != "" ]; then RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL" RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp" diff --git a/src/doc/rustdoc/src/command-line-arguments.md b/src/doc/rustdoc/src/command-line-arguments.md index aba485f752a..417608cc5ca 100644 --- a/src/doc/rustdoc/src/command-line-arguments.md +++ b/src/doc/rustdoc/src/command-line-arguments.md @@ -345,17 +345,3 @@ $ rustdoc src/lib.rs --sysroot /path/to/sysroot Similar to `rustc --sysroot`, this lets you change the sysroot `rustdoc` uses when compiling your code. - -### `--edition`: control the edition of docs and doctests - -Using this flag looks like this: - -```bash -$ rustdoc src/lib.rs --edition 2018 -$ rustdoc --test src/lib.rs --edition 2018 -``` - -This flag allows rustdoc to treat your rust code as the given edition. It will compile doctests with -the given edition as well. As with `rustc`, the default edition that `rustdoc` will use is `2015` -(the first edition). - diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index 071575b1fc0..32fb8c2f7d5 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -346,6 +346,19 @@ details. [issue-display-warnings]: https://github.com/rust-lang/rust/issues/41574 +### `--edition`: control the edition of docs and doctests + +Using this flag looks like this: + +```bash +$ rustdoc src/lib.rs -Z unstable-options --edition 2018 +$ rustdoc --test src/lib.rs -Z unstable-options --edition 2018 +``` + +This flag allows rustdoc to treat your rust code as the given edition. It will compile doctests with +the given edition as well. As with `rustc`, the default edition that `rustdoc` will use is `2015` +(the first edition). + ### `--extern-html-root-url`: control how rustdoc links to non-local crates Using this flag looks like this: diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index e9fac23b767..3a70c55e173 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -286,7 +286,7 @@ fn opts() -> Vec<RustcOptGroup> { \"light-suffix.css\"", "PATH") }), - stable("edition", |o| { + unstable("edition", |o| { o.optopt("", "edition", "edition to use when compiling rust code (default: 2015)", "EDITION") diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 1d9a278a55b..26067304f92 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -37,7 +37,7 @@ use visit::{self, FnKind, Visitor}; use parse::ParseSess; use symbol::{keywords, Symbol}; -use std::{env}; +use std::{env, path}; macro_rules! set { // The const_fn feature also enables the min_const_fn feature, because `min_const_fn` allows @@ -403,6 +403,9 @@ declare_features! ( // `extern` in paths (active, extern_in_paths, "1.23.0", Some(44660), None), + // `foo.rs` as an alternative to `foo/mod.rs` + (active, non_modrs_mods, "1.24.0", Some(44660), Some(Edition::Edition2018)), + // Use `?` as the Kleene "at most one" operator (active, macro_at_most_once_rep, "1.25.0", Some(48075), None), @@ -651,8 +654,6 @@ declare_features! ( (accepted, repr_transparent, "1.28.0", Some(43036), None), // Defining procedural macros in `proc-macro` crates (accepted, proc_macro, "1.29.0", Some(38356), None), - // `foo.rs` as an alternative to `foo/mod.rs` - (accepted, non_modrs_mods, "1.30.0", Some(44660), None), // Allows use of the :vis macro fragment specifier (accepted, macro_vis_matcher, "1.30.0", Some(41022), None), // Allows importing and reexporting macros with `use`, @@ -1500,6 +1501,31 @@ impl<'a> PostExpansionVisitor<'a> { } } +impl<'a> PostExpansionVisitor<'a> { + fn whole_crate_feature_gates(&mut self, _krate: &ast::Crate) { + for &(ident, span) in &*self.context.parse_sess.non_modrs_mods.borrow() { + if !span.allows_unstable() { + let cx = &self.context; + let level = GateStrength::Hard; + let has_feature = cx.features.non_modrs_mods; + let name = "non_modrs_mods"; + debug!("gate_feature(feature = {:?}, span = {:?}); has? {}", + name, span, has_feature); + + if !has_feature && !span.allows_unstable() { + leveled_feature_err( + cx.parse_sess, name, span, GateIssue::Language, + "mod statements in non-mod.rs files are unstable", level + ) + .help(&format!("on stable builds, rename this file to {}{}mod.rs", + ident, path::MAIN_SEPARATOR)) + .emit(); + } + } + } + } +} + impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { fn visit_attribute(&mut self, attr: &ast::Attribute) { if !attr.span.allows_unstable() { @@ -2066,6 +2092,7 @@ pub fn check_crate(krate: &ast::Crate, }; let visitor = &mut PostExpansionVisitor { context: &ctx }; + visitor.whole_crate_feature_gates(krate); visit::walk_crate(visitor, krate); } diff --git a/src/libsyntax_pos/edition.rs b/src/libsyntax_pos/edition.rs index 7709db72a02..fce8fc3db4e 100644 --- a/src/libsyntax_pos/edition.rs +++ b/src/libsyntax_pos/edition.rs @@ -65,7 +65,7 @@ impl Edition { pub fn is_stable(&self) -> bool { match *self { Edition::Edition2015 => true, - Edition::Edition2018 => true, + Edition::Edition2018 => false, } } } diff --git a/src/test/ui/directory_ownership/mod_file_not_owning.rs b/src/test/ui/directory_ownership/mod_file_not_owning.rs new file mode 100644 index 00000000000..ff93fddf9b3 --- /dev/null +++ b/src/test/ui/directory_ownership/mod_file_not_owning.rs @@ -0,0 +1,15 @@ +// Copyright 2014 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern: mod statements in non-mod.rs files are unstable + +mod mod_file_not_owning_aux1; + +fn main() {} diff --git a/src/test/ui/directory_ownership/mod_file_not_owning.stderr b/src/test/ui/directory_ownership/mod_file_not_owning.stderr new file mode 100644 index 00000000000..e2937573997 --- /dev/null +++ b/src/test/ui/directory_ownership/mod_file_not_owning.stderr @@ -0,0 +1,15 @@ +error[E0658]: mod statements in non-mod.rs files are unstable (see issue #44660) + --> $DIR/mod_file_not_owning_aux1.rs:14:17 + | +LL | () => { mod mod_file_not_owning_aux2; } + | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | } +LL | m!(); + | ----- in this macro invocation + | + = help: add #![feature(non_modrs_mods)] to the crate attributes to enable + = help: on stable builds, rename this file to mod_file_not_owning_aux1/mod.rs + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/directory_ownership/unowned_mod_with_path.rs b/src/test/ui/directory_ownership/unowned_mod_with_path.rs new file mode 100644 index 00000000000..0cffb7cc9e5 --- /dev/null +++ b/src/test/ui/directory_ownership/unowned_mod_with_path.rs @@ -0,0 +1,15 @@ +// Copyright 2016 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern: mod statements in non-mod.rs files are unstable + +// This is not a directory owner since the file name is not "mod.rs". +#[path = "mod_file_not_owning_aux1.rs"] +mod foo; diff --git a/src/test/ui/directory_ownership/unowned_mod_with_path.stderr b/src/test/ui/directory_ownership/unowned_mod_with_path.stderr new file mode 100644 index 00000000000..0c0b4281434 --- /dev/null +++ b/src/test/ui/directory_ownership/unowned_mod_with_path.stderr @@ -0,0 +1,15 @@ +error[E0658]: mod statements in non-mod.rs files are unstable (see issue #44660) + --> $DIR/mod_file_not_owning_aux1.rs:14:17 + | +LL | () => { mod mod_file_not_owning_aux2; } + | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | } +LL | m!(); + | ----- in this macro invocation + | + = help: add #![feature(non_modrs_mods)] to the crate attributes to enable + = help: on stable builds, rename this file to foo/mod.rs + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/non_modrs_mods/non_modrs_mods.rs b/src/test/ui/non_modrs_mods/non_modrs_mods.rs new file mode 100644 index 00000000000..9dc85f4d3f9 --- /dev/null +++ b/src/test/ui/non_modrs_mods/non_modrs_mods.rs @@ -0,0 +1,28 @@ +// Copyright 2017 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// Tests the formatting of the feature-gate errors for non_modrs_mods +// +// gate-test-non_modrs_mods +// ignore-windows +// ignore-pretty issue #37195 +pub mod modrs_mod; +pub mod foors_mod; + +#[path = "some_crazy_attr_mod_dir/arbitrary_name.rs"] +pub mod attr_mod; + +pub fn main() { + modrs_mod::inner_modrs_mod::innest::foo(); + modrs_mod::inner_foors_mod::innest::foo(); + foors_mod::inner_modrs_mod::innest::foo(); + foors_mod::inner_foors_mod::innest::foo(); + attr_mod::inner_modrs_mod::innest::foo(); +} diff --git a/src/test/ui/non_modrs_mods/non_modrs_mods.stderr b/src/test/ui/non_modrs_mods/non_modrs_mods.stderr new file mode 100644 index 00000000000..c45ab734fd5 --- /dev/null +++ b/src/test/ui/non_modrs_mods/non_modrs_mods.stderr @@ -0,0 +1,39 @@ +error[E0658]: mod statements in non-mod.rs files are unstable (see issue #44660) + --> $DIR/modrs_mod/inner_foors_mod.rs:11:9 + | +LL | pub mod innest; + | ^^^^^^ + | + = help: add #![feature(non_modrs_mods)] to the crate attributes to enable + = help: on stable builds, rename this file to inner_foors_mod/mod.rs + +error[E0658]: mod statements in non-mod.rs files are unstable (see issue #44660) + --> $DIR/foors_mod.rs:13:9 + | +LL | pub mod inner_modrs_mod; + | ^^^^^^^^^^^^^^^ + | + = help: add #![feature(non_modrs_mods)] to the crate attributes to enable + = help: on stable builds, rename this file to foors_mod/mod.rs + +error[E0658]: mod statements in non-mod.rs files are unstable (see issue #44660) + --> $DIR/foors_mod.rs:14:9 + | +LL | pub mod inner_foors_mod; + | ^^^^^^^^^^^^^^^ + | + = help: add #![feature(non_modrs_mods)] to the crate attributes to enable + = help: on stable builds, rename this file to foors_mod/mod.rs + +error[E0658]: mod statements in non-mod.rs files are unstable (see issue #44660) + --> $DIR/foors_mod/inner_foors_mod.rs:11:9 + | +LL | pub mod innest; + | ^^^^^^ + | + = help: add #![feature(non_modrs_mods)] to the crate attributes to enable + = help: on stable builds, rename this file to inner_foors_mod/mod.rs + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/run-pass/non_modrs_mods/non_modrs_mods.rs b/src/test/ui/run-pass/non_modrs_mods/non_modrs_mods.rs new file mode 100644 index 00000000000..a9b240be804 --- /dev/null +++ b/src/test/ui/run-pass/non_modrs_mods/non_modrs_mods.rs @@ -0,0 +1,28 @@ +// Copyright 2017 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 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// +// ignore-pretty issue #37195 +#![feature(non_modrs_mods)] + +pub mod modrs_mod; +pub mod foors_mod; + +#[path = "some_crazy_attr_mod_dir/arbitrary_name.rs"] +pub mod attr_mod; + +pub fn main() { + modrs_mod::inner_modrs_mod::innest::foo(); + modrs_mod::inner_foors_mod::innest::foo(); + foors_mod::inner_modrs_mod::innest::foo(); + foors_mod::inner_foors_mod::innest::foo(); + attr_mod::inner_modrs_mod::innest::foo(); +} diff --git a/src/tools/cargo b/src/tools/cargo -Subproject 05e9b01fcd82cbdf3991dabc497f6148baf9d30 +Subproject 36d96825d0f288c6d1bb2219919a277968bd365 |
