mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-14 17:07:26 +00:00
Add test
This commit is contained in:
parent
6a5014329a
commit
213d208e2d
2 changed files with 27 additions and 1 deletions
|
@ -165,7 +165,7 @@ fn find_builtin_crate(db: &dyn AstDatabase, id: LazyMacroId) -> tt::TokenTree {
|
|||
crates.iter().filter_map(|krate| cg[*krate].display_name.clone()).map(|it| it.to_string());
|
||||
|
||||
let tt = if crate_names.any(|name| name == "std" || name == "core") {
|
||||
quote! { krate }
|
||||
quote! { crate }
|
||||
} else {
|
||||
quote! { core }
|
||||
};
|
||||
|
|
|
@ -642,6 +642,32 @@ mod clone {
|
|||
assert_eq!("S", type_at_pos(&db, pos));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn infer_derive_clone_in_core() {
|
||||
let (db, pos) = TestDB::with_position(
|
||||
r#"
|
||||
//- /main.rs crate:main deps:core
|
||||
use core::S;
|
||||
fn test() {
|
||||
S.clone()<|>;
|
||||
}
|
||||
|
||||
//- /lib.rs crate:core
|
||||
#[prelude_import]
|
||||
use clone::*;
|
||||
mod clone {
|
||||
trait Clone {
|
||||
fn clone(&self) -> Self;
|
||||
}
|
||||
}
|
||||
#[derive(Clone)]
|
||||
pub struct S;
|
||||
|
||||
"#,
|
||||
);
|
||||
assert_eq!("S", type_at_pos(&db, pos));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn infer_derive_clone_with_params() {
|
||||
let (db, pos) = TestDB::with_position(
|
||||
|
|
Loading…
Reference in a new issue