Skip to content

Commit

Permalink
Rollup merge of #114503 - chenyukang:yukang-fix-114433-unused-qualifi…
Browse files Browse the repository at this point in the history
…cations, r=compiler-errors

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

Fixes #114433
  • Loading branch information
matthiaskrgr committed Aug 6, 2023
2 parents 1305a43 + c9be1a7 commit 83d84ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#![deny(unused_qualifications)]
// check-pass
fn bar() {
match Option::<Option<()>>::None {
Some(v) => {}
None => {}
}
}

fn main() {}

0 comments on commit 83d84ff

Please sign in to comment.