resolve: Do not build expensive suggestions if they are not actually used

Also remove a redundant parameter from `fn resolve_path(_with_ribs)`, `crate_lint: CrateLint` is a more detailed version of `record_used: bool` with `CrateLint::No` meaning `false` and anything else meaning `true`.
This commit is contained in:
Vadim Petrochenkov 2022-03-23 22:47:19 +03:00
parent 63b8f01bb5
commit 0749ec67bc
22 changed files with 237 additions and 448 deletions

View file

@ -415,7 +415,7 @@ impl<'a> ResolverExpand for Resolver<'a> {
let mut indeterminate = false;
for ns in [TypeNS, ValueNS, MacroNS].iter().copied() {
match self.resolve_path(path, Some(ns), &parent_scope, false, span, CrateLint::No) {
match self.resolve_path(path, Some(ns), &parent_scope, span, CrateLint::No) {
PathResult::Module(ModuleOrUniformRoot::Module(_)) => return Ok(true),
PathResult::NonModule(partial_res) if partial_res.unresolved_segments() == 0 => {
return Ok(true);
@ -579,7 +579,6 @@ impl<'a> Resolver<'a> {
&path,
Some(MacroNS),
parent_scope,
false,
path_span,
CrateLint::No,
) {
@ -1033,9 +1032,8 @@ impl<'a> Resolver<'a> {
&path,
Some(MacroNS),
&parent_scope,
true,
path_span,
CrateLint::No,
CrateLint::SimplePath(ast::CRATE_NODE_ID),
) {
PathResult::NonModule(path_res) if path_res.unresolved_segments() == 0 => {
let res = path_res.base_res();