Static rustc_lint_defs::builtin::LARGE_ASSIGNMENTS

source ·
pub static LARGE_ASSIGNMENTS: &Lint
Expand description

The large_assignments lint detects when objects of large types are being moved around.


let x = [0; 50000];
let y = x;


warning: moving a large value
  --> $DIR/
  let y = x;
          - Copied large value here


When using a large type in a plain assignment or in a function argument, idiomatic code can be inefficient. Ideally appropriate optimizations would resolve this, but such optimizations are only done in a best-effort manner. This lint will trigger on all sites of large moves and thus allow the user to resolve them in code.