Skip to content

WIP: test and runnable explorer #5765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
236 changes: 112 additions & 124 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions crates/hir/src/semantics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ impl PathResolution {
}

/// Primary API to get semantic information, like types, from syntax trees.
pub struct Semantics<'db, DB> {
pub db: &'db DB,
pub struct Semantics<'db> {
pub db: &'db dyn HirDatabase,
imp: SemanticsImpl<'db>,
}

Expand All @@ -100,14 +100,14 @@ pub struct SemanticsImpl<'db> {
cache: RefCell<FxHashMap<SyntaxNode, HirFileId>>,
}

impl<DB> fmt::Debug for Semantics<'_, DB> {
impl fmt::Debug for Semantics<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Semantics {{ ... }}")
}
}

impl<'db, DB: HirDatabase> Semantics<'db, DB> {
pub fn new(db: &DB) -> Semantics<DB> {
impl<'db> Semantics<'db> {
pub fn new(db: &dyn HirDatabase) -> Semantics {
let impl_ = SemanticsImpl::new(db);
Semantics { db, imp: impl_ }
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hir_def/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ macro_rules! impl_intern {

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct FunctionId(salsa::InternId);
type FunctionLoc = AssocItemLoc<Function>;
pub type FunctionLoc = AssocItemLoc<Function>;
impl_intern!(FunctionId, FunctionLoc, intern_function, lookup_intern_function);

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
Expand Down
12 changes: 3 additions & 9 deletions crates/ide/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,12 @@ mod typing;
mod view_crate_graph;
mod view_hir;
mod view_item_tree;
mod runnables;

use std::sync::Arc;

use cfg::CfgOptions;
use ide_db::{
base_db::{
salsa::{self, ParallelDatabase},
Env, FileLoader, FileSet, SourceDatabase, VfsPath,
},
symbol_index::{self, FileSymbol},
LineIndexDatabase,
};
use ide_db::{LineIndexDatabase, base_db::{Env, FileLoader, FileSet, SourceDatabase, Upcast, VfsPath, salsa::{self, ParallelDatabase}}, symbol_index::{self, FileSymbol}};
use syntax::SourceFile;

use crate::display::ToNav;
Expand Down Expand Up @@ -476,7 +470,7 @@ impl Analysis {

/// Returns the set of possible targets to run for the current file.
pub fn runnables(&self, file_id: FileId) -> Cancellable<Vec<Runnable>> {
self.with_db(|db| runnables::runnables(db, file_id))
self.with_db(|db| runnables::runnables(db.upcast(), file_id))
}

/// Returns the set of tests for the given file position.
Expand Down
Loading