about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/lib.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-21 17:53:57 +0000
committerbors <bors@rust-lang.org>2024-03-21 17:53:57 +0000
commita0569fa8f91b5271e92d2f73fd252de7d3d05b9c (patch)
treed9b9647a2ed246f09b14d3d73ea765cb558c513a /compiler/rustc_pattern_analysis/src/lib.rs
parent7d01878bd0d1c4383c1158adeff0c392446ea3a2 (diff)
parent6ae51a5fed5569e81cd5c2afa101c27633dad840 (diff)
downloadrust-a0569fa8f91b5271e92d2f73fd252de7d3d05b9c.tar.gz
rust-a0569fa8f91b5271e92d2f73fd252de7d3d05b9c.zip
Auto merge of #122830 - matthiaskrgr:rollup-uk2by3f, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #122402 (Make `#[diagnostic::on_unimplemented]` format string parsing more robust)
 - #122644 (pattern analysis: add a custom test harness)
 - #122733 (Strip placeholders from hidden types before remapping generic parameter)
 - #122752 (Interpolated cleanups)
 - #122771 (add some comments to hir::ModuleItems)
 - #122793 (Implement macro-based deref!() syntax for deref patterns)
 - #122810 (Remove `target_override`)
 - #122827 (Remove unnecessary braces from `bug`/`span_bug`)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/lib.rs')
-rw-r--r--compiler/rustc_pattern_analysis/src/lib.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_pattern_analysis/src/lib.rs b/compiler/rustc_pattern_analysis/src/lib.rs
index 5c57c990323..1a1da5c55f6 100644
--- a/compiler/rustc_pattern_analysis/src/lib.rs
+++ b/compiler/rustc_pattern_analysis/src/lib.rs
@@ -49,6 +49,12 @@ pub mod index {
         }
     }
 
+    impl<V> FromIterator<V> for IdxContainer<usize, V> {
+        fn from_iter<T: IntoIterator<Item = V>>(iter: T) -> Self {
+            Self(iter.into_iter().enumerate().collect())
+        }
+    }
+
     #[derive(Debug)]
     pub struct IdxSet<T>(pub rustc_hash::FxHashSet<T>);
     impl<T: Idx> IdxSet<T> {
@@ -120,7 +126,8 @@ pub trait PatCx: Sized + fmt::Debug {
     /// `DeconstructedPat`. Only invoqued when `pat.ctor()` is `Struct | Variant(_) | UnionField`.
     fn write_variant_name(
         f: &mut fmt::Formatter<'_>,
-        pat: &crate::pat::DeconstructedPat<Self>,
+        ctor: &crate::constructor::Constructor<Self>,
+        ty: &Self::Ty,
     ) -> fmt::Result;
 
     /// Raise a bug.