Remove unnecessary Clone/Copy derives from analyses.

No analysis needs `Copy`, and `MaybeBorrowedLocals` is the only analysis
that needs `Clone`. In `locals_live_across_suspend_points` it gets
cloned so it can be used within a `MaybeRequiresStorage`.
This commit is contained in:
Nicholas Nethercote 2024-09-13 09:49:28 +10:00
parent c2f74c3f92
commit 55c9f96265
3 changed files with 1 additions and 4 deletions

View File

@ -11,7 +11,7 @@ use crate::{AnalysisDomain, GenKill, GenKillAnalysis};
/// At present, this is used as a very limited form of alias analysis. For example, /// At present, this is used as a very limited form of alias analysis. For example,
/// `MaybeBorrowedLocals` is used to compute which locals are live during a yield expression for /// `MaybeBorrowedLocals` is used to compute which locals are live during a yield expression for
/// immovable coroutines. /// immovable coroutines.
#[derive(Clone, Copy)] #[derive(Clone)]
pub struct MaybeBorrowedLocals; pub struct MaybeBorrowedLocals;
impl MaybeBorrowedLocals { impl MaybeBorrowedLocals {

View File

@ -217,7 +217,6 @@ impl DefUse {
/// This is basically written for dead store elimination and nothing else. /// This is basically written for dead store elimination and nothing else.
/// ///
/// All of the caveats of `MaybeLiveLocals` apply. /// All of the caveats of `MaybeLiveLocals` apply.
#[derive(Clone, Copy)]
pub struct MaybeTransitiveLiveLocals<'a> { pub struct MaybeTransitiveLiveLocals<'a> {
always_live: &'a BitSet<Local>, always_live: &'a BitSet<Local>,
} }

View File

@ -7,7 +7,6 @@ use rustc_middle::mir::*;
use super::MaybeBorrowedLocals; use super::MaybeBorrowedLocals;
use crate::{GenKill, ResultsCursor}; use crate::{GenKill, ResultsCursor};
#[derive(Clone)]
pub struct MaybeStorageLive<'a> { pub struct MaybeStorageLive<'a> {
always_live_locals: Cow<'a, BitSet<Local>>, always_live_locals: Cow<'a, BitSet<Local>>,
} }
@ -80,7 +79,6 @@ impl<'tcx, 'a> crate::GenKillAnalysis<'tcx> for MaybeStorageLive<'a> {
} }
} }
#[derive(Clone)]
pub struct MaybeStorageDead<'a> { pub struct MaybeStorageDead<'a> {
always_live_locals: Cow<'a, BitSet<Local>>, always_live_locals: Cow<'a, BitSet<Local>>,
} }