mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Prevent include! macro include itself
This commit is contained in:
parent
919747c323
commit
18f88ad10b
2 changed files with 24 additions and 1 deletions
|
@ -279,7 +279,12 @@ fn relative_file(db: &dyn AstDatabase, call_id: MacroCallId, path: &str) -> Opti
|
|||
let call_site = call_id.as_file().original_file(db);
|
||||
let path = RelativePath::new(&path);
|
||||
|
||||
db.resolve_relative_path(call_site, &path)
|
||||
let res = db.resolve_relative_path(call_site, &path)?;
|
||||
// Prevent include itself
|
||||
if res == call_site {
|
||||
return None;
|
||||
}
|
||||
Some(res)
|
||||
}
|
||||
|
||||
fn include_expand(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue