From cdcab96cfea688ad18cbe5575617fa2a4dd9a8df Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Sun, 14 Apr 2019 23:29:22 +0200 Subject: [PATCH 1/9] bump bootstrap; remove redundant imports. --- src/bootstrap/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index bcd28e9cf5e70..fb60b470a36f2 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -1125,8 +1125,6 @@ impl Build { /// `rust.save-toolstates` in `config.toml`. If unspecified, nothing will be /// done. The file is updated immediately after this function completes. pub fn save_toolstate(&self, tool: &str, state: ToolState) { - use std::io::{Seek, SeekFrom}; - if let Some(ref path) = self.config.save_toolstates { let mut file = t!(fs::OpenOptions::new() .create(true) From 6fcfdd5cb672d33d39341b80fbcbea217ea9002c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Thu, 11 Apr 2019 18:57:13 +0200 Subject: [PATCH 2/9] musl: do not compress debug section Old linkers are unable to decompress them and fail to link binaries --- src/ci/docker/dist-x86_64-musl/Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ci/docker/dist-x86_64-musl/Dockerfile b/src/ci/docker/dist-x86_64-musl/Dockerfile index 560df2f3a5700..21a9023a4586a 100644 --- a/src/ci/docker/dist-x86_64-musl/Dockerfile +++ b/src/ci/docker/dist-x86_64-musl/Dockerfile @@ -21,8 +21,8 @@ WORKDIR /build/ COPY scripts/musl-toolchain.sh /build/ # We need to mitigate rust-lang/rust#34978 when compiling musl itself as well -RUN CFLAGS="-Wa,-mrelax-relocations=no" \ - CXXFLAGS="-Wa,-mrelax-relocations=no" \ +RUN CFLAGS="-Wa,-mrelax-relocations=no -Wa,--compress-debug-sections=none -Wl,--compress-debug-sections=none" \ + CXXFLAGS="-Wa,-mrelax-relocations=no -Wa,--compress-debug-sections=none -Wl,--compress-debug-sections=none" \ bash musl-toolchain.sh x86_64 && rm -rf build COPY scripts/sccache.sh /scripts/ @@ -38,7 +38,9 @@ ENV RUST_CONFIGURE_ARGS \ # way to produce "super compatible" binaries. # # See: https://github.com/rust-lang/rust/issues/34978 -ENV CFLAGS_x86_64_unknown_linux_musl=-Wa,-mrelax-relocations=no +# And: https://github.com/rust-lang/rust/issues/59411 +ENV CFLAGS_x86_64_unknown_linux_musl="-Wa,-mrelax-relocations=no -Wa,--compress-debug-sections=none \ + -Wl,--compress-debug-sections=none" ENV HOSTS=x86_64-unknown-linux-musl \ CC_x86_64_unknown_linux_musl=x86_64-linux-musl-gcc \ From 7c2bde1ce5174c42eeaaf09e7fed5139af108676 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Fri, 12 Apr 2019 12:30:21 +0200 Subject: [PATCH 3/9] Revert PR #59401 to fix issue #59652 (a stable-to-beta regression). This is result of squashing two revert commits: Revert "compile all crates under test w/ -Zemit-stack-sizes" This reverts commit 7d365cf27f4249fc9b61ba8abfc813abe43f1cb7. Revert "bootstrap: build compiler-builtins with -Z emit-stack-sizes" This reverts commit 8b8488ce8fc047282e7159343f30609417f9fa39. --- src/bootstrap/bin/rustc.rs | 27 --------------------------- src/bootstrap/compile.rs | 4 ---- 2 files changed, 31 deletions(-) diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 86ce5fd01a812..a76584093fc76 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -187,33 +187,6 @@ fn main() { cmd.arg("-C").arg(format!("debug-assertions={}", debug_assertions)); } - // Build all crates in the `std` facade with `-Z emit-stack-sizes` to add stack usage - // information. - // - // When you use this `-Z` flag with Cargo you get stack usage information on all crates - // compiled from source, and when you are using LTO you also get information on pre-compiled - // crates like `core` and `std`, even if they were not compiled with `-Z emit-stack-sizes`. - // However, there's an exception: `compiler_builtins`. This crate is special and doesn't - // participate in LTO because it's always linked as a separate object file. For this reason - // it's impossible to get stack usage information about `compiler-builtins` using - // `RUSTFLAGS` + Cargo, or `cargo rustc`. - // - // To make the stack usage information of all crates under the `std` facade available to - // Cargo based stack usage analysis tools, in both LTO and non-LTO mode, we compile them - // with the `-Z emit-stack-sizes` flag. The `RUSTC_EMIT_STACK_SIZES` var helps us apply this - // flag only to the crates in the `std` facade. The `-Z` flag is known to currently work - // with targets that produce ELF files so we limit its use flag to those targets. - // - // NOTE(japaric) if this ever causes problem with an LLVM upgrade or any PR feel free to - // remove it or comment it out - if env::var_os("RUSTC_EMIT_STACK_SIZES").is_some() - && (target.contains("-linux-") - || target.contains("-none-eabi") - || target.ends_with("-none-elf")) - { - cmd.arg("-Zemit-stack-sizes"); - } - if let Ok(s) = env::var("RUSTC_CODEGEN_UNITS") { cmd.arg("-C").arg(format!("codegen-units={}", s)); } diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 08316b71ea85b..66443d472d334 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -97,8 +97,6 @@ impl Step for Std { let _folder = builder.fold_output(|| format!("stage{}-std", compiler.stage)); builder.info(&format!("Building stage{} std artifacts ({} -> {})", compiler.stage, &compiler.host, target)); - // compile with `-Z emit-stack-sizes`; see bootstrap/src/rustc.rs for more details - cargo.env("RUSTC_EMIT_STACK_SIZES", "1"); run_cargo(builder, &mut cargo, &libstd_stamp(builder, compiler, target), @@ -397,8 +395,6 @@ impl Step for Test { let _folder = builder.fold_output(|| format!("stage{}-test", compiler.stage)); builder.info(&format!("Building stage{} test artifacts ({} -> {})", compiler.stage, &compiler.host, target)); - // compile with `-Z emit-stack-sizes`; see bootstrap/src/rustc.rs for more details - cargo.env("RUSTC_EMIT_STACK_SIZES", "1"); run_cargo(builder, &mut cargo, &libtest_stamp(builder, compiler, target), From 45971749beff233745b3a5edcfd8b60ed2a8d699 Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Sun, 14 Apr 2019 23:53:51 +0100 Subject: [PATCH 4/9] rustdoc: Remove default keyword from re-exported trait methods --- src/librustdoc/clean/mod.rs | 6 ++++- src/test/rustdoc/default-trait-method.rs | 26 +++++++++++++++++++ src/test/rustdoc/default_trait_method.rs | 15 ----------- .../auxiliary/default-trait-method.rs | 16 ++++++++++++ .../inline_cross/default-trait-method.rs | 20 ++++++++++++++ 5 files changed, 67 insertions(+), 16 deletions(-) create mode 100644 src/test/rustdoc/default-trait-method.rs delete mode 100644 src/test/rustdoc/default_trait_method.rs create mode 100644 src/test/rustdoc/inline_cross/auxiliary/default-trait-method.rs create mode 100644 src/test/rustdoc/inline_cross/default-trait-method.rs diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index e994c661fdceb..80e796b0af732 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2325,6 +2325,10 @@ impl<'tcx> Clean for ty::AssociatedItem { } else { hir::Constness::NotConst }; + let defaultness = match self.container { + ty::ImplContainer(_) => Some(self.defaultness), + ty::TraitContainer(_) => None, + }; MethodItem(Method { generics, decl, @@ -2334,7 +2338,7 @@ impl<'tcx> Clean for ty::AssociatedItem { constness, asyncness: hir::IsAsync::NotAsync, }, - defaultness: Some(self.defaultness), + defaultness, all_types, ret_types, }) diff --git a/src/test/rustdoc/default-trait-method.rs b/src/test/rustdoc/default-trait-method.rs new file mode 100644 index 0000000000000..3d6ebef5a1d5b --- /dev/null +++ b/src/test/rustdoc/default-trait-method.rs @@ -0,0 +1,26 @@ +#![feature(specialization)] + +// @has default_trait_method/trait.Item.html +// @has - '//*[@id="tymethod.foo"]' 'fn foo()' +// @!has - '//*[@id="tymethod.foo"]' 'default fn foo()' +// @has - '//*[@id="tymethod.bar"]' 'fn bar()' +// @!has - '//*[@id="tymethod.bar"]' 'default fn bar()' +// @has - '//*[@id="method.baz"]' 'fn baz()' +// @!has - '//*[@id="method.baz"]' 'default fn baz()' +pub trait Item { + fn foo(); + fn bar(); + fn baz() {} +} + +// @has default_trait_method/struct.Foo.html +// @has - '//*[@id="method.foo"]' 'default fn foo()' +// @has - '//*[@id="method.bar"]' 'fn bar()' +// @!has - '//*[@id="method.bar"]' 'default fn bar()' +// @has - '//*[@id="method.baz"]' 'fn baz()' +// @!has - '//*[@id="method.baz"]' 'default fn baz()' +pub struct Foo; +impl Item for Foo { + default fn foo() {} + fn bar() {} +} diff --git a/src/test/rustdoc/default_trait_method.rs b/src/test/rustdoc/default_trait_method.rs deleted file mode 100644 index dfbd8f2210fa4..0000000000000 --- a/src/test/rustdoc/default_trait_method.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![feature(specialization)] - -pub trait Item { - fn foo(); - fn bar(); -} - -// @has default_trait_method/trait.Item.html -// @has - '//*[@id="method.foo"]' 'default fn foo()' -// @has - '//*[@id="method.bar"]' 'fn bar()' -// @!has - '//*[@id="method.bar"]' 'default fn bar()' -impl Item for T { - default fn foo() {} - fn bar() {} -} diff --git a/src/test/rustdoc/inline_cross/auxiliary/default-trait-method.rs b/src/test/rustdoc/inline_cross/auxiliary/default-trait-method.rs new file mode 100644 index 0000000000000..ce60bbfb4b0de --- /dev/null +++ b/src/test/rustdoc/inline_cross/auxiliary/default-trait-method.rs @@ -0,0 +1,16 @@ +#![feature(specialization)] + +#![crate_name = "foo"] + +pub trait Item { + fn foo(); + fn bar(); + fn baz() {} +} + +pub struct Foo; + +impl Item for Foo { + default fn foo() {} + fn bar() {} +} diff --git a/src/test/rustdoc/inline_cross/default-trait-method.rs b/src/test/rustdoc/inline_cross/default-trait-method.rs new file mode 100644 index 0000000000000..a4ec73a127d4e --- /dev/null +++ b/src/test/rustdoc/inline_cross/default-trait-method.rs @@ -0,0 +1,20 @@ +// aux-build:default-trait-method.rs + +extern crate foo; + +// @has default_trait_method/trait.Item.html +// @has - '//*[@id="tymethod.foo"]' 'fn foo()' +// @!has - '//*[@id="tymethod.foo"]' 'default fn foo()' +// @has - '//*[@id="tymethod.bar"]' 'fn bar()' +// @!has - '//*[@id="tymethod.bar"]' 'default fn bar()' +// @has - '//*[@id="method.baz"]' 'fn baz()' +// @!has - '//*[@id="method.baz"]' 'default fn baz()' +pub use foo::Item; + +// @has default_trait_method/struct.Foo.html +// @has - '//*[@id="method.foo"]' 'default fn foo()' +// @has - '//*[@id="method.bar"]' 'fn bar()' +// @!has - '//*[@id="method.bar"]' 'default fn bar()' +// @has - '//*[@id="method.baz"]' 'fn baz()' +// @!has - '//*[@id="method.baz"]' 'default fn baz()' +pub use foo::Foo; From 165d228be74294ccf427ca2b2122f5fc17c27af2 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 11 Apr 2019 14:04:52 -0700 Subject: [PATCH 5/9] Fix the link to sort_by_cached_key It's a primitive slice method, not a standalone function. --- RELEASES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASES.md b/RELEASES.md index 821889d64a5fb..fcaaa73bdc0f4 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -133,7 +133,7 @@ Compatibility Notes [`num::NonZeroI64`]: https://doc.rust-lang.org/std/num/struct.NonZeroI64.html [`num::NonZeroI8`]: https://doc.rust-lang.org/std/num/struct.NonZeroI8.html [`num::NonZeroIsize`]: https://doc.rust-lang.org/std/num/struct.NonZeroIsize.html -[`slice::sort_by_cached_key`]: https://doc.rust-lang.org/std/slice/fn.sort_by_cached_key +[`slice::sort_by_cached_key`]: https://doc.rust-lang.org/std/primitive.slice.html#method.sort_by_cached_key [`str::escape_debug`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_debug [`str::escape_default`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_default [`str::escape_unicode`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_unicode From f8bf4813f9bd3dd2034c6878c44916ce84b8342c Mon Sep 17 00:00:00 2001 From: Dmitry Murzin Date: Mon, 15 Apr 2019 17:19:38 +0300 Subject: [PATCH 6/9] Fix links to Atomic* in RELEASES.md --- RELEASES.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index fcaaa73bdc0f4..24461742ad898 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -113,15 +113,15 @@ Compatibility Notes [56470]: https://github.com/rust-lang/rust/pull/56470/ [cargo/6654]: https://github.com/rust-lang/cargo/pull/6654/ [`Any::type_id`]: https://doc.rust-lang.org/std/any/trait.Any.html#tymethod.type_id -[`Error::type_id`]: https://doc.rust-lang.org/std/error/trait.Error.html#tymethod.type_id -[`atomic::AtomicI16`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI16.html -[`atomic::AtomicI32`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI32.html -[`atomic::AtomicI64`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI64.html -[`atomic::AtomicI8`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI8.html -[`atomic::AtomicU16`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU16.html -[`atomic::AtomicU32`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU32.html -[`atomic::AtomicU64`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU64.html -[`atomic::AtomicU8`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU8.html +[`Error::type_id`]: https://doc.rust-lang.org/std/error/trait.Error.html#method.type_id +[`atomic::AtomicI16`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicI16.html +[`atomic::AtomicI32`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicI32.html +[`atomic::AtomicI64`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicI64.html +[`atomic::AtomicI8`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicI8.html +[`atomic::AtomicU16`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU16.html +[`atomic::AtomicU32`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU32.html +[`atomic::AtomicU64`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU64.html +[`atomic::AtomicU8`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU8.html [`convert::Infallible`]: https://doc.rust-lang.org/std/convert/enum.Infallible.html [`convert::TryFrom`]: https://doc.rust-lang.org/std/convert/trait.TryFrom.html [`convert::TryInto`]: https://doc.rust-lang.org/std/convert/trait.TryInto.html From 4b1c7ad35c96a6773749c98cb343fc63115b6c7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 22 Apr 2019 15:55:45 -0700 Subject: [PATCH 7/9] Temporarily accept [i|u][32|size] suffixes on a tuple index and warn --- src/libsyntax/parse/parser.rs | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 37360a563950b..d157f0f3cb218 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1119,9 +1119,34 @@ impl<'a> Parser<'a> { if text.is_empty() { self.span_bug(sp, "found empty literal suffix in Some") } - self.struct_span_err(sp, &format!("suffixes on {} are invalid", kind)) - .span_label(sp, format!("invalid suffix `{}`", text)) - .emit(); + let mut err = if kind == "a tuple index" && + ["i32", "u32", "isize", "usize"].contains(&text.to_string().as_str()) + { + // #59553: warn instead of reject out of hand to allow the fix to percolate + // through the ecosystem when people fix their macros + let mut err = self.struct_span_warn( + sp, + &format!("suffixes on {} are invalid", kind), + ); + err.note(&format!( + "`{}` is *temporarily* accepted on tuple index fields as it was \ + incorrectly accepted on stable for a few releases", + text, + )); + err.help( + "on proc macros, you'll want to use `syn::Index::from` or \ + `proc_macro::Literal::*_unsuffixed` for code that will desugar \ + to tuple field access", + ); + err.note( + "for more context, see https://github.com/rust-lang/rust/issues/59553", + ); + err + } else { + self.struct_span_err(sp, &format!("suffixes on {} are invalid", kind)) + }; + err.span_label(sp, format!("invalid suffix `{}`", text)); + err.emit(); } } } @@ -1429,6 +1454,9 @@ impl<'a> Parser<'a> { fn struct_span_err>(&self, sp: S, m: &str) -> DiagnosticBuilder<'a> { self.sess.span_diagnostic.struct_span_err(sp, m) } + fn struct_span_warn>(&self, sp: S, m: &str) -> DiagnosticBuilder<'a> { + self.sess.span_diagnostic.struct_span_warn(sp, m) + } crate fn span_bug>(&self, sp: S, m: &str) -> ! { self.sess.span_diagnostic.span_bug(sp, m) } From a0b51d7decf0f4788c17f75df0f8c61aa5bfd727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Tue, 23 Apr 2019 14:31:42 -0700 Subject: [PATCH 8/9] review comment: change linked ticket --- src/libsyntax/parse/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index d157f0f3cb218..f415f769f7592 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1139,7 +1139,7 @@ impl<'a> Parser<'a> { to tuple field access", ); err.note( - "for more context, see https://github.com/rust-lang/rust/issues/59553", + "for more context, see https://github.com/rust-lang/rust/issues/60210", ); err } else { From 8b694eea704f02a622b57a4cd04120193addd0d1 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Tue, 23 Apr 2019 16:18:11 +0200 Subject: [PATCH 9/9] update release notes for 1.34.1 --- RELEASES.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/RELEASES.md b/RELEASES.md index 24461742ad898..3b4f4182702d1 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,14 @@ +Version 1.34.1 (2019-04-25) +=========================== + +* [Fix false positives for the `redundant_closure` Clippy lint][clippy/3821] +* [Fix false positives for the `missing_const_for_fn` Clippy lint][clippy/3844] +* [Fix Clippy panic when checking some macros][clippy/3805] + +[clippy/3821]: https://github.com/rust-lang/rust-clippy/pull/3821 +[clippy/3844]: https://github.com/rust-lang/rust-clippy/pull/3844 +[clippy/3805]: https://github.com/rust-lang/rust-clippy/pull/3805 + Version 1.34.0 (2019-04-11) ==========================