mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
fix compilation
This commit is contained in:
parent
14b1f87634
commit
f6c227babd
2 changed files with 5 additions and 5 deletions
|
@ -2,7 +2,7 @@ use std::{collections::HashSet, time::Instant, fmt::Write};
|
||||||
|
|
||||||
use ra_db::SourceDatabase;
|
use ra_db::SourceDatabase;
|
||||||
use ra_batch::BatchDatabase;
|
use ra_batch::BatchDatabase;
|
||||||
use ra_hir::{Crate, ModuleDef, Ty, ImplItem};
|
use ra_hir::{Crate, ModuleDef, Ty, ImplItem, HasSource};
|
||||||
use ra_syntax::AstNode;
|
use ra_syntax::AstNode;
|
||||||
|
|
||||||
use crate::Result;
|
use crate::Result;
|
||||||
|
@ -64,10 +64,10 @@ pub fn run(verbose: bool, path: &str, only: Option<&str>) -> Result<()> {
|
||||||
let name = f.name(&db);
|
let name = f.name(&db);
|
||||||
let mut msg = format!("processing: {}", name);
|
let mut msg = format!("processing: {}", name);
|
||||||
if verbose {
|
if verbose {
|
||||||
let (file_id, source) = f.source(&db);
|
let src = f.source(&db);
|
||||||
let original_file = file_id.original_file(&db);
|
let original_file = src.file_id.original_file(&db);
|
||||||
let path = db.file_relative_path(original_file);
|
let path = db.file_relative_path(original_file);
|
||||||
let syntax_range = source.syntax().range();
|
let syntax_range = src.ast.syntax().range();
|
||||||
write!(msg, " ({:?} {})", path, syntax_range).unwrap();
|
write!(msg, " ({:?} {})", path, syntax_range).unwrap();
|
||||||
}
|
}
|
||||||
bar.set_message(&msg);
|
bar.set_message(&msg);
|
||||||
|
|
|
@ -16,7 +16,7 @@ pub trait HasSource {
|
||||||
fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<Self::Ast>;
|
fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<Self::Ast>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// NB: Module is !HasSource, becase it has two source nodes at the same time:
|
/// NB: Module is !HasSource, because it has two source nodes at the same time:
|
||||||
/// definition and declaration.
|
/// definition and declaration.
|
||||||
impl Module {
|
impl Module {
|
||||||
/// Returns a node which defines this module. That is, a file or a `mod foo {}` with items.
|
/// Returns a node which defines this module. That is, a file or a `mod foo {}` with items.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue