mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 16:15:03 +00:00
Rollup merge of #55879 - Xanewok:dont-panic-with-globs, r=nrc
save-analysis: Don't panic for macro-generated use globs
Follow-up to c2bb7cadf2
- as before, ignore the use globs in macro expansions.
Fixes https://github.com/rust-lang-nursery/rls/issues/1117.
Closes #55480.
r? @nrc
This commit is contained in:
commit
a2774354ee
@ -1254,21 +1254,25 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
|
||||
Vec::new()
|
||||
};
|
||||
|
||||
let sub_span =
|
||||
self.span.sub_span_of_token(use_tree.span, token::BinOp(token::Star));
|
||||
if !self.span.filter_generated(use_tree.span) {
|
||||
let span =
|
||||
self.span_from_span(sub_span.expect("No span found for use glob"));
|
||||
self.dumper.import(&access, Import {
|
||||
kind: ImportKind::GlobUse,
|
||||
ref_id: None,
|
||||
span,
|
||||
alias_span: None,
|
||||
name: "*".to_owned(),
|
||||
value: names.join(", "),
|
||||
parent,
|
||||
});
|
||||
self.write_sub_paths(&path);
|
||||
// Otherwise it's a span with wrong macro expansion info, which
|
||||
// we don't want to track anyway, since it's probably macro-internal `use`
|
||||
if let Some(sub_span) =
|
||||
self.span.sub_span_of_token(use_tree.span, token::BinOp(token::Star))
|
||||
{
|
||||
if !self.span.filter_generated(use_tree.span) {
|
||||
let span = self.span_from_span(sub_span);
|
||||
|
||||
self.dumper.import(&access, Import {
|
||||
kind: ImportKind::GlobUse,
|
||||
ref_id: None,
|
||||
span,
|
||||
alias_span: None,
|
||||
name: "*".to_owned(),
|
||||
value: names.join(", "),
|
||||
parent,
|
||||
});
|
||||
self.write_sub_paths(&path);
|
||||
}
|
||||
}
|
||||
}
|
||||
ast::UseTreeKind::Nested(ref nested_items) => {
|
||||
|
Loading…
Reference in New Issue
Block a user