Skip to content

Commit

Permalink
Auto merge of #62782 - Mark-Simulacrum:rollup-1hz5ya6, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Rollup of 15 pull requests

Successful merges:

 - #61926 (Fix hyperlinks in From impls between Vec and VecDeque)
 - #62615 ( Only error about MSVC + PGO + unwind if we're generating code)
 - #62696 (Check that trait is exported or public before adding hint)
 - #62712 (Update the help message on error for self type)
 - #62728 (Fix repeated wording in slice documentation)
 - #62730 (Consolidate hygiene tests)
 - #62732 (Remove last use of mem::uninitialized from std::io::util)
 - #62740 (Add missing link to Infallible in TryFrom doc)
 - #62745 (update data_layout and features for armv7-wrs-vxworks)
 - #62749 (Document link_section arbitrary bytes)
 - #62752 (Disable Z3 in LLVM build)
 - #62764 (normalize use of backticks in compiler messages for librustc/lint)
 - #62774 (Disable simd_select_bitmask test on big endian)
 - #62777 (Self-referencial type now called a recursive type)
 - #62778 (Emit artifact notifications for dependency files)

Failed merges:

 - #62746 ( do not use mem::uninitialized in std::io)

r? @ghost
  • Loading branch information
bors committed Jul 18, 2019
2 parents 4ed008a + 396903b commit 311376d
Show file tree
Hide file tree
Showing 210 changed files with 319 additions and 299 deletions.
1 change: 1 addition & 0 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ impl Step for Llvm {
.define("WITH_POLLY", "OFF")
.define("LLVM_ENABLE_TERMINFO", "OFF")
.define("LLVM_ENABLE_LIBEDIT", "OFF")
.define("LLVM_ENABLE_Z3_SOLVER", "OFF")
.define("LLVM_PARALLEL_COMPILE_JOBS", builder.jobs().to_string())
.define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
.define("LLVM_DEFAULT_TARGET_TRIPLE", target);
Expand Down
6 changes: 6 additions & 0 deletions src/liballoc/collections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2721,6 +2721,9 @@ impl<T: fmt::Debug> fmt::Debug for VecDeque<T> {
impl<T> From<Vec<T>> for VecDeque<T> {
/// Turn a [`Vec<T>`] into a [`VecDeque<T>`].
///
/// [`Vec<T>`]: crate::vec::Vec
/// [`VecDeque<T>`]: crate::collections::VecDeque
///
/// This avoids reallocating where possible, but the conditions for that are
/// strict, and subject to change, and so shouldn't be relied upon unless the
/// `Vec<T>` came from `From<VecDeque<T>>` and hasn't been reallocated.
Expand Down Expand Up @@ -2752,6 +2755,9 @@ impl<T> From<Vec<T>> for VecDeque<T> {
impl<T> From<VecDeque<T>> for Vec<T> {
/// Turn a [`VecDeque<T>`] into a [`Vec<T>`].
///
/// [`Vec<T>`]: crate::vec::Vec
/// [`VecDeque<T>`]: crate::collections::VecDeque
///
/// This never needs to re-allocate, but does need to do O(n) data movement if
/// the circular buffer doesn't happen to be at the beginning of the allocation.
///
Expand Down
1 change: 1 addition & 0 deletions src/libcore/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ pub trait TryInto<T>: Sized {
/// [`TryInto`]: trait.TryInto.html
/// [`i32::MAX`]: ../../std/i32/constant.MAX.html
/// [`!`]: ../../std/primitive.never.html
/// [`Infallible`]: enum.Infallible.html
#[stable(feature = "try_from", since = "1.34.0")]
pub trait TryFrom<T>: Sized {
/// The type returned in the event of a conversion error.
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ impl<T> [T] {
///
/// See [`chunks_exact`] for a variant of this iterator that returns chunks of always exactly
/// `chunk_size` elements, and [`rchunks`] for the same iterator but starting at the end of the
/// slice of the slice.
/// slice.
///
/// # Panics
///
Expand Down Expand Up @@ -645,7 +645,7 @@ impl<T> [T] {
///
/// See [`chunks_exact_mut`] for a variant of this iterator that returns chunks of always
/// exactly `chunk_size` elements, and [`rchunks_mut`] for the same iterator but starting at
/// the end of the slice of the slice.
/// the end of the slice.
///
/// # Panics
///
Expand Down Expand Up @@ -727,7 +727,7 @@ impl<T> [T] {
///
/// See [`chunks_mut`] for a variant of this iterator that also returns the remainder as a
/// smaller chunk, and [`rchunks_exact_mut`] for the same iterator but starting at the end of
/// the slice of the slice.
/// the slice.
///
/// # Panics
///
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,19 @@ declare_lint! {
declare_lint! {
pub UNUSED_FEATURES,
Warn,
"unused features found in crate-level #[feature] directives"
"unused features found in crate-level `#[feature]` directives"
}

declare_lint! {
pub STABLE_FEATURES,
Warn,
"stable features found in #[feature] directive"
"stable features found in `#[feature]` directive"
}

declare_lint! {
pub UNKNOWN_CRATE_TYPES,
Deny,
"unknown crate type found in #[crate_type] directive"
"unknown crate type found in `#[crate_type]` directive"
}

declare_lint! {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/lint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
sess.diag_note_once(
&mut err,
DiagnosticMessageId::from(lint),
&format!("#[{}({})] on by default", level.as_str(), name));
&format!("`#[{}({})]` on by default", level.as_str(), name));
}
LintSource::CommandLine(lint_flag_val) => {
let flag = match level {
Expand Down Expand Up @@ -706,7 +706,7 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
if lint_attr_name.as_str() != name {
let level_str = level.as_str();
sess.diag_note_once(&mut err, DiagnosticMessageId::from(lint),
&format!("#[{}({})] implied by #[{}({})]",
&format!("`#[{}({})]` implied by `#[{}({})]`",
level_str, name, level_str, lint_attr_name));
}
}
Expand Down
15 changes: 9 additions & 6 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::lint;
use crate::lint::builtin::BuiltinLintDiagnostics;
use crate::middle::allocator::AllocatorKind;
use crate::middle::dependency_format;
use crate::session::config::{OutputType, SwitchWithOptPath};
use crate::session::config::{OutputType, PrintRequest, SwitchWithOptPath};
use crate::session::search_paths::{PathKind, SearchPath};
use crate::util::nodemap::{FxHashMap, FxHashSet};
use crate::util::common::{duration_to_secs_str, ErrorReported};
Expand Down Expand Up @@ -1303,15 +1303,18 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
}

// PGO does not work reliably with panic=unwind on Windows. Let's make it
// a warning to combine the two for now. It always runs into an assertions
// an error to combine the two for now. It always runs into an assertions
// if LLVM is built with assertions, but without assertions it sometimes
// does not crash and will probably generate a corrupted binary.
// We should only display this error if we're actually going to run PGO.
// If we're just supposed to print out some data, don't show the error (#61002).
if sess.opts.cg.profile_generate.enabled() &&
sess.target.target.options.is_like_msvc &&
sess.panic_strategy() == PanicStrategy::Unwind {
sess.warn("Profile-guided optimization does not yet work in conjunction \
with `-Cpanic=unwind` on Windows when targeting MSVC. \
See https://github.com/rust-lang/rust/issues/61002 for details.");
sess.panic_strategy() == PanicStrategy::Unwind &&
sess.opts.prints.iter().all(|&p| p == PrintRequest::NativeStaticLibs) {
sess.err("Profile-guided optimization does not yet work in conjunction \
with `-Cpanic=unwind` on Windows when targeting MSVC. \
See https://github.com/rust-lang/rust/issues/61002 for details.");
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/librustc/traits/specialize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,13 @@ pub(super) fn specialization_graph_provider(
}
}

for cause in &overlap.intercrate_ambiguity_causes {
cause.add_intercrate_ambiguity_hint(&mut err);
let access_levels = tcx.privacy_access_levels(impl_def_id.krate);
if let Some(id) = tcx.hir().as_local_hir_id(impl_def_id) {
if access_levels.is_exported(id) || access_levels.is_public(id) {
for cause in &overlap.intercrate_ambiguity_causes {
cause.add_intercrate_ambiguity_hint(&mut err);
}
}
}

if overlap.involves_placeholder {
Expand Down
20 changes: 14 additions & 6 deletions src/librustc_interface/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,12 +688,20 @@ fn write_out_deps(sess: &Session, outputs: &OutputFilenames, out_filenames: &[Pa
Ok(())
})();

if let Err(e) = result {
sess.fatal(&format!(
"error writing dependencies to `{}`: {}",
deps_filename.display(),
e
));
match result {
Ok(_) => {
if sess.opts.debugging_opts.emit_artifact_notifications {
sess.parse_sess.span_diagnostic
.emit_artifact_notification(&deps_filename, "dep-info");
}
},
Err(e) => {
sess.fatal(&format!(
"error writing dependencies to `{}`: {}",
deps_filename.display(),
e
))
}
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/librustc_target/spec/arm_wrs_vxworks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn target() -> TargetResult {
target_endian: "little".to_string(),
target_pointer_width: "32".to_string(),
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "vxworks".to_string(),
target_env: "gnu".to_string(),
Expand All @@ -19,12 +19,11 @@ pub fn target() -> TargetResult {

options: TargetOptions {
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(),
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
cpu: "generic".to_string(),
max_atomic_width: Some(64),
abi_blacklist: super::arm_base::abi_blacklist(),
target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
// tls_model: "local-exec".to_string(),
position_independent_executables: false,
.. base
}
Expand Down
5 changes: 2 additions & 3 deletions src/librustc_target/spec/armv7_wrs_vxworks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn target() -> TargetResult {
target_endian: "little".to_string(),
target_pointer_width: "32".to_string(),
target_c_int_width: "32".to_string(),
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "vxworks".to_string(),
target_env: "gnu".to_string(),
Expand All @@ -19,12 +19,11 @@ pub fn target() -> TargetResult {

options: TargetOptions {
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(),
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
cpu: "generic".to_string(),
max_atomic_width: Some(64),
abi_blacklist: super::arm_base::abi_blacklist(),
target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
// tls_model: "local-exec".to_string(),
position_independent_executables: false,
.. base
}
Expand Down
7 changes: 5 additions & 2 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ fn check_opaque<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, substs: SubstsRef<'tcx>,
tcx.sess, span, E0720,
"opaque type expands to a recursive type",
);
err.span_label(span, "expands to self-referential type");
err.span_label(span, "expands to a recursive type");
if let ty::Opaque(..) = partially_expanded_type.sty {
err.note("type resolves to itself");
} else {
Expand Down Expand Up @@ -1442,11 +1442,14 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_>, id: DefId, span: Span)
return
}

// For the wasm32 target statics with #[link_section] are placed into custom
// For the wasm32 target statics with `#[link_section]` are placed into custom
// sections of the final output file, but this isn't link custom sections of
// other executable formats. Namely we can only embed a list of bytes,
// nothing with pointers to anything else or relocations. If any relocation
// show up, reject them here.
// `#[link_section]` may contain arbitrary, or even undefined bytes, but it is
// the consumer's responsibility to ensure all bytes that have been read
// have defined values.
let instance = ty::Instance::mono(tcx, id);
let cid = GlobalId {
instance,
Expand Down
10 changes: 7 additions & 3 deletions src/librustc_typeck/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,10 @@ fn check_method_receiver<'fcx, 'tcx>(
method: &ty::AssocItem,
self_ty: Ty<'tcx>,
) {
const HELP_FOR_SELF_TYPE: &str =
"consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, \
`self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one \
of the previous types except `Self`)";
// Check that the method has a valid receiver type, given the type `Self`.
debug!("check_method_receiver({:?}, self_ty={:?})",
method, self_ty);
Expand Down Expand Up @@ -805,7 +809,7 @@ fn check_method_receiver<'fcx, 'tcx>(
fcx.tcx.sess.diagnostic().mut_span_err(
span, &format!("invalid method receiver type: {:?}", receiver_ty)
).note("type of `self` must be `Self` or a type that dereferences to it")
.help("consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`")
.help(HELP_FOR_SELF_TYPE)
.code(DiagnosticId::Error("E0307".into()))
.emit();
}
Expand All @@ -823,14 +827,14 @@ fn check_method_receiver<'fcx, 'tcx>(
the `arbitrary_self_types` feature",
receiver_ty,
),
).help("consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`")
).help(HELP_FOR_SELF_TYPE)
.emit();
} else {
// Report error; would not have worked with `arbitrary_self_types`.
fcx.tcx.sess.diagnostic().mut_span_err(
span, &format!("invalid method receiver type: {:?}", receiver_ty)
).note("type must be `Self` or a type that dereferences to it")
.help("consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`")
.help(HELP_FOR_SELF_TYPE)
.code(DiagnosticId::Error("E0307".into()))
.emit();
}
Expand Down
13 changes: 9 additions & 4 deletions src/libstd/io/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,15 @@ pub fn copy<R: ?Sized, W: ?Sized>(reader: &mut R, writer: &mut W) -> io::Result<
where R: Read, W: Write
{
let mut buf = unsafe {
#[allow(deprecated)]
let mut buf: [u8; super::DEFAULT_BUF_SIZE] = mem::uninitialized();
reader.initializer().initialize(&mut buf);
buf
// This is still technically undefined behavior due to creating a reference
// to uninitialized data, but within libstd we can rely on more guarantees
// than if this code were in an external lib

// FIXME: This should probably be changed to an array of `MaybeUninit<u8>`
// once the `mem::MaybeUninit` slice APIs stabilize
let mut buf: mem::MaybeUninit<[u8; super::DEFAULT_BUF_SIZE]> = mem::MaybeUninit::uninit();
reader.initializer().initialize(&mut *buf.as_mut_ptr());
buf.assume_init()
};

let mut written = 0;
Expand Down
21 changes: 0 additions & 21 deletions src/test/run-make-fulldeps/pretty-expanded-hygiene/Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion src/test/run-pass/extern/extern-prelude-core.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer
LL | #![feature(extern_prelude, lang_items, start)]
| ^^^^^^^^^^^^^^
|
= note: #[warn(stable_features)] on by default
= note: `#[warn(stable_features)]` on by default

2 changes: 1 addition & 1 deletion src/test/run-pass/extern/extern-prelude-std.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer
LL | #![feature(extern_prelude)]
| ^^^^^^^^^^^^^^
|
= note: #[warn(stable_features)] on by default
= note: `#[warn(stable_features)]` on by default

2 changes: 1 addition & 1 deletion src/test/run-pass/if-ret.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ warning: unreachable block in `if` expression
LL | fn foo() { if (return) { } }
| ^^^
|
= note: #[warn(unreachable_code)] on by default
= note: `#[warn(unreachable_code)]` on by default

2 changes: 1 addition & 1 deletion src/test/run-pass/macros/macro-use-all-and-none.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ warning: unused attribute
LL | #[macro_use()]
| ^^^^^^^^^^^^^^
|
= note: #[warn(unused_attributes)] on by default
= note: `#[warn(unused_attributes)]` on by default

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer
LL | #![feature(crate_in_paths)]
| ^^^^^^^^^^^^^^
|
= note: #[warn(stable_features)] on by default
= note: `#[warn(stable_features)]` on by default

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer
LL | #![feature(crate_in_paths)]
| ^^^^^^^^^^^^^^
|
= note: #[warn(stable_features)] on by default
= note: `#[warn(stable_features)]` on by default

4 changes: 4 additions & 0 deletions src/test/run-pass/simd/simd-intrinsic-generic-select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#![allow(non_camel_case_types)]

// ignore-emscripten
// ignore-mips behavior of simd_select_bitmask is endian-specific
// ignore-mips64 behavior of simd_select_bitmask is endian-specific
// ignore-powerpc behavior of simd_select_bitmask is endian-specific
// ignore-powerpc64 behavior of simd_select_bitmask is endian-specific

// Test that the simd_select intrinsics produces correct results.

Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc-ui/intra-links-warning-crlf.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ warning: `[error]` cannot be resolved, ignoring it...
LL | /// [error]
| ^^^^^ cannot be resolved, ignoring
|
= note: #[warn(intra_doc_link_resolution_failure)] on by default
= note: `#[warn(intra_doc_link_resolution_failure)]` on by default
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

warning: `[error1]` cannot be resolved, ignoring it...
Expand Down
Loading

0 comments on commit 311376d

Please sign in to comment.