-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Description
significant_drop_tightening
is very slow. I tried running clippy with -Aclippy::all -Wclippy::perf
on rustc_borrowck
. (note that it seemed very slow on the entire compiler, so I don't think there's anything specific to borrowck
, it's just very big.
According to a profile, it spends about 66% of time inside has_sig_drop_attr
:
pub(crate) fn has_sig_drop_attr(&mut self, ty: Ty<'tcx>) -> bool { |
More precisely, it seems to spend the time getting the type of fields.
let ty = f.ty(self.cx.tcx, b); |
Inside this function it substitutes the type of the field with the substs (generic parameters) of the type. This folds the type and is a little work. This lint does that little work on everything, turning it into a lot of work. It also does so eagerly recursively which is just a receipe for slowness.
I've got a simple fix, I'll send in a PR.
Version
current master, e64c5961dc7640b4d5529608e0f321d586c027a0, 1.70.0
Additional Labels
@rustbot label +C-bug