Skip to content

Commit

Permalink
Rollup merge of #101156 - Jarcho:remove_sync_lint_pass, r=compiler-er…
Browse files Browse the repository at this point in the history
…rors

Remove `Sync` requirement from lint pass objects

This is blocking the clippy sync (#101140). One of the lint passes contains a `Cell` in order to make lifetimes work. It could be worked around, but this is the easier change to make if there are no objections.

Rational for removing the requirement
* All lint pass methods take `&mut self` arguments.
* Many passes depend on running is visitor order.
* Lint passes are created on demand so they're only ever stored in a local.
* `Send` is enough to lint different passes in parallel.

`LintStore` remains `Sync` with this. The constructor functions it contains still maintain their `Sync` requirement.

r? rust-lang/compiler
  • Loading branch information
matthiaskrgr committed Aug 29, 2022
2 parents 7b84298 + 74f2d58 commit bf42ba4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions compiler/rustc_lint/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,5 @@ macro_rules! declare_combined_early_lint_pass {
}

/// A lint pass boxed up as a trait object.
pub type EarlyLintPassObject = Box<dyn EarlyLintPass + sync::Send + sync::Sync + 'static>;
pub type LateLintPassObject =
Box<dyn for<'tcx> LateLintPass<'tcx> + sync::Send + sync::Sync + 'static>;
pub type EarlyLintPassObject = Box<dyn EarlyLintPass + sync::Send + 'static>;
pub type LateLintPassObject = Box<dyn for<'tcx> LateLintPass<'tcx> + sync::Send + 'static>;

0 comments on commit bf42ba4

Please sign in to comment.