diff options
| author | bors <bors@rust-lang.org> | 2024-03-14 04:54:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-03-14 04:54:37 +0000 |
| commit | 6f3eb1ce3d50246b2cbc5de3107c0f34889f5cc6 (patch) | |
| tree | 24622db216461eee386a0bbb8f8a770df871dda4 /compiler/rustc_pattern_analysis/src/lib.rs | |
| parent | 5ac0b2d0219de2fd6fef86c69ef0cfa1e6c36f3b (diff) | |
| parent | c52ce4eabba65fcc47ce92c20c3e7e6dd73f77df (diff) | |
| download | rust-6f3eb1ce3d50246b2cbc5de3107c0f34889f5cc6.tar.gz rust-6f3eb1ce3d50246b2cbc5de3107c0f34889f5cc6.zip | |
Auto merge of #122454 - matthiaskrgr:rollup-xbmufdc, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - #122422 (compiletest: Allow `only-unix` in test headers) - #122424 (fix: typos) - #122425 (Increase timeout for new bors bot) - #122426 (Fix StableMIR `WrappingRange::is_full` computation) - #122429 (Add Exploit Mitigations PG to triagebot.toml) - #122430 (Generate link to `Local` in `hir::Let` documentation) - #122434 (pattern analysis: rename a few types) - #122437 (pattern analysis: remove `MaybeInfiniteInt::JustAfterMax`) - #122438 (Safe Transmute: Require that source referent is smaller than destination) - #122442 (extend docs of -Zprint-mono-items) - #122449 (Delay a bug for stranded opaques) 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.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_pattern_analysis/src/lib.rs b/compiler/rustc_pattern_analysis/src/lib.rs index f632eaf7ea4..5c57c990323 100644 --- a/compiler/rustc_pattern_analysis/src/lib.rs +++ b/compiler/rustc_pattern_analysis/src/lib.rs @@ -84,7 +84,7 @@ pub struct PrivateUninhabitedField(pub bool); /// Context that provides type information about constructors. /// /// Most of the crate is parameterized on a type that implements this trait. -pub trait TypeCx: Sized + fmt::Debug { +pub trait PatCx: Sized + fmt::Debug { /// The type of a pattern. type Ty: Clone + fmt::Debug; /// Errors that can abort analysis. @@ -155,34 +155,34 @@ pub trait TypeCx: Sized + fmt::Debug { /// The arm of a match expression. #[derive(Debug)] -pub struct MatchArm<'p, Cx: TypeCx> { +pub struct MatchArm<'p, Cx: PatCx> { pub pat: &'p DeconstructedPat<Cx>, pub has_guard: bool, pub arm_data: Cx::ArmData, } -impl<'p, Cx: TypeCx> Clone for MatchArm<'p, Cx> { +impl<'p, Cx: PatCx> Clone for MatchArm<'p, Cx> { fn clone(&self) -> Self { Self { pat: self.pat, has_guard: self.has_guard, arm_data: self.arm_data } } } -impl<'p, Cx: TypeCx> Copy for MatchArm<'p, Cx> {} +impl<'p, Cx: PatCx> Copy for MatchArm<'p, Cx> {} /// The entrypoint for this crate. Computes whether a match is exhaustive and which of its arms are /// useful, and runs some lints. #[cfg(feature = "rustc")] pub fn analyze_match<'p, 'tcx>( - tycx: &rustc::RustcMatchCheckCtxt<'p, 'tcx>, + tycx: &rustc::RustcPatCtxt<'p, 'tcx>, arms: &[rustc::MatchArm<'p, 'tcx>], scrut_ty: Ty<'tcx>, pattern_complexity_limit: Option<usize>, ) -> Result<rustc::UsefulnessReport<'p, 'tcx>, ErrorGuaranteed> { use lints::lint_nonexhaustive_missing_variants; - use usefulness::{compute_match_usefulness, ValidityConstraint}; + use usefulness::{compute_match_usefulness, PlaceValidity}; let scrut_ty = tycx.reveal_opaque_ty(scrut_ty); - let scrut_validity = ValidityConstraint::from_bool(tycx.known_valid_scrutinee); + let scrut_validity = PlaceValidity::from_bool(tycx.known_valid_scrutinee); let report = compute_match_usefulness(tycx, arms, scrut_ty, scrut_validity, pattern_complexity_limit)?; |
