Skip to content

Commit

Permalink
Fix dead_code lint
Browse files Browse the repository at this point in the history
  • Loading branch information
fee1-dead committed Apr 5, 2022
1 parent e90c1f6 commit 95183ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_passes/src/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
}
return true;
}

// ignore generated `DerivedClone` but do not expose this to users.
if Some(trait_of) == self.tcx.get_diagnostic_item(sym::DerivedClone) {
return true;
}
}
}

Expand Down
1 change: 1 addition & 0 deletions library/core/src/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ pub struct AssertParamIsCopy<T: Copy + ?Sized> {
reason = "deriving hack, should not be public",
issue = "none"
)]
#[rustc_diagnostic_item = "DerivedClone"]
pub trait DerivedClone: Sized {
fn clone(&self) -> Self;
}
Expand Down

0 comments on commit 95183ec

Please sign in to comment.