about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authoryukang <moorekang@gmail.com>2023-08-05 15:58:26 +0800
committeryukang <moorekang@gmail.com>2023-08-05 15:58:26 +0800
commitc9be1a71b69fb99f9a10b1ba058138d374b5b3a9 (patch)
tree20f75d34e5e01749b55c6e08124f6c5adf4c50d4 /compiler/rustc_resolve/src
parentfca59ab5f0e7df7d816bed77a32abc0045ebe80b (diff)
downloadrust-c9be1a71b69fb99f9a10b1ba058138d374b5b3a9.tar.gz
rust-c9be1a71b69fb99f9a10b1ba058138d374b5b3a9.zip
Remove invalid lint when there is a generic argument in prefix path
Diffstat (limited to 'compiler/rustc_resolve/src')
-rw-r--r--compiler/rustc_resolve/src/late.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs
index 7b590d16d8c..06da00f1135 100644
--- a/compiler/rustc_resolve/src/late.rs
+++ b/compiler/rustc_resolve/src/late.rs
@@ -3944,11 +3944,12 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
 
         if path.len() > 1
             && let Some(res) = result.full_res()
+            && let Some((&last_segment, prev_segs)) = path.split_last()
+            && prev_segs.iter().all(|seg| !seg.has_generic_args)
             && res != Res::Err
             && path[0].ident.name != kw::PathRoot
             && path[0].ident.name != kw::DollarCrate
         {
-            let last_segment = *path.last().unwrap();
             let unqualified_result = {
                 match self.resolve_path(&[last_segment], Some(ns), None) {
                     PathResult::NonModule(path_res) => path_res.expect_full_res(),