Skip to content

Commit

Permalink
Auto merge of #60311 - pietroalbini:beta-rollup, r=pietroalbini
Browse files Browse the repository at this point in the history
[beta] Rollup backports

Cherry-picked:

* #59886:  musl: do not compress debug section
* #59891:  Fix the link to sort_by_cached_key
* #59911: Revert "compile crates under test w/ -Zemit-stack-sizes"
* #59978: rustdoc: Remove default keyword from re-exported trait methods
* #59989: Fix links to Atomic* in RELEASES.md
* #60186: Temporarily accept [i|u][32|size] suffixes on a tuple index and warn
* #60309: Add 1.34.1 release notes

Rolled up:

* #60273: [beta] bootstrap; remove redundant imports.

r? @ghost
  • Loading branch information
bors committed Apr 27, 2019
2 parents 2bc1d40 + e793a2f commit c13114d
Show file tree
Hide file tree
Showing 11 changed files with 124 additions and 65 deletions.
31 changes: 21 additions & 10 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -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)
==========================

Expand Down Expand Up @@ -113,15 +124,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
Expand All @@ -133,7 +144,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
Expand Down
27 changes: 0 additions & 27 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
4 changes: 0 additions & 4 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down
2 changes: 0 additions & 2 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 5 additions & 3 deletions src/ci/docker/dist-x86_64-musl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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 \
Expand Down
6 changes: 5 additions & 1 deletion src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2325,6 +2325,10 @@ impl<'tcx> Clean<Item> for ty::AssociatedItem {
} else {
hir::Constness::NotConst
};
let defaultness = match self.container {
ty::ImplContainer(_) => Some(self.defaultness),
ty::TraitContainer(_) => None,
};
MethodItem(Method {
generics,
decl,
Expand All @@ -2334,7 +2338,7 @@ impl<'tcx> Clean<Item> for ty::AssociatedItem {
constness,
asyncness: hir::IsAsync::NotAsync,
},
defaultness: Some(self.defaultness),
defaultness,
all_types,
ret_types,
})
Expand Down
34 changes: 31 additions & 3 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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/60210",
);
err
} else {
self.struct_span_err(sp, &format!("suffixes on {} are invalid", kind))
};
err.span_label(sp, format!("invalid suffix `{}`", text));
err.emit();
}
}
}
Expand Down Expand Up @@ -1429,6 +1454,9 @@ impl<'a> Parser<'a> {
fn struct_span_err<S: Into<MultiSpan>>(&self, sp: S, m: &str) -> DiagnosticBuilder<'a> {
self.sess.span_diagnostic.struct_span_err(sp, m)
}
fn struct_span_warn<S: Into<MultiSpan>>(&self, sp: S, m: &str) -> DiagnosticBuilder<'a> {
self.sess.span_diagnostic.struct_span_warn(sp, m)
}
crate fn span_bug<S: Into<MultiSpan>>(&self, sp: S, m: &str) -> ! {
self.sess.span_diagnostic.span_bug(sp, m)
}
Expand Down
26 changes: 26 additions & 0 deletions src/test/rustdoc/default-trait-method.rs
Original file line number Diff line number Diff line change
@@ -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() {}
}
15 changes: 0 additions & 15 deletions src/test/rustdoc/default_trait_method.rs

This file was deleted.

16 changes: 16 additions & 0 deletions src/test/rustdoc/inline_cross/auxiliary/default-trait-method.rs
Original file line number Diff line number Diff line change
@@ -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() {}
}
20 changes: 20 additions & 0 deletions src/test/rustdoc/inline_cross/default-trait-method.rs
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit c13114d

Please sign in to comment.