2500: Fix format_args expansion & go to definition r=matklad a=flodiebold

The expansion of format_args wasn't yet correct enough to type-check. Also make macros in statement position expand to expressions for now, since it's not handled correctly in HIR lowering yet. This finally fixes go to definition within print macros, I think 🙂 

2505: Remove more dead code r=matklad a=matklad



2506: Remove one more Ty r=matklad a=matklad



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2019-12-08 16:53:21 +00:00 committed by GitHub
commit 6b1c2ee168
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 31 additions and 140 deletions

View file

@ -27,7 +27,7 @@ pub(super) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) {
complete_methods(acc, ctx, &receiver_ty);
// Suggest .await syntax for types that implement Future trait
if ctx.analyzer.impls_future(ctx.db, receiver_ty.into_ty()) {
if ctx.analyzer.impls_future(ctx.db, receiver_ty) {
CompletionItem::new(CompletionKind::Keyword, ctx.source_range(), "await")
.detail("expr.await")
.insert_text("await")

View file

@ -5,7 +5,7 @@ use std::sync::Arc;
use ra_db::{
salsa::{self, Database, Durability},
Canceled, CheckCanceled, CrateId, FileId, FileLoader, FileLoaderDelegate, RelativePath,
SourceDatabase, SourceDatabaseExt, SourceRootId,
SourceDatabase, SourceRootId,
};
use rustc_hash::FxHashMap;
@ -49,18 +49,6 @@ impl FileLoader for RootDatabase {
}
}
impl hir::debug::HirDebugHelper for RootDatabase {
fn crate_name(&self, krate: CrateId) -> Option<String> {
self.debug_data.crate_names.get(&krate).cloned()
}
fn file_path(&self, file_id: FileId) -> Option<String> {
let source_root_id = self.file_source_root(file_id);
let source_root_path = self.debug_data.root_paths.get(&source_root_id)?;
let file_path = self.file_relative_path(file_id);
Some(format!("{}/{}", source_root_path, file_path))
}
}
impl salsa::Database for RootDatabase {
fn salsa_runtime(&self) -> &salsa::Runtime<RootDatabase> {
&self.runtime

View file

@ -693,7 +693,6 @@ mod tests {
);
}
#[should_panic] // currently failing because of expr mapping problems
#[test]
fn goto_through_format() {
check_goto(
@ -718,7 +717,7 @@ mod tests {
format!(\"{}\", fo<|>o())
}
",
"foo FN_DEF FileId(1) [359; 376) [362; 365)",
"foo FN_DEF FileId(1) [398; 415) [401; 404)",
);
}