diff options
| author | Laurențiu Nicola <lnicola@dend.ro> | 2024-01-27 14:18:33 +0200 | 
|---|---|---|
| committer | Laurențiu Nicola <lnicola@dend.ro> | 2024-01-27 14:21:01 +0200 | 
| commit | f5c78955c88ac37b7422bef6ee9ec993c0a5dad2 (patch) | |
| tree | 0e2612a47f528890d719a6f6d698d67b1e2a1412 /compiler/rustc_pattern_analysis/src/lib.rs | |
| parent | 8b6a431b3d3066a54dffc7f16bf658cf5690efc9 (diff) | |
| download | rust-f5c78955c88ac37b7422bef6ee9ec993c0a5dad2.tar.gz rust-f5c78955c88ac37b7422bef6ee9ec993c0a5dad2.zip | |
Stop using derivative in rustc_pattern_analysis
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/lib.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/lib.rs | 20 | 
1 files changed, 16 insertions, 4 deletions
| diff --git a/compiler/rustc_pattern_analysis/src/lib.rs b/compiler/rustc_pattern_analysis/src/lib.rs index 6374874165f..a53d7a0d809 100644 --- a/compiler/rustc_pattern_analysis/src/lib.rs +++ b/compiler/rustc_pattern_analysis/src/lib.rs @@ -136,23 +136,35 @@ pub trait TypeCx: Sized + fmt::Debug { } /// Context that provides information global to a match. -#[derive(derivative::Derivative)] -#[derivative(Clone(bound = ""), Copy(bound = ""))] pub struct MatchCtxt<'a, Cx: TypeCx> { /// The context for type information. pub tycx: &'a Cx, } +impl<'a, Cx: TypeCx> Clone for MatchCtxt<'a, Cx> { + fn clone(&self) -> Self { + Self { tycx: self.tycx } + } +} + +impl<'a, Cx: TypeCx> Copy for MatchCtxt<'a, Cx> {} + /// The arm of a match expression. #[derive(Debug)] -#[derive(derivative::Derivative)] -#[derivative(Clone(bound = ""), Copy(bound = ""))] pub struct MatchArm<'p, Cx: TypeCx> { pub pat: &'p DeconstructedPat<'p, Cx>, pub has_guard: bool, pub arm_data: Cx::ArmData, } +impl<'p, Cx: TypeCx> 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> {} + /// 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")] | 
