Skip to content

Commit 311376d

Browse files
committed
Auto merge of #62782 - Mark-Simulacrum:rollup-1hz5ya6, r=Mark-Simulacrum
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
2 parents 4ed008a + 396903b commit 311376d

File tree

210 files changed

+319
-299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+319
-299
lines changed

src/bootstrap/native.rs

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ impl Step for Llvm {
150150
.define("WITH_POLLY", "OFF")
151151
.define("LLVM_ENABLE_TERMINFO", "OFF")
152152
.define("LLVM_ENABLE_LIBEDIT", "OFF")
153+
.define("LLVM_ENABLE_Z3_SOLVER", "OFF")
153154
.define("LLVM_PARALLEL_COMPILE_JOBS", builder.jobs().to_string())
154155
.define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
155156
.define("LLVM_DEFAULT_TARGET_TRIPLE", target);

src/liballoc/collections/vec_deque.rs

+6
Original file line numberDiff line numberDiff line change
@@ -2721,6 +2721,9 @@ impl<T: fmt::Debug> fmt::Debug for VecDeque<T> {
27212721
impl<T> From<Vec<T>> for VecDeque<T> {
27222722
/// Turn a [`Vec<T>`] into a [`VecDeque<T>`].
27232723
///
2724+
/// [`Vec<T>`]: crate::vec::Vec
2725+
/// [`VecDeque<T>`]: crate::collections::VecDeque
2726+
///
27242727
/// This avoids reallocating where possible, but the conditions for that are
27252728
/// strict, and subject to change, and so shouldn't be relied upon unless the
27262729
/// `Vec<T>` came from `From<VecDeque<T>>` and hasn't been reallocated.
@@ -2752,6 +2755,9 @@ impl<T> From<Vec<T>> for VecDeque<T> {
27522755
impl<T> From<VecDeque<T>> for Vec<T> {
27532756
/// Turn a [`VecDeque<T>`] into a [`Vec<T>`].
27542757
///
2758+
/// [`Vec<T>`]: crate::vec::Vec
2759+
/// [`VecDeque<T>`]: crate::collections::VecDeque
2760+
///
27552761
/// This never needs to re-allocate, but does need to do O(n) data movement if
27562762
/// the circular buffer doesn't happen to be at the beginning of the allocation.
27572763
///

src/libcore/convert.rs

+1
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ pub trait TryInto<T>: Sized {
477477
/// [`TryInto`]: trait.TryInto.html
478478
/// [`i32::MAX`]: ../../std/i32/constant.MAX.html
479479
/// [`!`]: ../../std/primitive.never.html
480+
/// [`Infallible`]: enum.Infallible.html
480481
#[stable(feature = "try_from", since = "1.34.0")]
481482
pub trait TryFrom<T>: Sized {
482483
/// The type returned in the event of a conversion error.

src/libcore/slice/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ impl<T> [T] {
611611
///
612612
/// See [`chunks_exact`] for a variant of this iterator that returns chunks of always exactly
613613
/// `chunk_size` elements, and [`rchunks`] for the same iterator but starting at the end of the
614-
/// slice of the slice.
614+
/// slice.
615615
///
616616
/// # Panics
617617
///
@@ -645,7 +645,7 @@ impl<T> [T] {
645645
///
646646
/// See [`chunks_exact_mut`] for a variant of this iterator that returns chunks of always
647647
/// exactly `chunk_size` elements, and [`rchunks_mut`] for the same iterator but starting at
648-
/// the end of the slice of the slice.
648+
/// the end of the slice.
649649
///
650650
/// # Panics
651651
///
@@ -727,7 +727,7 @@ impl<T> [T] {
727727
///
728728
/// See [`chunks_mut`] for a variant of this iterator that also returns the remainder as a
729729
/// smaller chunk, and [`rchunks_exact_mut`] for the same iterator but starting at the end of
730-
/// the slice of the slice.
730+
/// the slice.
731731
///
732732
/// # Panics
733733
///

src/librustc/lint/builtin.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,19 @@ declare_lint! {
9494
declare_lint! {
9595
pub UNUSED_FEATURES,
9696
Warn,
97-
"unused features found in crate-level #[feature] directives"
97+
"unused features found in crate-level `#[feature]` directives"
9898
}
9999

100100
declare_lint! {
101101
pub STABLE_FEATURES,
102102
Warn,
103-
"stable features found in #[feature] directive"
103+
"stable features found in `#[feature]` directive"
104104
}
105105

106106
declare_lint! {
107107
pub UNKNOWN_CRATE_TYPES,
108108
Deny,
109-
"unknown crate type found in #[crate_type] directive"
109+
"unknown crate type found in `#[crate_type]` directive"
110110
}
111111

112112
declare_lint! {

src/librustc/lint/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
671671
sess.diag_note_once(
672672
&mut err,
673673
DiagnosticMessageId::from(lint),
674-
&format!("#[{}({})] on by default", level.as_str(), name));
674+
&format!("`#[{}({})]` on by default", level.as_str(), name));
675675
}
676676
LintSource::CommandLine(lint_flag_val) => {
677677
let flag = match level {
@@ -706,7 +706,7 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
706706
if lint_attr_name.as_str() != name {
707707
let level_str = level.as_str();
708708
sess.diag_note_once(&mut err, DiagnosticMessageId::from(lint),
709-
&format!("#[{}({})] implied by #[{}({})]",
709+
&format!("`#[{}({})]` implied by `#[{}({})]`",
710710
level_str, name, level_str, lint_attr_name));
711711
}
712712
}

src/librustc/session/mod.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::lint;
99
use crate::lint::builtin::BuiltinLintDiagnostics;
1010
use crate::middle::allocator::AllocatorKind;
1111
use crate::middle::dependency_format;
12-
use crate::session::config::{OutputType, SwitchWithOptPath};
12+
use crate::session::config::{OutputType, PrintRequest, SwitchWithOptPath};
1313
use crate::session::search_paths::{PathKind, SearchPath};
1414
use crate::util::nodemap::{FxHashMap, FxHashSet};
1515
use crate::util::common::{duration_to_secs_str, ErrorReported};
@@ -1303,15 +1303,18 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
13031303
}
13041304

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

src/librustc/traits/specialize/mod.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,13 @@ pub(super) fn specialization_graph_provider(
366366
}
367367
}
368368

369-
for cause in &overlap.intercrate_ambiguity_causes {
370-
cause.add_intercrate_ambiguity_hint(&mut err);
369+
let access_levels = tcx.privacy_access_levels(impl_def_id.krate);
370+
if let Some(id) = tcx.hir().as_local_hir_id(impl_def_id) {
371+
if access_levels.is_exported(id) || access_levels.is_public(id) {
372+
for cause in &overlap.intercrate_ambiguity_causes {
373+
cause.add_intercrate_ambiguity_hint(&mut err);
374+
}
375+
}
371376
}
372377

373378
if overlap.involves_placeholder {

src/librustc_interface/passes.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -688,12 +688,20 @@ fn write_out_deps(sess: &Session, outputs: &OutputFilenames, out_filenames: &[Pa
688688
Ok(())
689689
})();
690690

691-
if let Err(e) = result {
692-
sess.fatal(&format!(
693-
"error writing dependencies to `{}`: {}",
694-
deps_filename.display(),
695-
e
696-
));
691+
match result {
692+
Ok(_) => {
693+
if sess.opts.debugging_opts.emit_artifact_notifications {
694+
sess.parse_sess.span_diagnostic
695+
.emit_artifact_notification(&deps_filename, "dep-info");
696+
}
697+
},
698+
Err(e) => {
699+
sess.fatal(&format!(
700+
"error writing dependencies to `{}`: {}",
701+
deps_filename.display(),
702+
e
703+
))
704+
}
697705
}
698706
}
699707

src/librustc_target/spec/arm_wrs_vxworks.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn target() -> TargetResult {
1010
target_endian: "little".to_string(),
1111
target_pointer_width: "32".to_string(),
1212
target_c_int_width: "32".to_string(),
13-
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
13+
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
1414
arch: "arm".to_string(),
1515
target_os: "vxworks".to_string(),
1616
target_env: "gnu".to_string(),
@@ -19,12 +19,11 @@ pub fn target() -> TargetResult {
1919

2020
options: TargetOptions {
2121
// Info about features at https://wiki.debian.org/ArmHardFloatPort
22-
features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(),
22+
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
2323
cpu: "generic".to_string(),
2424
max_atomic_width: Some(64),
2525
abi_blacklist: super::arm_base::abi_blacklist(),
2626
target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
27-
// tls_model: "local-exec".to_string(),
2827
position_independent_executables: false,
2928
.. base
3029
}

src/librustc_target/spec/armv7_wrs_vxworks.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn target() -> TargetResult {
1010
target_endian: "little".to_string(),
1111
target_pointer_width: "32".to_string(),
1212
target_c_int_width: "32".to_string(),
13-
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
13+
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
1414
arch: "arm".to_string(),
1515
target_os: "vxworks".to_string(),
1616
target_env: "gnu".to_string(),
@@ -19,12 +19,11 @@ pub fn target() -> TargetResult {
1919

2020
options: TargetOptions {
2121
// Info about features at https://wiki.debian.org/ArmHardFloatPort
22-
features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(),
22+
features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(),
2323
cpu: "generic".to_string(),
2424
max_atomic_width: Some(64),
2525
abi_blacklist: super::arm_base::abi_blacklist(),
2626
target_mcount: "\u{1}__gnu_mcount_nc".to_string(),
27-
// tls_model: "local-exec".to_string(),
2827
position_independent_executables: false,
2928
.. base
3029
}

src/librustc_typeck/check/mod.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,7 @@ fn check_opaque<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, substs: SubstsRef<'tcx>,
13211321
tcx.sess, span, E0720,
13221322
"opaque type expands to a recursive type",
13231323
);
1324-
err.span_label(span, "expands to self-referential type");
1324+
err.span_label(span, "expands to a recursive type");
13251325
if let ty::Opaque(..) = partially_expanded_type.sty {
13261326
err.note("type resolves to itself");
13271327
} else {
@@ -1442,11 +1442,14 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_>, id: DefId, span: Span)
14421442
return
14431443
}
14441444

1445-
// For the wasm32 target statics with #[link_section] are placed into custom
1445+
// For the wasm32 target statics with `#[link_section]` are placed into custom
14461446
// sections of the final output file, but this isn't link custom sections of
14471447
// other executable formats. Namely we can only embed a list of bytes,
14481448
// nothing with pointers to anything else or relocations. If any relocation
14491449
// show up, reject them here.
1450+
// `#[link_section]` may contain arbitrary, or even undefined bytes, but it is
1451+
// the consumer's responsibility to ensure all bytes that have been read
1452+
// have defined values.
14501453
let instance = ty::Instance::mono(tcx, id);
14511454
let cid = GlobalId {
14521455
instance,

src/librustc_typeck/check/wfcheck.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,10 @@ fn check_method_receiver<'fcx, 'tcx>(
769769
method: &ty::AssocItem,
770770
self_ty: Ty<'tcx>,
771771
) {
772+
const HELP_FOR_SELF_TYPE: &str =
773+
"consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, \
774+
`self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one \
775+
of the previous types except `Self`)";
772776
// Check that the method has a valid receiver type, given the type `Self`.
773777
debug!("check_method_receiver({:?}, self_ty={:?})",
774778
method, self_ty);
@@ -805,7 +809,7 @@ fn check_method_receiver<'fcx, 'tcx>(
805809
fcx.tcx.sess.diagnostic().mut_span_err(
806810
span, &format!("invalid method receiver type: {:?}", receiver_ty)
807811
).note("type of `self` must be `Self` or a type that dereferences to it")
808-
.help("consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`")
812+
.help(HELP_FOR_SELF_TYPE)
809813
.code(DiagnosticId::Error("E0307".into()))
810814
.emit();
811815
}
@@ -823,14 +827,14 @@ fn check_method_receiver<'fcx, 'tcx>(
823827
the `arbitrary_self_types` feature",
824828
receiver_ty,
825829
),
826-
).help("consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`")
830+
).help(HELP_FOR_SELF_TYPE)
827831
.emit();
828832
} else {
829833
// Report error; would not have worked with `arbitrary_self_types`.
830834
fcx.tcx.sess.diagnostic().mut_span_err(
831835
span, &format!("invalid method receiver type: {:?}", receiver_ty)
832836
).note("type must be `Self` or a type that dereferences to it")
833-
.help("consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`")
837+
.help(HELP_FOR_SELF_TYPE)
834838
.code(DiagnosticId::Error("E0307".into()))
835839
.emit();
836840
}

src/libstd/io/util.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,15 @@ pub fn copy<R: ?Sized, W: ?Sized>(reader: &mut R, writer: &mut W) -> io::Result<
4444
where R: Read, W: Write
4545
{
4646
let mut buf = unsafe {
47-
#[allow(deprecated)]
48-
let mut buf: [u8; super::DEFAULT_BUF_SIZE] = mem::uninitialized();
49-
reader.initializer().initialize(&mut buf);
50-
buf
47+
// This is still technically undefined behavior due to creating a reference
48+
// to uninitialized data, but within libstd we can rely on more guarantees
49+
// than if this code were in an external lib
50+
51+
// FIXME: This should probably be changed to an array of `MaybeUninit<u8>`
52+
// once the `mem::MaybeUninit` slice APIs stabilize
53+
let mut buf: mem::MaybeUninit<[u8; super::DEFAULT_BUF_SIZE]> = mem::MaybeUninit::uninit();
54+
reader.initializer().initialize(&mut *buf.as_mut_ptr());
55+
buf.assume_init()
5156
};
5257

5358
let mut written = 0;

src/test/run-make-fulldeps/pretty-expanded-hygiene/Makefile

-21
This file was deleted.

src/test/run-pass/extern/extern-prelude-core.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer
44
LL | #![feature(extern_prelude, lang_items, start)]
55
| ^^^^^^^^^^^^^^
66
|
7-
= note: #[warn(stable_features)] on by default
7+
= note: `#[warn(stable_features)]` on by default
88

src/test/run-pass/extern/extern-prelude-std.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer
44
LL | #![feature(extern_prelude)]
55
| ^^^^^^^^^^^^^^
66
|
7-
= note: #[warn(stable_features)] on by default
7+
= note: `#[warn(stable_features)]` on by default
88

src/test/run-pass/if-ret.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ warning: unreachable block in `if` expression
44
LL | fn foo() { if (return) { } }
55
| ^^^
66
|
7-
= note: #[warn(unreachable_code)] on by default
7+
= note: `#[warn(unreachable_code)]` on by default
88

src/test/run-pass/macros/macro-use-all-and-none.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ warning: unused attribute
44
LL | #[macro_use()]
55
| ^^^^^^^^^^^^^^
66
|
7-
= note: #[warn(unused_attributes)] on by default
7+
= note: `#[warn(unused_attributes)]` on by default
88

src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer
44
LL | #![feature(crate_in_paths)]
55
| ^^^^^^^^^^^^^^
66
|
7-
= note: #[warn(stable_features)] on by default
7+
= note: `#[warn(stable_features)]` on by default
88

src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer
44
LL | #![feature(crate_in_paths)]
55
| ^^^^^^^^^^^^^^
66
|
7-
= note: #[warn(stable_features)] on by default
7+
= note: `#[warn(stable_features)]` on by default
88

src/test/run-pass/simd/simd-intrinsic-generic-select.rs

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
#![allow(non_camel_case_types)]
33

44
// ignore-emscripten
5+
// ignore-mips behavior of simd_select_bitmask is endian-specific
6+
// ignore-mips64 behavior of simd_select_bitmask is endian-specific
7+
// ignore-powerpc behavior of simd_select_bitmask is endian-specific
8+
// ignore-powerpc64 behavior of simd_select_bitmask is endian-specific
59

610
// Test that the simd_select intrinsics produces correct results.
711

src/test/rustdoc-ui/intra-links-warning-crlf.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ warning: `[error]` cannot be resolved, ignoring it...
44
LL | /// [error]
55
| ^^^^^ cannot be resolved, ignoring
66
|
7-
= note: #[warn(intra_doc_link_resolution_failure)] on by default
7+
= note: `#[warn(intra_doc_link_resolution_failure)]` on by default
88
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
99

1010
warning: `[error1]` cannot be resolved, ignoring it...

0 commit comments

Comments
 (0)