aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db/src/helpers.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_db/src/helpers.rs')
-rw-r--r--crates/ide_db/src/helpers.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/crates/ide_db/src/helpers.rs b/crates/ide_db/src/helpers.rs
index 00900cdc2..d96028cbc 100644
--- a/crates/ide_db/src/helpers.rs
+++ b/crates/ide_db/src/helpers.rs
@@ -74,12 +74,19 @@ pub fn visit_file_defs(
74/// somewhat similar to the known paths infra inside hir, but it different; We 74/// somewhat similar to the known paths infra inside hir, but it different; We
75/// want to make sure that IDE specific paths don't become interesting inside 75/// want to make sure that IDE specific paths don't become interesting inside
76/// the compiler itself as well. 76/// the compiler itself as well.
77///
78/// Note that, by default, rust-analyzer tests **do not** include core or std
79/// libraries. If you are writing tests for functionality using [`FamousDefs`],
80/// you'd want to include [minicore](test_utils::MiniCore) declaration at the
81/// start of your tests:
82///
83/// ```
84/// //- minicore: iterator, ord, derive
85/// ```
77pub struct FamousDefs<'a, 'b>(pub &'a Semantics<'b, RootDatabase>, pub Option<Crate>); 86pub struct FamousDefs<'a, 'b>(pub &'a Semantics<'b, RootDatabase>, pub Option<Crate>);
78 87
79#[allow(non_snake_case)] 88#[allow(non_snake_case)]
80impl FamousDefs<'_, '_> { 89impl FamousDefs<'_, '_> {
81 pub const FIXTURE: &'static str = include_str!("helpers/famous_defs_fixture.rs");
82
83 pub fn std(&self) -> Option<Crate> { 90 pub fn std(&self) -> Option<Crate> {
84 self.find_crate("std") 91 self.find_crate("std")
85 } 92 }