1
Fork 0

shrinking the deprecated method span

This commit is contained in:
hi-rustin 2021-05-24 11:41:39 +08:00
parent 6e92fb4098
commit 3efe0174a2
7 changed files with 167 additions and 131 deletions

View file

@ -828,7 +828,15 @@ impl Visitor<'tcx> for Checker<'tcx> {
fn visit_path(&mut self, path: &'tcx hir::Path<'tcx>, id: hir::HirId) {
if let Some(def_id) = path.res.opt_def_id() {
self.tcx.check_stability(def_id, Some(id), path.span, None)
let method_span = if path.segments.len() >= 2 {
match path.segments.last() {
Some(s) => Some(s.ident.span),
None => None,
}
} else {
None
};
self.tcx.check_stability(def_id, Some(id), path.span, method_span)
}
intravisit::walk_path(self, path)
}