From c12b4aade031e4ca4babb9cdfbe53f466ae76462 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 9 Apr 2025 15:45:25 +1000 Subject: [PATCH] Use a dummy ident for a `lint_if_path_starts_with_module` call. This is pretty weird code. As the `HACK` comment indicates, we push the empty ident here only to make the path longer, so certain checks to occur within `lint_if_path_starts_with_module`. `dummy` is a better choice because it explicitly communicates that the actual value doesn't matter. --- compiler/rustc_resolve/src/imports.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 3f3b455f4db..762e08b2be5 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -1012,7 +1012,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // HACK(eddyb) `lint_if_path_starts_with_module` needs at least // 2 segments, so the `resolve_path` above won't trigger it. let mut full_path = import.module_path.clone(); - full_path.push(Segment::from_ident(Ident::empty())); + full_path.push(Segment::from_ident(Ident::dummy())); self.lint_if_path_starts_with_module(Some(finalize), &full_path, None); }