Skip to content

[NLL] used-mut lint has an O(n^2) loop #51641

Closed
@nikomatsakis

Description

@nikomatsakis

The following snippet of code is an O(n^2) loop:

https://gist.github.com/lqd/7e178cb9ac8302e24272965048627f21#file-mod-rs-L243-L256

The problem is that we are iterating over each temporary and then invoking find_assignments, which basically walks over the MIR again. What we really want to be doing is walking the MIR at most once (ideally, coallesced into some other walk) and registered the "used mut" assignments.

Metadata

Metadata

Assignees

Labels

A-NLLArea: Non-lexical lifetimes (NLL)C-enhancementCategory: An issue proposing an enhancement or a PR with one.NLL-performantWorking towards the "performance is good" goalT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions