about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/pat.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-01-31 15:01:22 +0000
committerbors <bors@rust-lang.org>2024-01-31 15:01:22 +0000
commit11f32b73e0dc9287e305b5b9980d24aecdc8c17f (patch)
treef07778f3d4e79d2973013519118772697cd03e3b /compiler/rustc_pattern_analysis/src/pat.rs
parentcdaa12e3dff109f72a5a8a0a67ea225052122a79 (diff)
parent4eaf4c261511295483757df8f01f28e0d19349ca (diff)
downloadrust-11f32b73e0dc9287e305b5b9980d24aecdc8c17f.tar.gz
rust-11f32b73e0dc9287e305b5b9980d24aecdc8c17f.zip
Auto merge of #120524 - Nadrieril:rollup-67952ib, r=Nadrieril
Rollup of 9 pull requests

Successful merges:

 - #120207 (check `RUST_BOOTSTRAP_CONFIG` in `profile_user_dist` test)
 - #120321 (pattern_analysis: cleanup the contexts)
 - #120355 (document `FromIterator for Vec` allocation behaviors)
 - #120430 (std: thread_local::register_dtor fix proposal for FreeBSD.)
 - #120469 (Provide more context on derived obligation error primary label)
 - #120472 (Make duplicate lang items fatal)
 - #120490 (Don't hash lints differently to non-lints.)
 - #120495 (Remove the `abi_amdgpu_kernel` feature)
 - #120501 (rustdoc: Correctly handle attribute merge if this is a glob reexport)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/pat.rs')
-rw-r--r--compiler/rustc_pattern_analysis/src/pat.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/rustc_pattern_analysis/src/pat.rs b/compiler/rustc_pattern_analysis/src/pat.rs
index d476766d466..c94d8b93535 100644
--- a/compiler/rustc_pattern_analysis/src/pat.rs
+++ b/compiler/rustc_pattern_analysis/src/pat.rs
@@ -6,7 +6,6 @@ use std::fmt;
 use smallvec::{smallvec, SmallVec};
 
 use crate::constructor::{Constructor, Slice, SliceKind};
-use crate::usefulness::PlaceCtxt;
 use crate::{Captures, TypeCx};
 
 use self::Constructor::*;
@@ -331,9 +330,9 @@ impl<Cx: TypeCx> WitnessPat<Cx> {
     /// Construct a pattern that matches everything that starts with this constructor.
     /// For example, if `ctor` is a `Constructor::Variant` for `Option::Some`, we get the pattern
     /// `Some(_)`.
-    pub(crate) fn wild_from_ctor(pcx: &PlaceCtxt<'_, Cx>, ctor: Constructor<Cx>) -> Self {
-        let fields = pcx.ctor_sub_tys(&ctor).map(|ty| Self::wildcard(ty)).collect();
-        Self::new(ctor, fields, pcx.ty.clone())
+    pub(crate) fn wild_from_ctor(cx: &Cx, ctor: Constructor<Cx>, ty: Cx::Ty) -> Self {
+        let fields = cx.ctor_sub_tys(&ctor, &ty).map(|ty| Self::wildcard(ty)).collect();
+        Self::new(ctor, fields, ty)
     }
 
     pub fn ctor(&self) -> &Constructor<Cx> {