10511: minor: add a test for derive macros in core r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2021-10-10 13:25:36 +00:00 committed by GitHub
commit e9be41e395
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View File

@ -20,6 +20,26 @@ impl < > core::marker::Copy for Foo< > {}"##]],
);
}
#[test]
fn test_copy_expand_in_core() {
cov_mark::check!(test_copy_expand_in_core);
check(
r#"
#[rustc_builtin_macro]
macro Copy {}
#[derive(Copy)]
struct Foo;
"#,
expect![[r##"
#[rustc_builtin_macro]
macro Copy {}
#[derive(Copy)]
struct Foo;
impl < > crate ::marker::Copy for Foo< > {}"##]],
);
}
#[test]
fn test_copy_expand_with_type_params() {
check(

View File

@ -176,6 +176,7 @@ fn find_builtin_crate(db: &dyn AstDatabase, id: MacroCallId) -> tt::TokenTree {
let tt = if cg[krate].dependencies.iter().any(|dep| &*dep.name == "core") {
quote! { core }
} else {
cov_mark::hit!(test_copy_expand_in_core);
quote! { crate }
};