Skip to content

Commit eba8e10

Browse files
borsMuscraft
authored andcommitted
Auto merge of rust-lang#144219 - GuillaumeGomez:rollup-ha29sql, r=GuillaumeGomez
Rollup of 9 pull requests Successful merges: - rust-lang#143282 (Add `uX::strict_sub_signed`) - rust-lang#143423 (address clippy formatting nits) - rust-lang#143720 (Allow `Rvalue::Repeat` to return true in `rvalue_creates_operand` too) - rust-lang#144011 (bootstrap: Don't trigger an unnecessary LLVM build from check builds) - rust-lang#144112 (bootstrap: Ignore `rust.debuginfo-level-tests` for codegen tests) - rust-lang#144125 (Add new `ignore-backends` and `needs-backends` tests annotations) - rust-lang#144143 (Fix `-Ctarget-feature`s getting ignored after `crt-static`) - rust-lang#144150 (tests: assembly: cstring-merging: Disable GlobalMerge pass) - rust-lang#144190 (Give a message with a span on MIR validation error) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 6519063 + 9516fdd commit eba8e10

File tree

31 files changed

+350
-88
lines changed

31 files changed

+350
-88
lines changed

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,17 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
630630
OperandRef { val: OperandValue::Immediate(static_), layout }
631631
}
632632
mir::Rvalue::Use(ref operand) => self.codegen_operand(bx, operand),
633-
mir::Rvalue::Repeat(..) => bug!("{rvalue:?} in codegen_rvalue_operand"),
633+
mir::Rvalue::Repeat(ref elem, len_const) => {
634+
// All arrays have `BackendRepr::Memory`, so only the ZST cases
635+
// end up here. Anything else forces the destination local to be
636+
// `Memory`, and thus ends up handled in `codegen_rvalue` instead.
637+
let operand = self.codegen_operand(bx, elem);
638+
let array_ty = Ty::new_array_with_const_len(bx.tcx(), operand.layout.ty, len_const);
639+
let array_ty = self.monomorphize(array_ty);
640+
let array_layout = bx.layout_of(array_ty);
641+
assert!(array_layout.is_zst());
642+
OperandRef { val: OperandValue::ZeroSized, layout: array_layout }
643+
}
634644
mir::Rvalue::Aggregate(ref kind, ref fields) => {
635645
let (variant_index, active_field_index) = match **kind {
636646
mir::AggregateKind::Adt(_, variant_index, _, _, active_field_index) => {
@@ -1000,12 +1010,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
10001010
mir::Rvalue::NullaryOp(..) |
10011011
mir::Rvalue::ThreadLocalRef(_) |
10021012
mir::Rvalue::Use(..) |
1013+
mir::Rvalue::Repeat(..) | // (*)
10031014
mir::Rvalue::Aggregate(..) | // (*)
10041015
mir::Rvalue::WrapUnsafeBinder(..) => // (*)
10051016
true,
1006-
// Arrays are always aggregates, so it's not worth checking anything here.
1007-
// (If it's really `[(); N]` or `[T; 0]` and we use the place path, fine.)
1008-
mir::Rvalue::Repeat(..) => false,
10091017
}
10101018

10111019
// (*) this is only true if the type is suitable

compiler/rustc_codegen_ssa/src/target_features.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,14 @@ fn parse_rust_feature_flag<'a>(
149149
if let Some(base_feature) = feature.strip_prefix('+') {
150150
// Skip features that are not target features, but rustc features.
151151
if RUSTC_SPECIFIC_FEATURES.contains(&base_feature) {
152-
return;
152+
continue;
153153
}
154154

155155
callback(base_feature, sess.target.implied_target_features(base_feature), true)
156156
} else if let Some(base_feature) = feature.strip_prefix('-') {
157157
// Skip features that are not target features, but rustc features.
158158
if RUSTC_SPECIFIC_FEATURES.contains(&base_feature) {
159-
return;
159+
continue;
160160
}
161161

162162
// If `f1` implies `f2`, then `!f2` implies `!f1` -- this is standard logical

compiler/rustc_mir_transform/src/validate.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,16 @@ impl<'a, 'tcx> CfgChecker<'a, 'tcx> {
119119
#[track_caller]
120120
fn fail(&self, location: Location, msg: impl AsRef<str>) {
121121
// We might see broken MIR when other errors have already occurred.
122-
assert!(
123-
self.tcx.dcx().has_errors().is_some(),
124-
"broken MIR in {:?} ({}) at {:?}:\n{}",
125-
self.body.source.instance,
126-
self.when,
127-
location,
128-
msg.as_ref(),
129-
);
122+
if self.tcx.dcx().has_errors().is_none() {
123+
span_bug!(
124+
self.body.source_info(location).span,
125+
"broken MIR in {:?} ({}) at {:?}:\n{}",
126+
self.body.source.instance,
127+
self.when,
128+
location,
129+
msg.as_ref(),
130+
);
131+
}
130132
}
131133

132134
fn check_edge(&mut self, location: Location, bb: BasicBlock, edge_kind: EdgeKind) {

library/core/src/async_iter/async_iter.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ pub trait AsyncIterator {
2828
/// async iterator state:
2929
///
3030
/// - `Poll::Pending` means that this async iterator's next value is not ready
31-
/// yet. Implementations will ensure that the current task will be notified
32-
/// when the next value may be ready.
31+
/// yet. Implementations will ensure that the current task will be notified
32+
/// when the next value may be ready.
3333
///
3434
/// - `Poll::Ready(Some(val))` means that the async iterator has successfully
35-
/// produced a value, `val`, and may produce further values on subsequent
36-
/// `poll_next` calls.
35+
/// produced a value, `val`, and may produce further values on subsequent
36+
/// `poll_next` calls.
3737
///
3838
/// - `Poll::Ready(None)` means that the async iterator has terminated, and
39-
/// `poll_next` should not be invoked again.
39+
/// `poll_next` should not be invoked again.
4040
///
4141
/// # Panics
4242
///

library/core/src/cmp.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,13 +1482,14 @@ pub trait PartialOrd<Rhs: PointeeSized = Self>: PartialEq<Rhs> + PointeeSized {
14821482
}
14831483
}
14841484

1485-
fn default_chaining_impl<T: PointeeSized, U: PointeeSized>(
1485+
fn default_chaining_impl<T, U>(
14861486
lhs: &T,
14871487
rhs: &U,
14881488
p: impl FnOnce(Ordering) -> bool,
14891489
) -> ControlFlow<bool>
14901490
where
1491-
T: PartialOrd<U>,
1491+
T: PartialOrd<U> + PointeeSized,
1492+
U: PointeeSized,
14921493
{
14931494
// It's important that this only call `partial_cmp` once, not call `eq` then
14941495
// one of the relational operators. We don't want to `bcmp`-then-`memcp` a

library/core/src/fmt/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,6 @@ impl Display for Arguments<'_> {
854854
/// }";
855855
/// assert_eq!(format!("The origin is: {origin:#?}"), expected);
856856
/// ```
857-
858857
#[stable(feature = "rust1", since = "1.0.0")]
859858
#[rustc_on_unimplemented(
860859
on(

library/core/src/iter/traits/collect.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,6 @@ pub trait Extend<A> {
436436
/// **For implementors:** For a collection to unsafely rely on this method's safety precondition (that is,
437437
/// invoke UB if they are violated), it must implement `extend_reserve` correctly. In other words,
438438
/// callers may assume that if they `extend_reserve`ed enough space they can call this method.
439-
440439
// This method is for internal usage only. It is only on the trait because of specialization's limitations.
441440
#[unstable(feature = "extend_one_unchecked", issue = "none")]
442441
#[doc(hidden)]

library/core/src/iter/traits/iterator.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3414,10 +3414,10 @@ pub trait Iterator {
34143414
/// ```
34153415
#[stable(feature = "iter_copied", since = "1.36.0")]
34163416
#[rustc_diagnostic_item = "iter_copied"]
3417-
fn copied<'a, T: 'a>(self) -> Copied<Self>
3417+
fn copied<'a, T>(self) -> Copied<Self>
34183418
where
3419+
T: Copy + 'a,
34193420
Self: Sized + Iterator<Item = &'a T>,
3420-
T: Copy,
34213421
{
34223422
Copied::new(self)
34233423
}
@@ -3462,10 +3462,10 @@ pub trait Iterator {
34623462
/// ```
34633463
#[stable(feature = "rust1", since = "1.0.0")]
34643464
#[rustc_diagnostic_item = "iter_cloned"]
3465-
fn cloned<'a, T: 'a>(self) -> Cloned<Self>
3465+
fn cloned<'a, T>(self) -> Cloned<Self>
34663466
where
3467+
T: Clone + 'a,
34673468
Self: Sized + Iterator<Item = &'a T>,
3468-
T: Clone,
34693469
{
34703470
Cloned::new(self)
34713471
}

library/core/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
//! return. You should mark your implementation using `#[panic_handler]`.
4040
//!
4141
//! * `rust_eh_personality` - is used by the failure mechanisms of the
42-
//! compiler. This is often mapped to GCC's personality function, but crates
43-
//! which do not trigger a panic can be assured that this function is never
44-
//! called. The `lang` attribute is called `eh_personality`.
42+
//! compiler. This is often mapped to GCC's personality function, but crates
43+
//! which do not trigger a panic can be assured that this function is never
44+
//! called. The `lang` attribute is called `eh_personality`.
4545
4646
#![stable(feature = "core", since = "1.6.0")]
4747
#![doc(

library/core/src/mem/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub use crate::intrinsics::transmute;
3636
/// * If you want to leak memory, see [`Box::leak`].
3737
/// * If you want to obtain a raw pointer to the memory, see [`Box::into_raw`].
3838
/// * If you want to dispose of a value properly, running its destructor, see
39-
/// [`mem::drop`].
39+
/// [`mem::drop`].
4040
///
4141
/// # Safety
4242
///

0 commit comments

Comments
 (0)