aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-17 22:44:44 +0100
committerGitHub <[email protected]>2021-06-17 22:44:44 +0100
commitc387ab6de1b860cf74655240a3d89ebe144f0e2c (patch)
tree5e7294a0239837c227b64575257bc4bb94ae0084 /crates/ide_db
parent916384a1ea50323e8d44d8024ede1d39244fbb7c (diff)
parent66673eae2b3d3185607d29ee341d2db8a81a46e0 (diff)
Merge #9320
9320: internal: retire famous_defs_fixture r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ide_db')
-rw-r--r--crates/ide_db/src/helpers.rs11
-rw-r--r--crates/ide_db/src/helpers/famous_defs_fixture.rs26
2 files changed, 9 insertions, 28 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 }
diff --git a/crates/ide_db/src/helpers/famous_defs_fixture.rs b/crates/ide_db/src/helpers/famous_defs_fixture.rs
deleted file mode 100644
index 6310fc0e1..000000000
--- a/crates/ide_db/src/helpers/famous_defs_fixture.rs
+++ /dev/null
@@ -1,26 +0,0 @@
1//- /libcore.rs crate:core
2//! Signatures of traits, types and functions from the core lib for use in tests.
3pub mod prelude {
4 pub mod rust_2018 {
5 pub use crate::{
6 cmp::Ord,
7 convert::{From, Into},
8 default::Default,
9 iter::{IntoIterator, Iterator},
10 ops::{Fn, FnMut, FnOnce},
11 option::Option::{self, *},
12 };
13 }
14}
15#[prelude_import]
16pub use prelude::rust_2018::*;
17//- /libstd.rs crate:std deps:core
18//! Signatures of traits, types and functions from the std lib for use in tests.
19
20/// Docs for return_keyword
21mod return_keyword {}
22
23/// Docs for prim_str
24mod prim_str {}
25
26pub use core::ops;