Rollup merge of #114503 - chenyukang:yukang-fix-114433-unused-qualifications, r=compiler-errors

Remove invalid lint when there is a generic argument in prefix path

Fixes #114433
This commit is contained in:
Matthias Krüger 2023-08-06 03:56:09 +02:00 committed by GitHub
commit 83d84ffdd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -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(),

View File

@ -0,0 +1,10 @@
#![deny(unused_qualifications)]
// check-pass
fn bar() {
match Option::<Option<()>>::None {
Some(v) => {}
None => {}
}
}
fn main() {}