Skip to content

Commit

Permalink
Remove invalid lint when there is a generic argument in prefix path
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Aug 5, 2023
1 parent fca59ab commit c9be1a7
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 c9be1a7

Please sign in to comment.