From 66673eae2b3d3185607d29ee341d2db8a81a46e0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 18 Jun 2021 00:42:32 +0300 Subject: internal: retire famous_defs_fixture This is now done declaratively via `minicore`. --- crates/ide_db/src/helpers.rs | 11 ++++++++-- crates/ide_db/src/helpers/famous_defs_fixture.rs | 26 ------------------------ 2 files changed, 9 insertions(+), 28 deletions(-) delete mode 100644 crates/ide_db/src/helpers/famous_defs_fixture.rs (limited to 'crates/ide_db') 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( /// somewhat similar to the known paths infra inside hir, but it different; We /// want to make sure that IDE specific paths don't become interesting inside /// the compiler itself as well. +/// +/// Note that, by default, rust-analyzer tests **do not** include core or std +/// libraries. If you are writing tests for functionality using [`FamousDefs`], +/// you'd want to include [minicore](test_utils::MiniCore) declaration at the +/// start of your tests: +/// +/// ``` +/// //- minicore: iterator, ord, derive +/// ``` pub struct FamousDefs<'a, 'b>(pub &'a Semantics<'b, RootDatabase>, pub Option); #[allow(non_snake_case)] impl FamousDefs<'_, '_> { - pub const FIXTURE: &'static str = include_str!("helpers/famous_defs_fixture.rs"); - pub fn std(&self) -> Option { self.find_crate("std") } 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 @@ -//- /libcore.rs crate:core -//! Signatures of traits, types and functions from the core lib for use in tests. -pub mod prelude { - pub mod rust_2018 { - pub use crate::{ - cmp::Ord, - convert::{From, Into}, - default::Default, - iter::{IntoIterator, Iterator}, - ops::{Fn, FnMut, FnOnce}, - option::Option::{self, *}, - }; - } -} -#[prelude_import] -pub use prelude::rust_2018::*; -//- /libstd.rs crate:std deps:core -//! Signatures of traits, types and functions from the std lib for use in tests. - -/// Docs for return_keyword -mod return_keyword {} - -/// Docs for prim_str -mod prim_str {} - -pub use core::ops; -- cgit v1.2.3