Skip to content

Commit 75948c8

Browse files
committed
Auto merge of #148059 - Zalathar:rollup-zkk5prm, r=Zalathar
Rollup of 5 pull requests Successful merges: - #148016 (Revert constification of `Borrow` and `Deref for Cow` due to inference failure) - #148021 ([rustdoc] Simplify module rendering and HTML tags handling) - #148039 (Add myself to the review rotation) - #148042 (test(frontmatter): Cover spaces between infostring parts) - #148054 (Streamline iterator chaining when computing successors.) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 38bc246 + 7141a0f commit 75948c8

File tree

7 files changed

+205
-164
lines changed

7 files changed

+205
-164
lines changed

compiler/rustc_middle/src/mir/terminator.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,8 @@ pub use helper::*;
501501

502502
mod helper {
503503
use super::*;
504+
// Note: the methods below use a `slice.chain(Option).chain(Option)` pattern so that all paths
505+
// produce an iterator with the same concrete type.
504506
pub type Successors<'a> = impl DoubleEndedIterator<Item = BasicBlock> + 'a;
505507

506508
impl SwitchTargets {
@@ -510,7 +512,7 @@ mod helper {
510512
#[define_opaque(Successors)]
511513
pub fn successors_for_value(&self, value: u128) -> Successors<'_> {
512514
let target = self.target_for_value(value);
513-
(&[]).into_iter().copied().chain(Some(target).into_iter().chain(None))
515+
(&[]).into_iter().copied().chain(Some(target)).chain(None)
514516
}
515517
}
516518

@@ -522,10 +524,7 @@ mod helper {
522524
match *self {
523525
// 3-successors for async drop: target, unwind, dropline (parent coroutine drop)
524526
Drop { target: ref t, unwind: UnwindAction::Cleanup(u), drop: Some(d), .. } => {
525-
slice::from_ref(t)
526-
.into_iter()
527-
.copied()
528-
.chain(Some(u).into_iter().chain(Some(d)))
527+
slice::from_ref(t).into_iter().copied().chain(Some(u)).chain(Some(d))
529528
}
530529
// 2-successors
531530
Call { target: Some(ref t), unwind: UnwindAction::Cleanup(u), .. }
@@ -534,7 +533,7 @@ mod helper {
534533
| Drop { target: ref t, unwind: _, drop: Some(u), .. }
535534
| Assert { target: ref t, unwind: UnwindAction::Cleanup(u), .. }
536535
| FalseUnwind { real_target: ref t, unwind: UnwindAction::Cleanup(u) } => {
537-
slice::from_ref(t).into_iter().copied().chain(Some(u).into_iter().chain(None))
536+
slice::from_ref(t).into_iter().copied().chain(Some(u)).chain(None)
538537
}
539538
// single successor
540539
Goto { target: ref t }
@@ -544,7 +543,7 @@ mod helper {
544543
| Drop { target: ref t, unwind: _, .. }
545544
| Assert { target: ref t, unwind: _, .. }
546545
| FalseUnwind { real_target: ref t, unwind: _ } => {
547-
slice::from_ref(t).into_iter().copied().chain(None.into_iter().chain(None))
546+
slice::from_ref(t).into_iter().copied().chain(None).chain(None)
548547
}
549548
// No successors
550549
UnwindResume
@@ -554,23 +553,24 @@ mod helper {
554553
| Unreachable
555554
| TailCall { .. }
556555
| Call { target: None, unwind: _, .. } => {
557-
(&[]).into_iter().copied().chain(None.into_iter().chain(None))
556+
(&[]).into_iter().copied().chain(None).chain(None)
558557
}
559558
// Multiple successors
560559
InlineAsm { ref targets, unwind: UnwindAction::Cleanup(u), .. } => {
561-
targets.iter().copied().chain(Some(u).into_iter().chain(None))
560+
targets.iter().copied().chain(Some(u)).chain(None)
562561
}
563562
InlineAsm { ref targets, unwind: _, .. } => {
564-
targets.iter().copied().chain(None.into_iter().chain(None))
563+
targets.iter().copied().chain(None).chain(None)
565564
}
566565
SwitchInt { ref targets, .. } => {
567-
targets.targets.iter().copied().chain(None.into_iter().chain(None))
566+
targets.targets.iter().copied().chain(None).chain(None)
568567
}
569568
// FalseEdge
570569
FalseEdge { ref real_target, imaginary_target } => slice::from_ref(real_target)
571570
.into_iter()
572571
.copied()
573-
.chain(Some(imaginary_target).into_iter().chain(None)),
572+
.chain(Some(imaginary_target))
573+
.chain(None),
574574
}
575575
}
576576

library/alloc/src/borrow.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ use crate::fmt;
1616
#[cfg(not(no_global_oom_handling))]
1717
use crate::string::String;
1818

19+
// FIXME(inference): const bounds removed due to inference regressions found by crater;
20+
// see https://github.com/rust-lang/rust/issues/147964
21+
// #[rustc_const_unstable(feature = "const_convert", issue = "143773")]
1922
#[stable(feature = "rust1", since = "1.0.0")]
20-
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
21-
impl<'a, B: ?Sized> const Borrow<B> for Cow<'a, B>
22-
where
23-
B: ToOwned,
24-
B::Owned: [const] Borrow<B>,
23+
impl<'a, B: ?Sized + ToOwned> Borrow<B> for Cow<'a, B>
24+
// where
25+
// B::Owned: [const] Borrow<B>,
2526
{
2627
fn borrow(&self) -> &B {
2728
&**self
@@ -327,11 +328,13 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> {
327328
}
328329
}
329330

331+
// FIXME(inference): const bounds removed due to inference regressions found by crater;
332+
// see https://github.com/rust-lang/rust/issues/147964
333+
// #[rustc_const_unstable(feature = "const_convert", issue = "143773")]
330334
#[stable(feature = "rust1", since = "1.0.0")]
331-
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
332-
impl<B: ?Sized + ToOwned> const Deref for Cow<'_, B>
333-
where
334-
B::Owned: [const] Borrow<B>,
335+
impl<B: ?Sized + ToOwned> Deref for Cow<'_, B>
336+
// where
337+
// B::Owned: [const] Borrow<B>,
335338
{
336339
type Target = B;
337340

0 commit comments

Comments
 (0)